Skip to content

Commit

Permalink
Landscaper: QUnit2 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
cherifGsoul committed May 10, 2019
1 parent fe32908 commit 49ae83e
Show file tree
Hide file tree
Showing 24 changed files with 499 additions and 499 deletions.
54 changes: 27 additions & 27 deletions can-query-logic-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ QUnit.module("can-query-logic");



QUnit.test("union", function() {
QUnit.test("union", function(assert) {
var unionResult = algebra.union({
filter: {
name: "Ramiya"
Expand All @@ -38,7 +38,7 @@ QUnit.test("union", function() {
}
});

QUnit.deepEqual(unionResult, {
assert.deepEqual(unionResult, {
filter: {
name: {
$in: ["Ramiya", "Bohdi"]
Expand All @@ -47,7 +47,7 @@ QUnit.test("union", function() {
});
});

QUnit.test("difference", function() {
QUnit.test("difference", function(assert) {
var differenceResult = algebra.difference({
filter: {
name: {
Expand All @@ -60,7 +60,7 @@ QUnit.test("difference", function() {
}
});

QUnit.deepEqual(differenceResult, {
assert.deepEqual(differenceResult, {
filter: {
name: "Ramiya",
}
Expand All @@ -69,7 +69,7 @@ QUnit.test("difference", function() {

});

QUnit.test("subset", function() {
QUnit.test("subset", function(assert) {
var subsetResult = algebra.isSubset({
filter: {
name: "Bohdi"
Expand All @@ -82,10 +82,10 @@ QUnit.test("subset", function() {
}
});

QUnit.deepEqual(subsetResult, true);
assert.deepEqual(subsetResult, true);
});

QUnit.test("isMember", function() {
QUnit.test("isMember", function(assert) {
var hasResult = algebra.isMember({
filter: {
name: "Bohdi"
Expand All @@ -94,10 +94,10 @@ QUnit.test("isMember", function() {
name: "Bohdi"
});

QUnit.deepEqual(hasResult, true);
assert.deepEqual(hasResult, true);
});

QUnit.test("filterMembers basics", function() {
QUnit.test("filterMembers basics", function(assert) {
var subset = algebra.filterMembers({
filter: {
name: {
Expand All @@ -118,7 +118,7 @@ QUnit.test("filterMembers basics", function() {
}
]);

QUnit.deepEqual(subset, [{
assert.deepEqual(subset, [{
name: "Bohdi"
},
{
Expand Down Expand Up @@ -150,7 +150,7 @@ QUnit.test("filterMembers basics", function() {
}
]);

QUnit.deepEqual(subset, [{
assert.deepEqual(subset, [{
name: "Payal"
},
{
Expand All @@ -160,7 +160,7 @@ QUnit.test("filterMembers basics", function() {
});


QUnit.test("unionMembers basics", function() {
QUnit.test("unionMembers basics", function(assert) {
var union = algebra.unionMembers({
filter: {
name: "Bohdi"
Expand All @@ -177,7 +177,7 @@ QUnit.test("unionMembers basics", function() {
id: 2
}, ]);

QUnit.deepEqual(union, [{
assert.deepEqual(union, [{
name: "Bohdi",
id: 1
},
Expand All @@ -188,10 +188,10 @@ QUnit.test("unionMembers basics", function() {
]);
});

QUnit.test("count basics", function() {
QUnit.test("count basics", function(assert) {

QUnit.equal(algebra.count({}), Infinity);
QUnit.equal(algebra.count({
assert.equal(algebra.count({}), Infinity);
assert.equal(algebra.count({
page: {
start: 1,
end: 2
Expand All @@ -201,7 +201,7 @@ QUnit.test("count basics", function() {

});

QUnit.test('index basics', function() {
QUnit.test('index basics', function(assert) {

var index = algebra.index({
sort: "name"
Expand All @@ -221,7 +221,7 @@ QUnit.test('index basics', function() {
}], {
name: "k"
});
equal(index, 2);
assert.equal(index, 2);

index = algebra.index({
sort: "-name"
Expand All @@ -241,7 +241,7 @@ QUnit.test('index basics', function() {
}].reverse(), {
name: "k"
});
equal(index, 2);
assert.equal(index, 2);

index = algebra.index({},
[{
Expand All @@ -261,7 +261,7 @@ QUnit.test('index basics', function() {
name: "k"
});

equal(index, 0);
assert.equal(index, 0);


index = algebra.index({},
Expand All @@ -281,7 +281,7 @@ QUnit.test('index basics', function() {
name: "k"
});

equal(index, undefined, "no value if no id");
assert.equal(index, undefined, "no value if no id");

var TODO_id = canReflect.assignSymbols({}, {
"can.getSchema": function() {
Expand Down Expand Up @@ -317,13 +317,13 @@ QUnit.test('index basics', function() {
_id: 2
});

equal(index, 2);
assert.equal(index, 2);

//var algebra = new set.Algebra(set.props.id("id"));

});

QUnit.test("filterMembers with reverse sort", function() {
QUnit.test("filterMembers with reverse sort", function(assert) {
var sortedMembers = algebra.filterMembers({
sort: "-name"
},
Expand All @@ -341,7 +341,7 @@ QUnit.test("filterMembers with reverse sort", function() {
name: "s"
}]);

QUnit.deepEqual(sortedMembers,
assert.deepEqual(sortedMembers,
[{
id: 2,
name: "z"
Expand Down Expand Up @@ -408,11 +408,11 @@ QUnit.test("Value returned by makeEnum is constructorLike", function(assert) {
assert.ok(pass, "Status is constructor like");
});

QUnit.test("can call low-level APIs from the outside", function() {
QUnit.test("can call low-level APIs from the outside", function(assert) {
var gt1 = new QueryLogic.GreaterThan(1);
var lte1 = new QueryLogic.LessThanEqual(1);

QUnit.equal(QueryLogic.intersection(gt1, lte1), QueryLogic.EMPTY);
assert.equal(QueryLogic.intersection(gt1, lte1), QueryLogic.EMPTY);


var isGtJustinAndGt35 = new QueryLogic.KeysAnd({
Expand All @@ -423,6 +423,6 @@ QUnit.test("can call low-level APIs from the outside", function() {
age: new QueryLogic.GreaterThan(25)
});

QUnit.deepEqual(QueryLogic.union(isGtJustinAndGt35, isGt25), isGt25, "fewer clauses");
assert.deepEqual(QueryLogic.union(isGtJustinAndGt35, isGt25), isGt25, "fewer clauses");

});
28 changes: 14 additions & 14 deletions compat/prop_tests/boolean_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ QUnit.module("can-set compat props.boolean");
*
*
*/
test('boolean set.difference', function() {
QUnit.test('boolean set.difference', function(assert) {

var prop = props.boolean('completed');

Expand All @@ -25,7 +25,7 @@ test('boolean set.difference', function() {
* z ∈ (X / Y) | y.completed = false
*/
var res = set.difference({} , { completed: true }, prop);
deepEqual(res, {completed: false}, "inverse of true");
assert.deepEqual(res, {completed: false}, "inverse of true");

/*
* x ∈ {} | x.completed = true OR x.completed = false
Expand All @@ -34,7 +34,7 @@ test('boolean set.difference', function() {
* z ∈ (X / Y) | y.completed = false
*/
res = set.difference({}, { completed: false }, prop);
deepEqual(res, {completed: true} , "inverse of false");
assert.deepEqual(res, {completed: true} , "inverse of false");
});

/*
Expand All @@ -44,10 +44,10 @@ test('boolean set.difference', function() {
*
* (X U Y) = c
*/
test('boolean set.union', function(){
QUnit.test('boolean set.union', function(assert) {
var prop = props.boolean('completed');
var res = set.union({completed: false} , { completed: true }, prop);
deepEqual(res, {}, "union of true and false is entire boolean set");
assert.deepEqual(res, {}, "union of true and false is entire boolean set");
});

/*
Expand All @@ -69,31 +69,31 @@ test('boolean set.union', function(){
*
* Only requires that one property is always on an element
*/
test('boolean set.intersection', function(){
QUnit.test('boolean set.intersection', function(assert) {
var prop = props.boolean('completed');
var res = set.intersection({foo: "bar"} , { completed: true }, prop);
deepEqual(res, {foo: "bar", completed: true}, "intersection is false (#4)");
assert.deepEqual(res, {foo: "bar", completed: true}, "intersection is false (#4)");
});


test('strings false and true are treated as booleans', function(){
QUnit.test('strings false and true are treated as booleans', function(assert) {
var prop = props.boolean('completed');
var res;

res = set.isSubset({} , { completed: "true" }, prop);
ok(!res, "{} and 'true' not a subset");
assert.ok(!res, "{} and 'true' not a subset");
res = set.isSubset({} , { completed: "false" }, prop);
ok(!res, "{} and 'false' not a subset");
assert.ok(!res, "{} and 'false' not a subset");

res = set.isSubset({ completed: "true" }, {}, prop);
ok(res, "subset");
assert.ok(res, "subset");

res = set.isSubset({ completed: "false" }, {}, prop);
ok(res, "subset");
assert.ok(res, "subset");

res = set.union({completed: 'false'} , { completed: 'true' }, prop);
deepEqual(res, {}, "union of true and false is entire boolean set");
assert.deepEqual(res, {}, "union of true and false is entire boolean set");

res = set.isEqual({completed: false} , { completed: "false" }, prop);
ok(res, "false and 'false'");
assert.ok(res, "false and 'false'");
});
26 changes: 13 additions & 13 deletions compat/prop_tests/dotNotation_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@ QUnit.module("can-set props.dotNotation");
* x ∈ X | x.n.p = 'IL'
*
*/
test('dotNotation set membership', function() {
QUnit.test('dotNotation set membership', function(assert) {
/*
* For a property 'n.p', with value 'IL'
* x ∈ X | x.n.p == 'IL'
*/
var prop = props.dotNotation('n.p'),
alg = new set.Algebra(prop),
res = alg.isMember({'n.p': 'IL'}, {n:{p:'IL'}});
ok(res, "object with nested property is member of set using dotNotation");
assert.ok(res, "object with nested property is member of set using dotNotation");

/*
* For a property 'n.p', with value 'IL'
* x ∉ X | x.n.p != 'IL'
*/
res = alg.isMember({'n.p': 'IL'}, {n:{p:'MI'}});
ok(res === false, "object with nested property not a member of set using dotNotation");
assert.ok(res === false, "object with nested property not a member of set using dotNotation");

/*
* For a property 'n.p.s', with value 'IL'
Expand All @@ -36,10 +36,10 @@ test('dotNotation set membership', function() {
prop = props.dotNotation('n.p.s');
alg = new set.Algebra(prop);
res = alg.isMember({'n.p.s': 'IL'}, {n:{p:{s:'IL'}}});
ok(res, "object with deep nested property is member of set using dotNotation");
assert.ok(res, "object with deep nested property is member of set using dotNotation");
});

test('dotNotation set equality', function() {
QUnit.test('dotNotation set equality', function(assert) {
var prop = props.dotNotation('n.p'),
alg = new set.Algebra(prop),
set1 = {'n.p': 'IL'},
Expand All @@ -50,20 +50,20 @@ test('dotNotation set equality', function() {
/*
* {x | x ∈ X, x.n.p == 'IL'} = {y | y ∈ Y, y.n.p == 'IL'}
*/
ok(alg.equal(set1, set2) && alg.equal(set2, set1), "sets with dotNotation properties are equivalent");
assert.ok(alg.equal(set1, set2) && alg.equal(set2, set1), "sets with dotNotation properties are equivalent");

/*
* {x | x ∈ X, x.n.p == 'IL'} != {y | y ∈ Y, y.n.p == 'MI'}
*/
ok(alg.equal(set1, set3) === false, "sets with dotNotation properties are not equivalent");
assert.ok(alg.equal(set1, set3) === false, "sets with dotNotation properties are not equivalent");

/*
* {x | x ∈ X, x.n.p == 'MI'} = {y | y ∈ Y, y.n.p == 'MI'}
*/
ok(alg.equal(set4, set3) === false, "sets with dotNotation properties are equivalent to sets with nested properties");
assert.ok(alg.equal(set4, set3) === false, "sets with dotNotation properties are equivalent to sets with nested properties");
});

test('dotNotation set subset', function() {
QUnit.test('dotNotation set subset', function(assert) {
var alg = new set.Algebra(
props.dotNotation('address.state'),
props.dotNotation('address.city')
Expand All @@ -75,20 +75,20 @@ test('dotNotation set subset', function() {
/*
* {x | x ∈ X, x.address.state = 'IL', x.address.city = 'Chicago'} ⊆ {y | y ∈ Y, y.address.state == 'IL'}
*/
ok(alg.subset(set2, set1), "sets with dotNotation property is a subset of another dotNotation set");
assert.ok(alg.subset(set2, set1), "sets with dotNotation property is a subset of another dotNotation set");

/*
* {x | x ∈ X, x.address.state = 'IL', x.address.city = 'Chicago'} ⊆ {y | y ∈ Y, y.address.state == 'IL'}
*/
ok(alg.subset(set3, set1), "sets with nested property notation is a subset of a dotNotation set");
assert.ok(alg.subset(set3, set1), "sets with nested property notation is a subset of a dotNotation set");

/*
* {y | y ∈ Y, y.address.state == 'IL'} ⊆ ξ
*/
ok(alg.subset(set1, {}), "sets with dotNotation properties are subsets of the universal set");
assert.ok(alg.subset(set1, {}), "sets with dotNotation properties are subsets of the universal set");

/*
* ξ ⊄ {y | y ∈ Y, y.address.state == 'IL'}
*/
ok(alg.subset({}, set1) === false, "the universal set is not a subset of a set with dotNotation");
assert.ok(alg.subset({}, set1) === false, "the universal set is not a subset of a set with dotNotation");
});
Loading

0 comments on commit 49ae83e

Please sign in to comment.