Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not check for subsets when it is the universal set #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@
end_of_line = LF
indent_style = tab
trim_trailing_whitespace = false
insert_final_newline = true
insert_final_newline = true
indent_size = 4

[{*.json,*.yml,*.md}]
indent_style = space
indent_size = 2
19 changes: 19 additions & 0 deletions can-memory-store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions make-simple-store.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
var canReflect = require("can-reflect");


function getItems(data){
if(Array.isArray(data)) {
return data;
Expand Down Expand Up @@ -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];
}
}
Expand Down