diff --git a/.editorconfig b/.editorconfig index 3f2c164..6a1468d 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,4 +3,9 @@ end_of_line = LF indent_style = tab trim_trailing_whitespace = false -insert_final_newline = true \ No newline at end of file +insert_final_newline = true +indent_size = 4 + +[{*.json,*.yml,*.md}] +indent_style = space +indent_size = 2 diff --git a/can-memory-store-test.js b/can-memory-store-test.js index 2a3ef1c..eda8a0e 100644 --- a/can-memory-store-test.js +++ b/can-memory-store-test.js @@ -538,5 +538,24 @@ QUnit.test("create, update, destroy all return saved data", function(assert) { }); }); +QUnit.test("Does not do subset comparisons when the superset is the universe", function(assert) { + var queryLogic = new QueryLogic({}); + queryLogic.isSubset = function() { + throw new Error("CANNOT COMPARE"); + }; + + var store = memoryStore({ + queryLogic: queryLogic + }); + store.updateQueryDataSync([{ query: {}, startIdentity: "123" }]); + + try { + store.getListDataSync({ filter: {a: "b"} }); + assert.ok(true, "Able to getListData with a universal superset"); + } catch(e) { + assert.ok(false, e); + } +}); + // TODO: make sure we get the right count diff --git a/make-simple-store.js b/make-simple-store.js index 8c22bae..c6b2db3 100644 --- a/make-simple-store.js +++ b/make-simple-store.js @@ -1,6 +1,5 @@ var canReflect = require("can-reflect"); - function getItems(data){ if(Array.isArray(data)) { return data; @@ -80,7 +79,8 @@ function makeSimpleStore(baseConnection) { for(var i = 0; i < queryData.length; i++) { var checkSet = queryData[i].query; - if( this.queryLogic.isSubset(query, checkSet) ) { + if( this.queryLogic.isEqual(checkSet, {}) || + this.queryLogic.isSubset(query, checkSet) ) { superSetQueryData = queryData[i]; } }