diff --git a/can-query-logic-test.js b/can-query-logic-test.js index cecbb9b..6898589 100644 --- a/can-query-logic-test.js +++ b/can-query-logic-test.js @@ -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" @@ -38,7 +38,7 @@ QUnit.test("union", function() { } }); - QUnit.deepEqual(unionResult, { + assert.deepEqual(unionResult, { filter: { name: { $in: ["Ramiya", "Bohdi"] @@ -47,7 +47,7 @@ QUnit.test("union", function() { }); }); -QUnit.test("difference", function() { +QUnit.test("difference", function(assert) { var differenceResult = algebra.difference({ filter: { name: { @@ -60,7 +60,7 @@ QUnit.test("difference", function() { } }); - QUnit.deepEqual(differenceResult, { + assert.deepEqual(differenceResult, { filter: { name: "Ramiya", } @@ -69,7 +69,7 @@ QUnit.test("difference", function() { }); -QUnit.test("subset", function() { +QUnit.test("subset", function(assert) { var subsetResult = algebra.isSubset({ filter: { name: "Bohdi" @@ -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" @@ -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: { @@ -118,7 +118,7 @@ QUnit.test("filterMembers basics", function() { } ]); - QUnit.deepEqual(subset, [{ + assert.deepEqual(subset, [{ name: "Bohdi" }, { @@ -150,7 +150,7 @@ QUnit.test("filterMembers basics", function() { } ]); - QUnit.deepEqual(subset, [{ + assert.deepEqual(subset, [{ name: "Payal" }, { @@ -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" @@ -177,7 +177,7 @@ QUnit.test("unionMembers basics", function() { id: 2 }, ]); - QUnit.deepEqual(union, [{ + assert.deepEqual(union, [{ name: "Bohdi", id: 1 }, @@ -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 @@ -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" @@ -221,7 +221,7 @@ QUnit.test('index basics', function() { }], { name: "k" }); - equal(index, 2); + assert.equal(index, 2); index = algebra.index({ sort: "-name" @@ -241,7 +241,7 @@ QUnit.test('index basics', function() { }].reverse(), { name: "k" }); - equal(index, 2); + assert.equal(index, 2); index = algebra.index({}, [{ @@ -261,7 +261,7 @@ QUnit.test('index basics', function() { name: "k" }); - equal(index, 0); + assert.equal(index, 0); index = algebra.index({}, @@ -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() { @@ -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" }, @@ -341,7 +341,7 @@ QUnit.test("filterMembers with reverse sort", function() { name: "s" }]); - QUnit.deepEqual(sortedMembers, + assert.deepEqual(sortedMembers, [{ id: 2, name: "z" @@ -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({ @@ -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"); }); diff --git a/compat/prop_tests/boolean_test.js b/compat/prop_tests/boolean_test.js index 49abe8a..3f7e4fc 100644 --- a/compat/prop_tests/boolean_test.js +++ b/compat/prop_tests/boolean_test.js @@ -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'); @@ -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 @@ -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"); }); /* @@ -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"); }); /* @@ -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'"); }); diff --git a/compat/prop_tests/dotNotation_test.js b/compat/prop_tests/dotNotation_test.js index 26434e8..7356c41 100644 --- a/compat/prop_tests/dotNotation_test.js +++ b/compat/prop_tests/dotNotation_test.js @@ -12,7 +12,7 @@ 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' @@ -20,14 +20,14 @@ test('dotNotation set membership', function() { 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' @@ -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'}, @@ -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') @@ -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"); }); diff --git a/compat/prop_tests/enum_test.js b/compat/prop_tests/enum_test.js index 257814e..abb0a4d 100644 --- a/compat/prop_tests/enum_test.js +++ b/compat/prop_tests/enum_test.js @@ -5,7 +5,7 @@ var set = require('../compat'), QUnit.module("can-set compat props.enum"); -test('enum set.intersection', function(){ +QUnit.test('enum set.intersection', function(assert) { /* * For a property p, * x ∈ {} | x.p exists @@ -19,7 +19,7 @@ test('enum set.intersection', function(){ * (X ∩ Y) = Y */ var res = set.intersection({} , { type: 'new' }, prop); - deepEqual(res, {type: 'new' }, "single enum intersected with universal set is idempotent"); + assert.deepEqual(res, {type: 'new' }, "single enum intersected with universal set is idempotent"); /* * x ∈ X ∀ x @@ -28,7 +28,7 @@ test('enum set.intersection', function(){ * (X ∩ Y) = Y */ res = set.intersection({} , { type: ['new','prep'] }, prop); - deepEqual(res, {type: ['new','prep'] }, "array enum intersected with unversal set is idempotent"); + assert.deepEqual(res, {type: ['new','prep'] }, "array enum intersected with unversal set is idempotent"); /* * x ∈ X | x.type = 'prep' @@ -37,7 +37,7 @@ test('enum set.intersection', function(){ * z ∈ (X ∩ Y) | z.type = 'prep' */ res = set.intersection({type: ['prep'] } , { type: ['new','prep'] }, prop); - deepEqual(res, {type: 'prep' }, "items v items intersection"); + assert.deepEqual(res, {type: 'prep' }, "items v items intersection"); /* @@ -47,7 +47,7 @@ test('enum set.intersection', function(){ * (X ∩ Y) = Y */ res = set.intersection({type: [] } , { type: ['new','prep'] }, prop); - deepEqual(res, set.EMPTY, "empty v array intersection"); + assert.deepEqual(res, set.EMPTY, "empty v array intersection"); /* * x ∈ X | x.type = 'new' @@ -56,10 +56,10 @@ test('enum set.intersection', function(){ * (X ∩ Y) = X */ res = set.intersection({ type: 'new' },{}, prop); - deepEqual(res, {type: 'new' }, "single v all"); + assert.deepEqual(res, {type: 'new' }, "single v all"); }); -test('enum set.difference', function(){ +QUnit.test('enum set.difference', function(assert) { var prop = props["enum"]('type',['new','prep','deliver','delivered']), res; /* @@ -73,7 +73,7 @@ test('enum set.difference', function(){ * z ∈ ({} / Y) | z.type ∈ ['prep', 'deliver', 'delivered'] */ res = set.difference({} , { type: 'new' }, prop); - deepEqual(res, {type: ['prep','deliver','delivered'] }, "difference from universal set"); + assert.deepEqual(res, {type: ['prep','deliver','delivered'] }, "difference from universal set"); /* * x ∈ {} | x.type ∈ ['new', 'prep', 'deliver', 'delivered'] @@ -82,7 +82,7 @@ test('enum set.difference', function(){ * z ∈ ({} / Y) | z.type = ['deliver', 'delivered'] */ res = set.difference({} , { type: ['new','prep'] }, prop); - deepEqual(res, {type: ['deliver','delivered'] }, "difference from universal set"); + assert.deepEqual(res, {type: ['deliver','delivered'] }, "difference from universal set"); /* * x ∈ X | x.type ∈ ['prep'] @@ -91,13 +91,13 @@ test('enum set.difference', function(){ * X / Y = ∅ */ res = set.difference({type: ['prep'] } , { type: ['new','prep'] }, prop); - deepEqual(res, set.EMPTY, "difference from a superset"); + assert.deepEqual(res, set.EMPTY, "difference from a superset"); /* * {} = {type: []} */ res = set.difference({ } , { type: ['new','prep'] }, prop); - deepEqual(res, {type: ['deliver','delivered'] }, "empty enum definition is same as universal set"); + assert.deepEqual(res, {type: ['deliver','delivered'] }, "empty enum definition is same as universal set"); /* * x ∈ X | x.type ∈ ['prep'] @@ -106,10 +106,10 @@ test('enum set.difference', function(){ * X / {} = ∅ */ res = set.difference({ type: 'new' },{}, prop); - deepEqual(res, set.EMPTY, "all"); + assert.deepEqual(res, set.EMPTY, "all"); }); -test('enum set.union', function(){ +QUnit.test('enum set.union', function(assert) { var prop = props["enum"]('type',['new','prep','deliver','delivered']); /* * x ∈ {} | x.type ∈ ['new', 'prep', 'deliver', 'delivered'] @@ -120,13 +120,13 @@ test('enum set.union', function(){ * ({} U Y) = {} ∀ Y */ var res = set.union({} , { type: 'new' }, prop); - deepEqual(res, {}, "all"); + assert.deepEqual(res, {}, "all"); /* * ({} U Y) = {} ∀ Y */ res = set.union({} , { type: ['new','prep'] }, prop); - deepEqual(res, {}, "intersection"); + assert.deepEqual(res, {}, "intersection"); /* @@ -134,7 +134,7 @@ test('enum set.union', function(){ * (X U Y) = Y */ res = set.union({type: ['prep'] } , { type: ['new','prep'] }, prop); - deepEqual(res, { type: ['prep','new'] }, "union of a superset is superset"); + assert.deepEqual(res, { type: ['prep','new'] }, "union of a superset is superset"); /* @@ -142,13 +142,13 @@ test('enum set.union', function(){ * {type: []} = {} */ res = set.union({} , { type: ['new','prep'] }, prop); - deepEqual(res, { }, "intersection"); + assert.deepEqual(res, { }, "intersection"); /* * (Y U {}) = {} ∀ Y */ res = set.union({ type: 'new' },{}, prop); - deepEqual(res, {}, "all"); + assert.deepEqual(res, {}, "all"); /* * x ∈ X | x ∉ Y @@ -157,11 +157,11 @@ test('enum set.union', function(){ * X U Y = {} */ res = set.union({type: ['deliver','delivered'] } , { type: ['new','prep'] }, prop); - deepEqual(res, {}, "intersection"); + assert.deepEqual(res, {}, "intersection"); }); -test('enum set.equal', function(){ +QUnit.test('enum set.equal', function(assert) { var prop = props["enum"]('type',['new','prep','deliver','delivered']), res; /* @@ -184,7 +184,7 @@ test('enum set.equal', function(){ * {} = Y */ res = set.isEqual({} , { type: ['new','prep','deliver','delivered'] }, prop); - deepEqual(res, true, "subset of all possible enums is the same as universal set"); + assert.deepEqual(res, true, "subset of all possible enums is the same as universal set"); /* * x ∈ X | x.type ∈ ['new'] @@ -193,7 +193,7 @@ test('enum set.equal', function(){ * X = Y */ res = set.isEqual({type: ['prep'] } , { type: ['prep'] }, prop); - deepEqual(res, true, "identical sets with single array enum are equal"); + assert.deepEqual(res, true, "identical sets with single array enum are equal"); /* * x ∈ X | x.type = 'new' @@ -202,7 +202,7 @@ test('enum set.equal', function(){ * X = Y */ res = set.isEqual({type: 'prep'} , { type: 'prep' }, prop); - deepEqual(res, true, "identical sets with single property enum are equal"); + assert.deepEqual(res, true, "identical sets with single property enum are equal"); /* * x ∈ X | x.type = 'new' @@ -211,11 +211,11 @@ test('enum set.equal', function(){ * Y != X */ res = set.isEqual({ type: 'new' },{type: 'prep'}, prop); - deepEqual(res, false, "two sets with different enum properties are not equal"); + assert.deepEqual(res, false, "two sets with different enum properties are not equal"); }); -test('enum set.isSubset', function(){ +QUnit.test('enum set.isSubset', function(assert) { var prop = props["enum"]('type',['new','prep','deliver','delivered']); /* * x ∈ X | x.type ∈ ['new', 'prep', 'deliver', 'delivered'] @@ -228,35 +228,35 @@ test('enum set.isSubset', function(){ * {} ⊄ Y */ var res = set.isSubset({} , { type: 'new' }, prop); - deepEqual(res, false, "universal set is not a subset"); + assert.deepEqual(res, false, "universal set is not a subset"); /* * y ∈ Y | y.type = 'new' * Y ⊆ X ∀ Y */ res = set.isSubset({ type: 'new' }, {} , prop); - deepEqual(res, true, "any single enum is a subset of universal set"); + assert.deepEqual(res, true, "any single enum is a subset of universal set"); /* * Y = {} * Y ⊆ X ∀ Y */ res = set.isSubset({} , { type: ['new','prep','deliver','delivered'] }, prop); - deepEqual(res, true, "enum set matching definition of universal set is a subset of universal set"); + assert.deepEqual(res, true, "enum set matching definition of universal set is a subset of universal set"); /* * y ∈ Y | x.type ∈ ['prep'] * Y ⊆ X ∀ Y */ res = set.isSubset({type: ['prep'] } , { type: ['prep'] }, prop); - deepEqual(res, true, "any list of possible enums are subset of universal set"); + assert.deepEqual(res, true, "any list of possible enums are subset of universal set"); /* * y ∈ Y | x.type = 'prep' * Y ⊆ X ∀ Y */ res = set.isSubset({type: 'prep'} , { type: 'prep' }, prop); - deepEqual(res, true, "intersection"); + assert.deepEqual(res, true, "intersection"); /* * x ∈ X | x.type = 'new' @@ -265,12 +265,12 @@ test('enum set.isSubset', function(){ * X ⊄ Y */ res = set.isSubset({ type: 'new' },{type: 'prep'}, prop); - deepEqual(res, false, "all"); + assert.deepEqual(res, false, "all"); /* * x ∈ X | x.type ∈ ['new', 'prep', 'deliver', 'delivered'] * Y ⊆ X ∀ Y */ res = set.isSubset({type: 'prep'} , { type: ['new','prep','deliver','delivered'] }, prop); - deepEqual(res, true, "intersection"); + assert.deepEqual(res, true, "intersection"); }); diff --git a/compat/prop_tests/id_test.js b/compat/prop_tests/id_test.js index 4bbda8c..5a0d907 100644 --- a/compat/prop_tests/id_test.js +++ b/compat/prop_tests/id_test.js @@ -5,23 +5,23 @@ var set = require('../compat'), QUnit.module("can-set props.id"); -test("id set.difference", function(){ +QUnit.test("id set.difference", function(assert) { var idProps = props.id("color"); var res; res = set.difference({ color: "red" }, { color: "blue" }, idProps); - deepEqual(res, { color: "red" }, "id changes always false"); + assert.deepEqual(res, { color: "red" }, "id changes always false"); res = set.difference({ color: "red" }, { }, idProps); - deepEqual(res, set.EMPTY, "id removal always false"); + assert.deepEqual(res, set.EMPTY, "id removal always false"); res = set.difference({ }, { color: "blue" }, idProps); - deepEqual(res, set.UNDEFINABLE, "id addition always true"); + assert.deepEqual(res, set.UNDEFINABLE, "id addition always true"); }); -test("id set.difference with where", function() { +QUnit.test("id set.difference with where", function(assert) { var algebra = new set.Algebra( props.id("color"), props.enum("type", ["light", "dark"]) @@ -29,22 +29,22 @@ test("id set.difference with where", function() { var res; res = set.difference({ color: "red", type: ["light", "dark"] }, { color: "blue", type: "light" }, algebra); - deepEqual(res, { color: "red", type: ["light", "dark"] }, "id changes always false"); + assert.deepEqual(res, { color: "red", type: ["light", "dark"] }, "id changes always false"); res = set.difference({ color: "red", type: ["light", "dark"] }, { type: "light" }, algebra); - deepEqual(res, { color: "red", type: "dark" }, "id removal always false"); + assert.deepEqual(res, { color: "red", type: "dark" }, "id removal always false"); var a2 = new set.Algebra( props.enum("color", ["red", "green"]) ); res = set.difference({ color: ["red", "green"] }, { status: "accepted", color: "red" }, a2); - deepEqual(res, set.UNDEFINABLE, "id addition always true"); + assert.deepEqual(res, set.UNDEFINABLE, "id addition always true"); res = set.difference({ type: ["light", "dark"] }, { type: "light" }, algebra); - deepEqual(res, { type: "dark" }, "no id clause, fall back to where"); + assert.deepEqual(res, { type: "dark" }, "no id clause, fall back to where"); res = set.difference({ color: "red", type: ["light", "dark"] }, { color: "red", type: "light" }, algebra); - deepEqual(res, { color: "red", type: "dark" }, "no id change, fall back to where"); + assert.deepEqual(res, { color: "red", type: "dark" }, "no id change, fall back to where"); }); diff --git a/compat/prop_tests/offsetLimit_test.js b/compat/prop_tests/offsetLimit_test.js index 3e79bc5..6b35e4e 100644 --- a/compat/prop_tests/offsetLimit_test.js +++ b/compat/prop_tests/offsetLimit_test.js @@ -5,13 +5,13 @@ var set = require('../compat'), QUnit.module("can-set props.limitOffset"); -test('offsetLimit set.equal', function(){ +QUnit.test('offsetLimit set.equal', function(assert) { /* * X = [A0, ..., An] * Y = [A0, ..., An] */ - ok( + assert.ok( set.isEqual( {offset: 0, limit: 99}, {offset: 0, limit: 99}, @@ -22,7 +22,7 @@ test('offsetLimit set.equal', function(){ * X = [A0, ..., An] * Y = [A0, ..., A(n+1)] */ - ok( + assert.ok( !set.isEqual( {offset: 0, limit: 100}, {offset: 0, limit: 101}, @@ -33,7 +33,7 @@ test('offsetLimit set.equal', function(){ * X = [A0, ..., An] * Y = [A1, ..., An] */ - ok( + assert.ok( !set.isEqual( {offset: 0, limit: 100}, {offset: 1, limit: 100}, @@ -44,7 +44,7 @@ test('offsetLimit set.equal', function(){ -test('offsetLimit set.union', function() { +QUnit.test('offsetLimit set.union', function(assert) { var prop = props.offsetLimit('offset', 'limit'), res; @@ -55,7 +55,7 @@ test('offsetLimit set.union', function() { * X U Y = [A0, ..., A101] */ res = set.union({ offset: 0, limit: 100 }, { offset: 50, limit: 52 }, prop); - deepEqual(res, { offset: 0, limit: 102 }, "got a union"); + assert.deepEqual(res, { offset: 0, limit: 102 }, "got a union"); /* * X = universal set @@ -64,7 +64,7 @@ test('offsetLimit set.union', function() { * X U Y = X */ res = set.union({}, { offset: 0, limit: 10 }, prop); - deepEqual(res, {}, "universal set"); + assert.deepEqual(res, {}, "universal set"); /* * X = [A100, ..., A199] @@ -73,7 +73,7 @@ test('offsetLimit set.union', function() { * X U Y = [A100, ..., A299] */ res = set.union({offset: 100, limit: 100}, {offset: 200, limit: 100}, prop); - deepEqual(res, {offset:100, limit:200}, "no intersection"); + assert.deepEqual(res, {offset:100, limit:200}, "no intersection"); /* * X = [A200, ..., A299] @@ -82,7 +82,7 @@ test('offsetLimit set.union', function() { * X U Y = [A100, ..., A299] */ res = set.union({offset: 200, limit: 100}, {offset: 100, limit: 100}, prop); - deepEqual(res, {offset:100, limit:200}, "no intersection with either argument order"); + assert.deepEqual(res, {offset:100, limit:200}, "no intersection with either argument order"); @@ -93,14 +93,14 @@ test('offsetLimit set.union', function() { * X U Y = [A100, ..., A299] */ res = set.union({offset: 100, limit: 110}, {offset: 200, limit: 100}, prop); - deepEqual(res, {offset:100, limit:200}, "sets can intersect with either argument order"); + assert.deepEqual(res, {offset:100, limit:200}, "sets can intersect with either argument order"); }); -test('rangeInclusive set.count', function(){ +QUnit.test('rangeInclusive set.count', function(assert) { var prop = props.offsetLimit('offset', 'limit'); /* @@ -108,10 +108,10 @@ test('rangeInclusive set.count', function(){ * |X| = 100 */ var res = set.count({ offset: 0, limit: 100 }, prop); - equal(res, 100, "count is right"); + assert.equal(res, 100, "count is right"); }); -test('rangeInclusive set.intersection', function(){ +QUnit.test('rangeInclusive set.intersection', function(assert) { var prop = props.offsetLimit('offset', 'limit'); /* @@ -121,5 +121,5 @@ test('rangeInclusive set.intersection', function(){ * X ∩ Y = [A50, A99] */ var res = set.intersection({ offset: 0, limit: 100 }, { offset: 50, limit: 52 }, prop); - deepEqual(res, { offset: 50, limit: 50 }, "got a intersection"); + assert.deepEqual(res, { offset: 50, limit: 50 }, "got a intersection"); }); diff --git a/compat/prop_tests/rangeInclusive_test.js b/compat/prop_tests/rangeInclusive_test.js index e503f64..4b9e620 100644 --- a/compat/prop_tests/rangeInclusive_test.js +++ b/compat/prop_tests/rangeInclusive_test.js @@ -5,13 +5,13 @@ var set = require('../compat'), QUnit.module("can-set props.rangeInclusive"); -test('rangeInclusive set.equal', function(){ +QUnit.test('rangeInclusive set.equal', function(assert) { /* * X = [A0, ..., An] * Y = [A0, ..., An] */ - ok( + assert.ok( set.isEqual( {start: 0, end: 100}, {start: 0, end: 100}, @@ -22,7 +22,7 @@ test('rangeInclusive set.equal', function(){ * X = [A0, ..., An] * Y = [A0, ..., A(n+1)] */ - ok( + assert.ok( !set.isEqual( {start: 0, end: 100}, {start: 0, end: 101}, @@ -33,7 +33,7 @@ test('rangeInclusive set.equal', function(){ * X = [A0, ..., An] * Y = [A1, ..., An] */ - ok( + assert.ok( !set.isEqual( {start: 0, end: 100}, {start: 1, end: 100}, @@ -41,12 +41,12 @@ test('rangeInclusive set.equal', function(){ "they are not equal" ); }); -test('rangeInclusive set.isSubset', function(){ +QUnit.test('rangeInclusive set.isSubset', function(assert) { /* * X = [A0, ..., An] * Y = [A0, ..., An] */ - ok( + assert.ok( set.isSubset( {start: 0, end: 100}, {start: 0, end: 100}, @@ -57,7 +57,7 @@ test('rangeInclusive set.isSubset', function(){ * X = [A0, ..., An] * Y = [A0, ..., A(n+1)] */ - ok( + assert.ok( set.isSubset( {start: 0, end: 100}, {start: 0, end: 101}, @@ -68,7 +68,7 @@ test('rangeInclusive set.isSubset', function(){ * X = [A0, ..., An] * Y = [A0, ..., A(n+1)] */ - ok( + assert.ok( !set.isSubset( {start: 0, end: 101}, {start: 0, end: 100}, @@ -79,7 +79,7 @@ test('rangeInclusive set.isSubset', function(){ * X = [A1, ..., An] * Y = [A0, ..., An] */ - ok( + assert.ok( set.isSubset( {start: 1, end: 100}, {start: 0, end: 100}, @@ -90,7 +90,7 @@ test('rangeInclusive set.isSubset', function(){ * X = [A1, ..., An] * Y = [A0, ..., An] */ - ok( + assert.ok( !set.isSubset( {start: 0, end: 100}, {start: 1, end: 100}, @@ -99,7 +99,7 @@ test('rangeInclusive set.isSubset', function(){ }); -test('rangeInclusive set.difference', function() { +QUnit.test('rangeInclusive set.difference', function(assert) { var prop = props.rangeInclusive('start', 'end'); /* @@ -109,7 +109,7 @@ test('rangeInclusive set.difference', function() { * X / Y = [A0, ..., A49] */ var res = set.difference({ start: 0, end: 99 }, { start: 50, end: 101 }, prop); - deepEqual(res, { start: 0, end: 49 }, "got a diff"); + assert.deepEqual(res, { start: 0, end: 49 }, "got a diff"); /* * let: @@ -126,7 +126,7 @@ test('rangeInclusive set.difference', function() { * X / Y = the set of all things not in Y */ res = set.difference({}, { start: 0, end: 10 }, prop); - deepEqual(res, {start: 11}, 'universal set'); + assert.deepEqual(res, {start: 11}, 'universal set'); /* * X = [A0, ..., A49] @@ -135,7 +135,7 @@ test('rangeInclusive set.difference', function() { * X / Y = X */ res = set.difference({ start: 0, end: 49 }, { start: 50, end: 101 }, prop); - deepEqual(res, { start: 0, end: 49 }, "side by side"); + assert.deepEqual(res, { start: 0, end: 49 }, "side by side"); /* * X = [A0, ..., A49] @@ -144,7 +144,7 @@ test('rangeInclusive set.difference', function() { * X / Y = [A21, ..., A49] */ res = set.difference({ start: 0, end: 49 }, { start: 0, end: 20 }, prop); - deepEqual(res, { start: 21, end: 49 }, "first set extends past second"); + assert.deepEqual(res, { start: 21, end: 49 }, "first set extends past second"); /* * X = [A0, ..., A49] @@ -153,10 +153,10 @@ test('rangeInclusive set.difference', function() { * X / Y = [A0, ..., A19] */ res = set.difference({ start: 0, end: 49 }, { start: 20, end: 49 }, prop); - deepEqual(res, { start: 0, end: 19 }, "first set starts before second"); + assert.deepEqual(res, { start: 0, end: 19 }, "first set starts before second"); }); -test('rangeInclusive set.union', function() { +QUnit.test('rangeInclusive set.union', function(assert) { var prop = props.rangeInclusive('start', 'end'); @@ -167,7 +167,7 @@ test('rangeInclusive set.union', function() { * X U Y = [A0, ..., A101] */ var res = set.union({ start: 0, end: 99 }, { start: 50, end: 101 }, prop); - deepEqual(res, { start: 0, end: 101 }, "got a union"); + assert.deepEqual(res, { start: 0, end: 101 }, "got a union"); /* * X = universal set @@ -176,7 +176,7 @@ test('rangeInclusive set.union', function() { * X U Y = X */ res = set.union({}, { start: 0, end: 10 }, prop); - deepEqual(res, {}, "universal set"); + assert.deepEqual(res, {}, "universal set"); /* * X = [A100, ..., A199] @@ -185,7 +185,7 @@ test('rangeInclusive set.union', function() { * X U Y = [A100, ..., A299] */ res = set.union({start: 100, end: 199}, {start: 200, end: 299}, prop); - deepEqual(res, {start:100, end:299}, "no intersection"); + assert.deepEqual(res, {start:100, end:299}, "no intersection"); /* * X = [A200, ..., A299] @@ -194,7 +194,7 @@ test('rangeInclusive set.union', function() { * X U Y = [A100, ..., A299] */ res = set.union({start: 200, end: 299}, {start: 100, end: 199}, prop); - deepEqual(res, {start:100, end:299}, "no intersection with either argument order"); + assert.deepEqual(res, {start:100, end:299}, "no intersection with either argument order"); /* * X = [A200, ..., A299] @@ -203,7 +203,7 @@ test('rangeInclusive set.union', function() { * X U Y = [A100, ..., A299] */ res = set.union({start: 200, end: 299}, {start: 100, end: 209}, prop); - deepEqual(res, {start:100, end:299}, "sets can intersect"); + assert.deepEqual(res, {start:100, end:299}, "sets can intersect"); /* * X = [A200, ..., A299] @@ -212,7 +212,7 @@ test('rangeInclusive set.union', function() { * X U Y = [A100, ..., A299] */ res = set.union({start: 100, end: 209}, {start: 200, end: 299}, prop); - deepEqual(res, {start:100, end:299}, "sets can intersect with either argument order"); + assert.deepEqual(res, {start:100, end:299}, "sets can intersect with either argument order"); /* * X = [A100, ..., A299] @@ -221,7 +221,7 @@ test('rangeInclusive set.union', function() { * X U Y = [A100, ..., A299] */ res = set.union({start: 100, end: 299}, {start: 103, end: 209}, prop); - deepEqual(res, {start:100, end:299}, "first set contains second"); + assert.deepEqual(res, {start:100, end:299}, "first set contains second"); /* * X = [A103, ..., A209] @@ -230,7 +230,7 @@ test('rangeInclusive set.union', function() { * X U Y = [A100, ..., A299] */ res = set.union({start: 100, end: 299}, {start: 103, end: 209}, prop); - deepEqual(res, {start:100, end:299}, "second set contains first"); + assert.deepEqual(res, {start:100, end:299}, "second set contains first"); /* * X = [A100, ..., A299] @@ -239,12 +239,12 @@ test('rangeInclusive set.union', function() { * X U Y = [A100, ..., A299] */ res = set.union({start: 100, end: 299}, {start: 100, end: 299}, prop); - deepEqual(res, {start:100, end:299}, "union of identical sets is the same as those sets"); + assert.deepEqual(res, {start:100, end:299}, "union of identical sets is the same as those sets"); }); -test('rangeInclusive set.count', function(){ +QUnit.test('rangeInclusive set.count', function(assert) { var prop = props.rangeInclusive('start', 'end'); /* @@ -252,10 +252,10 @@ test('rangeInclusive set.count', function(){ * |X| = 100 */ var res = set.count({ start: 0, end: 99 }, prop); - equal(res, 100, "count is right"); + assert.equal(res, 100, "count is right"); }); -test('rangeInclusive set.intersection', function(){ +QUnit.test('rangeInclusive set.intersection', function(assert) { var prop = props.rangeInclusive('start', 'end'); /* @@ -265,18 +265,18 @@ test('rangeInclusive set.intersection', function(){ * X ∩ Y = [A50, A99] */ var res = set.intersection({ start: 0, end: 99 }, { start: 50, end: 101 }, prop); - deepEqual(res, { start: 50, end: 99 }, "got a intersection"); + assert.deepEqual(res, { start: 50, end: 99 }, "got a intersection"); res = set.intersection({ start: 0, end: 10, age: 35 }, { start: 0, end: 100, name: "JBM" }, prop); - deepEqual(res, set.UNDEFINABLE, "got a intersection"); + assert.deepEqual(res, set.UNDEFINABLE, "got a intersection"); }); -test('rangeInclusive with string numbers (#17)', function(){ +QUnit.test('rangeInclusive with string numbers (#17)', function(assert) { var algebra = new set.Algebra( props.rangeInclusive('start','end') ); - ok( + assert.ok( algebra.isSubset( {start: "1", end: "100"}, {start: "0", end: "100"} @@ -284,13 +284,13 @@ test('rangeInclusive with string numbers (#17)', function(){ ".subset" ); var res = algebra.filterMembers({start: "2",end: "3"},{start: "1",end: "4"},[{id: 1},{id: 2},{id: 3},{id: 4}]); - deepEqual(res, [{id: 2},{id: 3}], ".filterMembers"); + assert.deepEqual(res, [{id: 2},{id: 3}], ".filterMembers"); res = algebra.unionMembers( {start: "2",end: "3"}, {start: "1",end: "4"}, [{id: 2},{id: 3}], [{id: 1},{id: 2},{id: 3},{id: 4}]); - deepEqual(res, [{id: 1},{id: 2},{id: 3},{id: 4}], ".unionMembers"); + assert.deepEqual(res, [{id: 1},{id: 2},{id: 3},{id: 4}], ".unionMembers"); }); diff --git a/compat/prop_tests/sort_test.js b/compat/prop_tests/sort_test.js index 323b769..ae9a601 100644 --- a/compat/prop_tests/sort_test.js +++ b/compat/prop_tests/sort_test.js @@ -7,90 +7,90 @@ var canReflect = require("can-reflect"); QUnit.module("can-set props.sort"); -test('set.difference', function(){ +QUnit.test('set.difference', function(assert) { var prop = props.sort('sort'), res; res = set.difference({sort: "foo"}, { completed: true }, prop); - deepEqual(res, set.UNDEFINABLE /*{sort: "foo", completed: {$ne: true}}*/, "diff should be true"); + assert.deepEqual(res, set.UNDEFINABLE /*{sort: "foo", completed: {$ne: true}}*/, "diff should be true"); res = set.difference({ completed: true }, { completed: true, sort: "foo" }, prop); - equal(res, set.EMPTY, "the same except for sort"); + assert.equal(res, set.EMPTY, "the same except for sort"); res = set.difference({ completed: true }, { sort: "foo"}, prop); - equal(res, set.EMPTY, "nothing in completed:true that isn't in everything"); + assert.equal(res, set.EMPTY, "nothing in completed:true that isn't in everything"); res = set.difference({ completed: true }, { foo: 'bar', sort: "foo" }, prop); - equal(res, set.UNDEFINABLE, "we can diff, it exists, we don't know what it is though"); + assert.equal(res, set.UNDEFINABLE, "we can diff, it exists, we don't know what it is though"); }); -test('set.union', function(){ +QUnit.test('set.union', function(assert) { var prop = props.sort('sort'), res; // set / subset res = set.union({sort: "name"}, { completed: true }, prop); - deepEqual(res , {}, "set / subset sort left"); + assert.deepEqual(res , {}, "set / subset sort left"); res = set.union({}, { completed: true, sort: "name" }, prop); - deepEqual(res , {}, "set / subset sort right"); + assert.deepEqual(res , {}, "set / subset sort right"); res = set.union({ sort: "name" }, { completed: true, sort: "namer" }, prop); - deepEqual(res , {}, "set / subset both sorts"); + assert.deepEqual(res , {}, "set / subset both sorts"); res = set.union({ completed: true }, {sort: "foo"}, prop); - deepEqual(res , {}, "subset / set"); + assert.deepEqual(res , {}, "subset / set"); res = set.union({foo: "bar", sort: "foo"},{foo: "bar"}, prop); - deepEqual(res, {foo: "bar"}, "equal"); + assert.deepEqual(res, {foo: "bar"}, "equal"); res = set.union({foo: "bar"},{foo: "zed", sort: "foo"}, prop); - deepEqual(res, {foo: ["bar","zed"]}, "values not equal"); + assert.deepEqual(res, {foo: ["bar","zed"]}, "values not equal"); res = set.union({foo: "bar", sort: "foo"},{name: "A"}, prop); - deepEqual(res, set.UNDEFINABLE, "values not equal"); + assert.deepEqual(res, set.UNDEFINABLE, "values not equal"); }); -test('set.union Array', function(){ +QUnit.test('set.union Array', function(assert) { var prop = props.sort('sort'); var res = set.union({foo: ["a","b"], sort: "foo"}, { foo: ["a","c"] }, prop); - deepEqual(res , {foo: ["a","b","c"]}, "set / subset"); + assert.deepEqual(res , {foo: ["a","b","c"]}, "set / subset"); }); -test('set.count', function(){ - ok( set.count({ sort: 'name' }) === Infinity, "defaults to infinity"); - ok( set.count({foo: "bar", sort: "foo"},{}) === Infinity, "defaults to infinity"); +QUnit.test('set.count', function(assert) { + assert.ok( set.count({ sort: 'name' }) === Infinity, "defaults to infinity"); + assert.ok( set.count({foo: "bar", sort: "foo"},{}) === Infinity, "defaults to infinity"); }); -test('set.intersection', function(){ +QUnit.test('set.intersection', function(assert) { var prop = props.sort('sort'), res; res = set.intersection({} , { sort: 'name' }, prop); - deepEqual(res, {}, "no sort if only one is sorted"); + assert.deepEqual(res, {}, "no sort if only one is sorted"); res = set.intersection({ sort: 'name' } , { sort: 'name' }, prop); - deepEqual(res, {sort: 'name'}, "equal"); + assert.deepEqual(res, {sort: 'name'}, "equal"); res = set.intersection({type: 'new'} , { sort: 'name', userId: 5 }, prop); - deepEqual(res, {type: 'new', userId: 5 }, ""); + assert.deepEqual(res, {type: 'new', userId: 5 }, ""); res = set.intersection({type: 'new', sort: "age"} , { sort: 'name', userId: 5 }, prop); - deepEqual(res, {type: 'new', userId: 5 }, ""); + assert.deepEqual(res, {type: 'new', userId: 5 }, ""); }); -test('set.intersection Array', function(){ +QUnit.test('set.intersection Array', function(assert) { var prop = props.sort('sort'); var res = set.intersection({foo: ["a","b"], sort: 'foo'}, { foo: ["a","c"] }, prop); - deepEqual(res , {foo: "a"}, "intersection"); + assert.deepEqual(res , {foo: "a"}, "intersection"); }); -test('set.isSubset', function(){ +QUnit.test('set.isSubset', function(assert) { var algebra = new set.Algebra(props.sort('sort'), set.props.ignore("foo"), @@ -99,41 +99,41 @@ test('set.isSubset', function(){ set.props.ignore("count") ); - ok( algebra.isSubset( + assert.ok( algebra.isSubset( { type : 'FOLDER', sort: "thing" }, { type : 'FOLDER' } ), 'equal sets with sort on the left'); - ok( algebra.isSubset( + assert.ok( algebra.isSubset( { type : 'FOLDER' }, { type : 'FOLDER', sort: "thing" } ), 'equal sets with sort on the right'); - ok( algebra.isSubset( + assert.ok( algebra.isSubset( { type : 'FOLDER', parentId : 5, sort: 'thing' }, { type : 'FOLDER'} ), 'sub set with sort on the left'); - ok( algebra.isSubset( + assert.ok( algebra.isSubset( { type : 'FOLDER', parentId : 5 }, { type : 'FOLDER', sort: 'thing'} ), 'sub set with sort on the right'); - ok(!algebra.isSubset( + assert.ok(!algebra.isSubset( { type: 'FOLDER', sort: 'thing' }, { type: 'FOLDER', parentId: 5 }), 'wrong way with sort on the left'); - ok(!algebra.isSubset( + assert.ok(!algebra.isSubset( { type: 'FOLDER' }, { type: 'FOLDER', parentId: 5, sort: 'thing' }), 'wrong way with sort on the right'); - ok(!algebra.isSubset( + assert.ok(!algebra.isSubset( { type: 'FOLDER', parentId: 7, sort: 'thing' }, { type: 'FOLDER', parentId: 5 }), 'different values with sort on the left'); - ok(!algebra.isSubset( + assert.ok(!algebra.isSubset( { type: 'FOLDER', parentId: 7 }, { type: 'FOLDER', parentId: 5, sort: 'thing' }), 'different values with sort on the right'); }); -test('set.isSubset with range', function(){ +QUnit.test('set.isSubset with range', function(assert) { var algebra = new set.Algebra(props.sort('sort'),props.rangeInclusive('start','end')); // add sort .. same .. different @@ -208,7 +208,7 @@ test('set.isSubset with range', function(){ }; var assertSubset = function(methods, result){ var sets = make.apply(null, methods); - equal( algebra.isSubset(sets.left, sets.right), result, JSON.stringify(sets.left)+" ⊂ "+JSON.stringify(sets.right)+" = "+result ); + assert.equal( algebra.isSubset(sets.left, sets.right), result, JSON.stringify(sets.left)+" ⊂ "+JSON.stringify(sets.right)+" = "+result ); }; //assertSubset([sets.superRight, range.right, sort.right], false); @@ -219,25 +219,25 @@ test('set.isSubset with range', function(){ //assertSubset([sets.same, range.superRight, sort.same], true); }); -test("set.index", function(){ +QUnit.test("set.index", function(assert) { var algebra = new set.Algebra(props.sort('sort')); var index = algebra.index( {sort: "name"}, [{id: 1, name:"g"}, {id: 2, name:"j"}, {id: 3, name:"m"}, {id: 4, name:"s"}], {name: "k"}); - equal(index, 2); + assert.equal(index, 2); }); -test("set.filterMembers (#14)", function(){ +QUnit.test("set.filterMembers (#14)", function(assert) { var algebra = new set.Algebra(props.sort('sort')); var subset = algebra.filterMembers({sort: "name"},{},[{id: 1, name:"s"}, {id: 2, name:"j"}, {id: 3, name:"m"}, {id: 4, name:"g"}]); - deepEqual(subset, [ {id: 4, name:"g"},{id: 2, name:"j"}, {id: 3, name:"m"},{id: 1, name:"s"}]); + assert.deepEqual(subset, [ {id: 4, name:"g"},{id: 2, name:"j"}, {id: 3, name:"m"},{id: 1, name:"s"}]); }); -test("set.unionMembers", function(){ +QUnit.test("set.unionMembers", function(assert) { var algebra = new set.Algebra( props.sort('sort'), props.boolean('complete') @@ -250,14 +250,14 @@ test("set.unionMembers", function(){ [{id: 4, name:"g", complete: true}, {id: 3, name:"m", complete: true}], [{id: 2, name:"j", complete: false},{id: 1, name:"s", complete: false} ]); - deepEqual(union, [ + assert.deepEqual(union, [ {id: 4, name:"g", complete: true}, {id: 2, name:"j", complete: false}, {id: 3, name:"m", complete: true}, {id: 1, name:"s",complete: false}]); }); -test("set.union keeps sort", function(){ +QUnit.test("set.union keeps sort", function(assert) { var algebra = new set.Algebra( props.sort('sort'), props.boolean('complete') @@ -267,10 +267,10 @@ test("set.union keeps sort", function(){ {sort: "name", complete: true}, {sort: "name", complete: false}); - deepEqual(union, {sort: "name"}); + assert.deepEqual(union, {sort: "name"}); }); -test("paginated and sorted is subset (#17)", function(){ +QUnit.test("paginated and sorted is subset (#17)", function(assert) { var algebra = new set.Algebra( props.sort('sort'), props.rangeInclusive('start','end') @@ -280,40 +280,40 @@ test("paginated and sorted is subset (#17)", function(){ // equal(res, true, "parent:paginate+order child:paginate+order (same set)"); res = algebra.isSubset({start: 0, end: 100, sort: "name"},{start: 0, end: 100, sort: "age"}); - equal(res, undefined, "parent:paginate+order child:paginate+order (different order)"); + assert.equal(res, undefined, "parent:paginate+order child:paginate+order (different order)"); // REMOVE FROM THE parent // parent:order res = algebra.isSubset({start: 0, end: 100, sort: "name"},{sort: "name"}); - equal(res, true, "parent:order child:paginate+order"); + assert.equal(res, true, "parent:order child:paginate+order"); res = algebra.isSubset({sort: "name"},{sort: "name"}); - equal(res, true, "parent:order child:order (same)"); + assert.equal(res, true, "parent:order child:order (same)"); res = algebra.isSubset({sort: "name"},{sort: "age"}); - equal(res, true, "parent:order child:order (different)"); + assert.equal(res, true, "parent:order child:order (different)"); res = algebra.isSubset({start: 0, end: 100},{sort: "name"}); - equal(res, true, "parent:order child:paginate"); + assert.equal(res, true, "parent:order child:paginate"); res = algebra.isSubset({start: 0, end: 100, sort: "age"},{sort: "name"}); - equal(res, true, "parent:order child:paginate+order"); + assert.equal(res, true, "parent:order child:paginate+order"); // parent:paginate res = algebra.isSubset({start: 0, end: 100, sort: "name"},{start: 0, end: 100}); - equal(res, undefined, "parent:paginate child:paginate+order"); + assert.equal(res, undefined, "parent:paginate child:paginate+order"); res = algebra.isSubset({sort: "name"},{start: 0, end: 100}); - equal(res, false, "parent:paginate child:order (same)"); + assert.equal(res, false, "parent:paginate child:order (same)"); res = algebra.isSubset({start: 0, end: 100, sort: "name"},{}); - equal(res, true, "parent:-- child:paginate+order"); + assert.equal(res, true, "parent:-- child:paginate+order"); res = algebra.isSubset({start: 10, end: 90, sort: "name"},{start: 0, end: 100, sort: "name"}); - equal(res, true, "child in smaller range, same sort"); + assert.equal(res, true, "child in smaller range, same sort"); res = algebra.isSubset({start: 10, end: 90, sort: "name"},{start: 0, end: 100, sort: "age"}); - equal(res, undefined, "child in smaller range, but different sort"); + assert.equal(res, undefined, "child in smaller range, but different sort"); }); diff --git a/compat/prop_tests/translate_test.js b/compat/prop_tests/translate_test.js index 0b1b8e9..1750f01 100644 --- a/compat/prop_tests/translate_test.js +++ b/compat/prop_tests/translate_test.js @@ -7,7 +7,7 @@ var ignoreProp = function(){ return true; }; QUnit.module("can-set set.Translate - nested where"); -QUnit.test('set.equal', function(){ +QUnit.test('set.equal', function(assert) { var algebra = new set.Algebra( new set.Translate("where","$where"), @@ -20,19 +20,19 @@ QUnit.test('set.equal', function(){ {$where: {type: 'FOLDER' } }, {$where: { type: 'FOLDER', count: 5 }} ); - ok(res, 'count ignored'); + assert.ok(res, 'count ignored'); res = algebra.isEqual( {$where: { type: 'FOLDER' }}, {$where: { type: 'FOLDER' }} ); - ok(res, 'folder case ignored'); + assert.ok(res, 'folder case ignored'); }); -QUnit.test('set.isSubset', function(){ +QUnit.test('set.isSubset', function(assert) { var algebra = new set.Algebra( new set.Translate("where","$where"), @@ -45,140 +45,140 @@ QUnit.test('set.isSubset', function(){ var res; res = algebra.isSubset({$where:{ type: 'FOLDER' }}, {$where:{ type: 'FOLDER' }}); - ok(res, 'equal sets'); + assert.ok(res, 'equal sets'); res = algebra.isSubset({$where:{ type: 'FOLDER', parentId: 5 }}, {$where:{ type: 'FOLDER' }}); - ok(res, 'sub set'); + assert.ok(res, 'sub set'); res = algebra.isSubset({$where:{ type: 'FOLDER' }}, {$where:{ type: 'FOLDER', parentId: 5 }}); - ok(!res, 'wrong way'); + assert.ok(!res, 'wrong way'); res = algebra.isSubset( {$where:{ type: 'FOLDER', parentId: 7 }}, {$where:{ type: 'FOLDER', parentId: 5 }} ); - ok(!res, 'different values'); + assert.ok(!res, 'different values'); res = algebra.isSubset( {$where:{ type: 'FOLDER', count: 5 }}, {$where:{ type: 'FOLDER' }} ); - ok(res, 'count ignored'); + assert.ok(res, 'count ignored'); res = algebra.isSubset( {$where:{ type: 'FOLDER', category: 'tree' }}, {$where:{ type: 'FOLDER', foo: true, bar: true }} ); - ok(res, 'understands a subset'); + assert.ok(res, 'understands a subset'); res = algebra.isSubset( {$where:{ type: 'FOLDER', foo: true, bar: true }}, {$where:{ type: 'FOLDER', kind: 'tree' }} ); - ok(res, 'ignores nulls'); + assert.ok(res, 'ignores nulls'); }); -test('set.isProperSubset', function(){ +QUnit.test('set.isProperSubset', function(assert) { var algebra = new set.Algebra( new set.Translate("where","$where") ); - equal( algebra.isProperSubset( {$where:{foo: "bar"}}, {$where:{}}), true ); - equal( algebra.isProperSubset({$where:{}},{$where:{}}), false ); - equal( algebra.isProperSubset({$where:{}},{$where:{foo: "bar"}}), false ); + assert.equal( algebra.isProperSubset( {$where:{foo: "bar"}}, {$where:{}}), true ); + assert.equal( algebra.isProperSubset({$where:{}},{$where:{}}), false ); + assert.equal( algebra.isProperSubset({$where:{}},{$where:{foo: "bar"}}), false ); }); -test('set.difference', function(){ +QUnit.test('set.difference', function(assert) { var algebra = new set.Algebra( new set.Translate("where","$where") ); var res = algebra.difference({$where:{}}, {$where:{ completed: true }}); - equal(res, querySet.UNDEFINABLE, "diff should be true"); + assert.equal(res, querySet.UNDEFINABLE, "diff should be true"); res = algebra.difference({$where:{ completed: true }}, {$where:{ completed: true }}); - equal(res, querySet.EMPTY); + assert.equal(res, querySet.EMPTY); res = algebra.difference({$where:{ completed: true }}, {$where:{}}); - equal(res, querySet.EMPTY); + assert.equal(res, querySet.EMPTY); res = algebra.difference({$where:{ completed: true }}, {$where:{ userId: 5 }}); - equal(res, querySet.UNDEFINABLE); + assert.equal(res, querySet.UNDEFINABLE); }); -test('set.union', function(){ +QUnit.test('set.union', function(assert) { var algebra = new set.Algebra( new set.Translate("where","$where") ); // set / subset var res = algebra.union({$where:{}}, {$where:{ completed: true }}); - deepEqual(res , {}, "set / subset"); + assert.deepEqual(res , {}, "set / subset"); res = algebra.union({$where:{ completed: true }}, {$where:{}}); - deepEqual(res , {}, "subset / set"); + assert.deepEqual(res , {}, "subset / set"); res = algebra.union({$where:{foo: "bar"}},{$where:{foo: "bar"}}); - deepEqual(res, {$where:{foo: "bar"}}, "equal"); + assert.deepEqual(res, {$where:{foo: "bar"}}, "equal"); res = algebra.union({$where:{foo: "bar"}},{$where:{foo: "zed"}}); - deepEqual(res, {$where:{foo: ["bar","zed"]}}, "values not equal"); + assert.deepEqual(res, {$where:{foo: ["bar","zed"]}}, "values not equal"); res = algebra.union({$where:{foo: "bar"}},{$where:{name: "A"}}); - deepEqual(res,querySet.UNDEFINABLE, "values not equal"); + assert.deepEqual(res,querySet.UNDEFINABLE, "values not equal"); }); -test('set.union Array', function(){ +QUnit.test('set.union Array', function(assert) { var algebra = new set.Algebra( new set.Translate("where","$where") ); // set / subset var res = algebra.union({$where:{foo: ["a","b"]}}, {$where:{ foo: ["a","c"] }}); - deepEqual(res , {$where:{foo: ["a","b","c"]}}, "set / subset"); + assert.deepEqual(res , {$where:{foo: ["a","b","c"]}}, "set / subset"); }); -test('set.intersection', function(){ +QUnit.test('set.intersection', function(assert) { var algebra = new set.Algebra( new set.Translate("where","$where")), res; res = algebra.intersection({$where:{}}, {$where:{ completed: true }}); - deepEqual(res , {$where:{ completed: true }}, "set / subset"); + assert.deepEqual(res , {$where:{ completed: true }}, "set / subset"); res = algebra.intersection({$where:{ completed: true }}, {$where:{}}); - deepEqual(res , {$where:{ completed: true }}, "subset / set"); + assert.deepEqual(res , {$where:{ completed: true }}, "subset / set"); res = algebra.intersection({$where:{foo: "bar"}},{$where:{foo: "bar"}}); - deepEqual(res, {$where:{foo: "bar"}}, "equal"); + assert.deepEqual(res, {$where:{foo: "bar"}}, "equal"); res = algebra.intersection({$where:{foo: "bar"}},{$where:{foo: "zed"}}); - deepEqual(res,querySet.EMPTY, "values not equal"); + assert.deepEqual(res,querySet.EMPTY, "values not equal"); res = algebra.intersection({$where:{foo: 'bar'}},{$where:{completed: true}}); - deepEqual(res, {$where:{foo: 'bar', completed: true}}, 'intersection should combine definitions'); + assert.deepEqual(res, {$where:{foo: 'bar', completed: true}}, 'intersection should combine definitions'); }); -test('set.intersection Array', function(){ +QUnit.test('set.intersection Array', function(assert) { var algebra = new set.Algebra( new set.Translate("where","$where")); // set / subset var res = algebra.intersection({$where:{foo: ["a","b"]}}, {$where:{ foo: ["a","c"] }}); - deepEqual(res , {$where:{foo: "a"}}, "intersection"); + assert.deepEqual(res , {$where:{foo: "a"}}, "intersection"); }); -test('set.has', function(){ +QUnit.test('set.has', function(assert) { var algebra = new set.Algebra( new set.Translate("where","$where"), @@ -188,41 +188,41 @@ test('set.has', function(){ set.props.ignore("kind") ); - ok( algebra.isMember({$where: {someId: 5}}, {someId: 5, name: "foo"}), 'contains'); + assert.ok( algebra.isMember({$where: {someId: 5}}, {someId: 5, name: "foo"}), 'contains'); var res; res = algebra.isMember({$where:{ type: 'FOLDER' }}, { type: 'FOLDER' }); - ok(res, 'equal sets'); + assert.ok(res, 'equal sets'); res = algebra.isMember({$where:{ type: 'FOLDER', parentId: 5 }}, { type: 'FOLDER' }); - equal(res, false, 'doesnt match'); + assert.equal(res, false, 'doesnt match'); res = algebra.isMember({$where:{ type: 'FOLDER' }}, { type: 'FOLDER', parentId: 5 }); - ok(true, 'is a subset'); + assert.ok(true, 'is a subset'); res = algebra.isMember( {$where:{ type: 'FOLDER', parentId: 7 }}, { type: 'FOLDER', parentId: 5 } ); - ok(!res, 'different values'); + assert.ok(!res, 'different values'); res = algebra.isMember( {$where:{ type: 'FOLDER', count: 5 }}, { type: 'FOLDER' }, { count: ignoreProp } ); - ok(res, 'count ignored'); + assert.ok(res, 'count ignored'); res = algebra.isMember( {$where:{ type: 'FOLDER', kind: 'tree' }}, { type: 'FOLDER', foo: true, bar: true } ); - ok(res, 'understands a subset'); + assert.ok(res, 'understands a subset'); res = algebra.isMember( {$where:{ type: 'FOLDER', foo: true, bar: true }}, { type: 'FOLDER', kind: 'tree' } ); - ok(res, 'ignores nulls'); + assert.ok(res, 'ignores nulls'); }); diff --git a/package.json b/package.json index aaec946..f86f315 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "can-test-helpers": "^1.1.2", "jshint": "^2.9.1", "steal": "^2.2.1", - "steal-qunit": "^1.0.1", + "steal-qunit": "^2.0.0", "steal-tools": "^2.2.1", "testee": "^0.9.0" }, diff --git a/src/serializers/basic-query-test.js b/src/serializers/basic-query-test.js index 2a1986e..c90af01 100644 --- a/src/serializers/basic-query-test.js +++ b/src/serializers/basic-query-test.js @@ -17,7 +17,7 @@ var EmptySchema = { -QUnit.test("basics", function(){ +QUnit.test("basics", function(assert) { var query = { filter: {foo: "bar"} }; @@ -28,10 +28,10 @@ QUnit.test("basics", function(){ var returnedQuery = converter.serializer.serialize(basicQuery); - QUnit.deepEqual(returnedQuery, query, "got back what we give"); + assert.deepEqual(returnedQuery, query, "got back what we give"); }); -QUnit.test("nested properties", function(){ +QUnit.test("nested properties", function(assert) { var query = { filter: { name: { @@ -45,13 +45,13 @@ QUnit.test("nested properties", function(){ var basicQuery = converter.hydrate(query); - QUnit.deepEqual(basicQuery.filter, new logicTypes.KeysAnd({ + assert.deepEqual(basicQuery.filter, new logicTypes.KeysAnd({ name: new logicTypes.KeysAnd({first: new is.In(["justin"])}) }), "adds nested ands"); }); -QUnit.test("$or with the same types unify into maybe", function(){ +QUnit.test("$or with the same types unify into maybe", function(assert) { var MaybeSet = makeMaybe([null]) @@ -74,7 +74,7 @@ QUnit.test("$or with the same types unify into maybe", function(){ var basicQuery = converter.hydrate(query); - QUnit.deepEqual(basicQuery.filter, new logicTypes.KeysAnd({ + assert.deepEqual(basicQuery.filter, new logicTypes.KeysAnd({ foo: new is.In(["bar"]), age: new MaybeSet({ range: new is.GreaterThan(3), @@ -83,7 +83,7 @@ QUnit.test("$or with the same types unify into maybe", function(){ })); var res = converter.serializer.serialize(basicQuery); - QUnit.deepEqual(res, { + assert.deepEqual(res, { filter: { $or: [ { foo: "bar", age: {$gt: 3}}, @@ -93,7 +93,7 @@ QUnit.test("$or with the same types unify into maybe", function(){ }, "serialized"); }); -QUnit.test("auto-convert or schema into maybe type", function(){ +QUnit.test("auto-convert or schema into maybe type", function(assert) { var MaybeNumber = canReflect.assignSymbols({},{ "can.new": function(val){ if (val == null) { @@ -128,7 +128,7 @@ QUnit.test("auto-convert or schema into maybe type", function(){ var basicQuery = converter.hydrate(query); - /*QUnit.deepEqual(basicQuery.filter, new logicTypes.KeysAnd({ + /*assert.deepEqual(basicQuery.filter, new logicTypes.KeysAnd({ foo: new is.In(["bar"]), age: new MaybeSet({ range: new is.GreaterThan(3), @@ -138,7 +138,7 @@ QUnit.test("auto-convert or schema into maybe type", function(){ var res = converter.serializer.serialize(basicQuery); - QUnit.deepEqual(res, { + assert.deepEqual(res, { filter: { $or: [ { foo: "bar", age: {$gt: 3}}, @@ -149,13 +149,13 @@ QUnit.test("auto-convert or schema into maybe type", function(){ }); -testHelpers.dev.devOnlyTest("warn if query properties are not defined (#8)", function() { +testHelpers.dev.devOnlyTest("warn if query properties are not defined (#8)", function (assert) { QUnit.expect(3); var message = "can-query-logic: Ignoring keys: start, end."; var finishErrorCheck = testHelpers.dev.willWarn(message, function(actualMessage, success) { - QUnit.equal(actualMessage, message, "Warning is expected message"); - QUnit.ok(success); + assert.equal(actualMessage, message, "Warning is expected message"); + assert.ok(success); }); @@ -172,10 +172,10 @@ testHelpers.dev.devOnlyTest("warn if query properties are not defined (#8)", fun var converter = makeBasicQueryConvert(EmptySchema); converter.hydrate(query); - QUnit.equal(finishErrorCheck(), 1); + assert.equal(finishErrorCheck(), 1); }); -QUnit.test("gt and lt", function(){ +QUnit.test("gt and lt", function(assert) { var query = { filter: { age: { @@ -189,7 +189,7 @@ QUnit.test("gt and lt", function(){ var basicQuery = converter.hydrate(query); - QUnit.deepEqual(basicQuery.filter, new logicTypes.KeysAnd({ + assert.deepEqual(basicQuery.filter, new logicTypes.KeysAnd({ age: new is.And([ new is.GreaterThan(0), new is.LessThan(100) @@ -198,7 +198,7 @@ QUnit.test("gt and lt", function(){ var res = converter.serializer.serialize(basicQuery); - QUnit.deepEqual(res, { + assert.deepEqual(res, { filter: { age: { $gt: 0, @@ -209,7 +209,7 @@ QUnit.test("gt and lt", function(){ }); -QUnit.test("basicquery with no sort", function() { +QUnit.test("basicquery with no sort", function(assert) { var query = {}; var converter = makeBasicQueryConvert({ @@ -225,7 +225,7 @@ QUnit.test("basicquery with no sort", function() { var item = {id: 1}; var res = basicQuery.index(item, objs); - QUnit.equal(res, 1, "inserted at 1"); + assert.equal(res, 1, "inserted at 1"); }); /* @@ -240,7 +240,7 @@ QUnit.skip("nested properties within ors", function(){ var basicQuery = converter.hydrate(query); - QUnit.deepEqual(basicQuery.filter, new logicTypes.KeysAnd({ + assert.deepEqual(basicQuery.filter, new logicTypes.KeysAnd({ name: new logicTypes.KeysAnd({first: new is.In(["justin"])}) }), "adds nested ands"); }); diff --git a/src/serializers/comparisons-test.js b/src/serializers/comparisons-test.js index 9eb4d0f..b2b7b94 100644 --- a/src/serializers/comparisons-test.js +++ b/src/serializers/comparisons-test.js @@ -4,7 +4,7 @@ var canReflect = require("can-reflect"); QUnit.module("can-query-logic/serializers/comparisons"); -QUnit.test("hydrate and serialize", function(){ +QUnit.test("hydrate and serialize", function(assert) { var Type = function(value){ this.value = value; }; @@ -19,19 +19,19 @@ QUnit.test("hydrate and serialize", function(){ return new Type(value); }); - QUnit.deepEqual(hydrated.values, [ + assert.deepEqual(hydrated.values, [ new Type(1), new Type(2) ], "hydrated"); var serialized = comparisons.serializer.serialize(hydrated); - QUnit.deepEqual(serialized,{ + assert.deepEqual(serialized,{ $in: [1,2] }, "serialized"); }); -QUnit.test("unknown hydrator is called in all cases", function(){ +QUnit.test("unknown hydrator is called in all cases", function(assert) { var hydrated = []; var addToHydrated = function(value){ @@ -42,5 +42,5 @@ QUnit.test("unknown hydrator is called in all cases", function(){ comparisons.hydrate("abc", addToHydrated); comparisons.hydrate(["x","y"], addToHydrated); - QUnit.deepEqual(hydrated, [1,2, "abc","x","y"], "hydrated called with the right stuff"); + assert.deepEqual(hydrated, [1,2, "abc","x","y"], "hydrated called with the right stuff"); }); diff --git a/src/set-test.js b/src/set-test.js index 8c81529..e13c76a 100644 --- a/src/set-test.js +++ b/src/set-test.js @@ -3,13 +3,13 @@ var QUnit = require("steal-qunit"); QUnit.module("can-query-logic/set"); -QUnit.test(".ownAndMemberValue", function(){ - QUnit.deepEqual( set.ownAndMemberValue(1, "1"), { +QUnit.test(".ownAndMemberValue", function(assert) { + assert.deepEqual( set.ownAndMemberValue(1, "1"), { own: 1, member: 1 }, "1 and '1'"); - QUnit.deepEqual( set.ownAndMemberValue({ + assert.deepEqual( set.ownAndMemberValue({ valueOf: function(){ return null; } }, "1"), { own: null, @@ -17,8 +17,8 @@ QUnit.test(".ownAndMemberValue", function(){ }, "{null} and '1'"); }); -QUnit.test(".isDefinedAndHasMembers", function(){ - QUnit.equal(set.isDefinedAndHasMembers({}), true); - QUnit.equal(set.isDefinedAndHasMembers(set.UNIVERSAL), true); - QUnit.equal(set.isDefinedAndHasMembers(set.UNDEFINABLE), false); +QUnit.test(".isDefinedAndHasMembers", function(assert) { + assert.equal(set.isDefinedAndHasMembers({}), true); + assert.equal(set.isDefinedAndHasMembers(set.UNIVERSAL), true); + assert.equal(set.isDefinedAndHasMembers(set.UNDEFINABLE), false); }); diff --git a/src/types/and-or-not-test.js b/src/types/and-or-not-test.js index b7572ad..fe6b16e 100644 --- a/src/types/and-or-not-test.js +++ b/src/types/and-or-not-test.js @@ -10,7 +10,7 @@ QUnit.module("can-query-logic/and-or"); // Might have "real numbers" // But want even and odds and integers // Can't "build up" to real with all those other combinations -QUnit.test("AND intersection basics", function(){ +QUnit.test("AND intersection basics", function(assert) { var AndObject = types.KeysAnd; var isJustin = new AndObject({ @@ -21,13 +21,13 @@ QUnit.test("AND intersection basics", function(){ }); var is35AndJustin = set.intersection(is35, isJustin); - QUnit.deepEqual(is35AndJustin.values,{ + assert.deepEqual(is35AndJustin.values,{ name: "Justin", age: 35 },"35 and justin"); var isJustinAnd35 = set.intersection(isJustin, is35); - QUnit.deepEqual(isJustinAnd35.values,{ + assert.deepEqual(isJustinAnd35.values,{ name: "Justin", age: 35 },"justin and 34"); @@ -40,11 +40,11 @@ QUnit.test("AND intersection basics", function(){ }); var is34and35 = set.intersection(is35, is34); - QUnit.equal(is34and35,set.EMPTY,"can't be 34 and 35"); + assert.equal(is34and35,set.EMPTY,"can't be 34 and 35"); }); -QUnit.test("AND union basics", function(){ +QUnit.test("AND union basics", function(assert) { var AndObject = types.KeysAnd; @@ -56,29 +56,29 @@ QUnit.test("AND union basics", function(){ }); var is35OrJustin = set.union(is35, isJustin); - QUnit.deepEqual(is35OrJustin,new types.ValuesOr([is35, isJustin]),"35 and justin"); + assert.deepEqual(is35OrJustin,new types.ValuesOr([is35, isJustin]),"35 and justin"); }); -QUnit.test("AND / OR / NOT union", function(){ +QUnit.test("AND / OR / NOT union", function(assert) { var isJustin = new types.KeysAnd({name: "Justin"}), isNotJustin = new types.KeysAnd({name: new types.ValuesNot("Justin")}); - QUnit.equal( set.union(isJustin,isNotJustin), set.UNIVERSAL, "{name: 'j'} U {name: NOT('j')}"); + assert.equal( set.union(isJustin,isNotJustin), set.UNIVERSAL, "{name: 'j'} U {name: NOT('j')}"); var everything = new types.KeysAnd({}); - QUnit.equal( set.union(isJustin,everything), set.UNIVERSAL, "{name: 'j'} U {}"); + assert.equal( set.union(isJustin,everything), set.UNIVERSAL, "{name: 'j'} U {}"); var isJustinAnd21 = new types.KeysAnd({name: "Justin", age: 22}); - QUnit.equal( set.union(isJustin,isJustinAnd21), isJustin, "super and subset"); + assert.equal( set.union(isJustin,isJustinAnd21), isJustin, "super and subset"); - QUnit.equal( set.union(isJustinAnd21,isJustinAnd21), isJustinAnd21, "union with itself"); + assert.equal( set.union(isJustinAnd21,isJustinAnd21), isJustinAnd21, "union with itself"); }); -QUnit.test("AND / OR / NOT difference", function(){ +QUnit.test("AND / OR / NOT difference", function(assert) { // CASE: prop in A not in B @@ -95,17 +95,17 @@ QUnit.test("AND / OR / NOT difference", function(){ result = set.difference(isJustin, is35); // CASE: overlaping sets - QUnit.deepEqual(result, isJustinAndNot35, 'OVERLAP: {name: "Justin"} \\ {age: 35} -> {name: "justin", age: NOT(35)}'); + assert.deepEqual(result, isJustinAndNot35, 'OVERLAP: {name: "Justin"} \\ {age: 35} -> {name: "justin", age: NOT(35)}'); // CASE: same set - QUnit.deepEqual( set.difference(is35, is35), set.EMPTY, 'SAME SET: {age: 35} \\ {age: 35} -> EMPTY'); + assert.deepEqual( set.difference(is35, is35), set.EMPTY, 'SAME SET: {age: 35} \\ {age: 35} -> EMPTY'); // CASE: subset - QUnit.deepEqual( set.difference(isJustinAnd35, is35), set.EMPTY, + assert.deepEqual( set.difference(isJustinAnd35, is35), set.EMPTY, 'SUPERSET: {age: 35, name: "Justin"} \\ {age: 35} -> EMPTY'); // CASE: superset - QUnit.deepEqual( set.difference(isJustin, isJustinAnd35), isJustinAndNot35, + assert.deepEqual( set.difference(isJustin, isJustinAnd35), isJustinAndNot35, '{name: "Justin"} \\ {age: 35, name: "Justin"} -> {name: "justin", age: NOT(35)}'); @@ -113,7 +113,7 @@ QUnit.test("AND / OR / NOT difference", function(){ // `{age: 35} \ {age: 32} -> {age: 35}` result = set.difference(is35, new types.KeysAnd({age: 32})); - QUnit.deepEqual(result, new types.KeysAnd({age: 35}), + assert.deepEqual(result, new types.KeysAnd({age: 35}), 'DISJOINT: {age: 35} \\ {age: 32} -> {age: 35}'); @@ -121,7 +121,7 @@ QUnit.test("AND / OR / NOT difference", function(){ // `{age: 34, name: "Justin"} \ {age: 35} -> {age: 34, name: "Justin"}` result = set.difference(new types.KeysAnd({age: 34, name: "Justin"}), is35); - QUnit.deepEqual(result, new types.KeysAnd({age: 34, name: "Justin"}), + assert.deepEqual(result, new types.KeysAnd({age: 34, name: "Justin"}), 'DISJOINT: {age: 34, name: "Justin"} \\ {age: 35} -> {age: 34, name: "Justin"}'); // CASE: DISJOINT - can't peform -> double NOT of props @@ -131,7 +131,7 @@ QUnit.test("AND / OR / NOT difference", function(){ new types.KeysAnd({foo: "bar"}), isJustinAnd35 ); - QUnit.deepEqual(result,set.UNDEFINABLE, + assert.deepEqual(result,set.UNDEFINABLE, 'DISJOINT: {foo: "bar"} \\ {name: "Justin", age: 35} -> UNDEFINABLE'); // CASE: @@ -143,7 +143,7 @@ QUnit.test("AND / OR / NOT difference", function(){ new types.KeysAnd({age: new types.ValuesNot(35)}) ]); - QUnit.deepEqual(result,compare, + assert.deepEqual(result,compare, 'UNIVESAL: {} \\ {name: "Justin", age: 35} -> OR[ AND(name: NOT("Justin")), AND(age: NOT(35)) ]'); @@ -151,7 +151,7 @@ QUnit.test("AND / OR / NOT difference", function(){ // {} \ {bar: IS_UNIVERSAL} result = set.difference(new types.KeysAnd({foo: 2}), new types.KeysAnd({foo: 2, bar : set.UNIVERSAL})); - QUnit.deepEqual(result,set.EMPTY, + assert.deepEqual(result,set.EMPTY, 'UNIVESAL: {foo:2} \ {foo:2, bar: IS_UNIVERSAL} -> set.EMPTY'); @@ -162,28 +162,28 @@ QUnit.test("AND / OR / NOT difference", function(){ // {color: [r, g], status: [a, c]} \ {color: [r], status: [a]} -> OR( {g X a}, {g X c}, {r X c} ) }); -QUnit.test("AND / OR / NOT isSubset", function(){ +QUnit.test("AND / OR / NOT isSubset", function(assert) { var res; res = set.isSubset( new types.KeysAnd({ type: 'FOLDER' }), new types.KeysAnd({ type: 'FOLDER' }) ); - QUnit.ok(res, 'equal sets'); + assert.ok(res, 'equal sets'); res = set.isSubset( new types.KeysAnd({ type: 'FOLDER', parentId: 5 }), new types.KeysAnd({ type: 'FOLDER' })); - QUnit.ok(res, 'sub set'); + assert.ok(res, 'sub set'); res = set.isSubset( new types.KeysAnd({ type: 'FOLDER' }), new types.KeysAnd({ type: 'FOLDER', parentId: 5 }) ); - QUnit.notOk(res, 'wrong way'); + assert.notOk(res, 'wrong way'); res = set.isSubset( new types.KeysAnd({ type: 'FOLDER', parentId: 7 }), new types.KeysAnd({ type: 'FOLDER', parentId: 5 }) ); - QUnit.ok(!res, 'different values'); + assert.ok(!res, 'different values'); }); -QUnit.test("union AND with ENUM", function(){ +QUnit.test("union AND with ENUM", function(assert) { function Color(){} @@ -195,7 +195,7 @@ QUnit.test("union AND with ENUM", function(){ var res = set.union(qA, qB); - QUnit.deepEqual(res, + assert.deepEqual(res, new types.KeysAnd({ type: 'FOLDER', status: new ColorSet(["red","green"]) @@ -204,52 +204,52 @@ QUnit.test("union AND with ENUM", function(){ ); }); -QUnit.test("AND isMember", function(){ +QUnit.test("AND isMember", function(assert) { var folderAnd35 = new types.KeysAnd({ type: 'FOLDER', age: 35 }); - QUnit.ok( folderAnd35.isMember({type: 'FOLDER', age: 35}) ); - QUnit.ok( folderAnd35.isMember({type: 'FOLDER', age: 35, extra: "value"}) ); - QUnit.notOk( folderAnd35.isMember({type: 'FOLDER', age: 36}) ); - QUnit.notOk( folderAnd35.isMember({type: 'folder', age: 35}) ); - QUnit.notOk( folderAnd35.isMember({type: 'FOLDER'}) ); - QUnit.notOk( folderAnd35.isMember({age: 35}) ); + assert.ok( folderAnd35.isMember({type: 'FOLDER', age: 35}) ); + assert.ok( folderAnd35.isMember({type: 'FOLDER', age: 35, extra: "value"}) ); + assert.notOk( folderAnd35.isMember({type: 'FOLDER', age: 36}) ); + assert.notOk( folderAnd35.isMember({type: 'folder', age: 35}) ); + assert.notOk( folderAnd35.isMember({type: 'FOLDER'}) ); + assert.notOk( folderAnd35.isMember({age: 35}) ); var isJustinPostCollege = new types.KeysAnd({ name: {first: "Justin"}, age: 33 }); - QUnit.ok( isJustinPostCollege.isMember({ + assert.ok( isJustinPostCollege.isMember({ name: {first: "Justin", last: "Meyer"}, age: 33 }), "is member"); }); -QUnit.test("OR isMember", function(){ +QUnit.test("OR isMember", function(assert) { var isFolder = new types.KeysAnd({ type: 'FOLDER'}), is35 = new types.KeysAnd({ age: 35 }), isFolderOr35 = new types.ValuesOr([isFolder, is35]); - QUnit.ok( isFolderOr35.isMember({type: 'FOLDER', age: 35}), "both" ); - QUnit.notOk( isFolderOr35.isMember({}), "empty" ); - QUnit.ok( isFolderOr35.isMember({type: 'FOLDER', age: 36}) ); - QUnit.ok( isFolderOr35.isMember({type: 'folder', age: 35}) ); - QUnit.notOk( isFolderOr35.isMember({type: 'folder', age: 36}) ); - QUnit.ok( isFolderOr35.isMember({type: 'FOLDER'}) ); - QUnit.ok( isFolderOr35.isMember({age: 35}) ); + assert.ok( isFolderOr35.isMember({type: 'FOLDER', age: 35}), "both" ); + assert.notOk( isFolderOr35.isMember({}), "empty" ); + assert.ok( isFolderOr35.isMember({type: 'FOLDER', age: 36}) ); + assert.ok( isFolderOr35.isMember({type: 'folder', age: 35}) ); + assert.notOk( isFolderOr35.isMember({type: 'folder', age: 36}) ); + assert.ok( isFolderOr35.isMember({type: 'FOLDER'}) ); + assert.ok( isFolderOr35.isMember({age: 35}) ); }); -QUnit.test("And nested objects", function(){ +QUnit.test("And nested objects", function(assert) { var res; var isNameFirstJustin = new types.KeysAnd({ name: {first: "Justin"}}); var isNameFirstJustin2 = new types.KeysAnd({ name: {first: "Justin"}}); res = set.isEqual(isNameFirstJustin, isNameFirstJustin2); - QUnit.equal(res, true); + assert.equal(res, true); }); @@ -261,25 +261,25 @@ QUnit.module("can-query-logic/not"); // Might have "real numbers" // But want even and odds and integers // Can't "build up" to real with all those other combinations -QUnit.test("union basics", function(){ +QUnit.test("union basics", function(assert) { - QUnit.equal( set.union( new types.ValuesNot(1), 1), set.UNIVERSAL, "is univesal set"); + assert.equal( set.union( new types.ValuesNot(1), 1), set.UNIVERSAL, "is univesal set"); }); -QUnit.test("difference with universal", function(){ +QUnit.test("difference with universal", function(assert) { // everything NOT 1, but not the universe - QUnit.equal( set.difference( new types.ValuesNot(1), set.UNIVERSAL), set.EMPTY, "not 1 \\ univesal = 1"); + assert.equal( set.difference( new types.ValuesNot(1), set.UNIVERSAL), set.EMPTY, "not 1 \\ univesal = 1"); - QUnit.deepEqual( set.difference( set.UNIVERSAL, 1), new types.ValuesNot(1), "1 \\ univesal = not 1"); + assert.deepEqual( set.difference( set.UNIVERSAL, 1), new types.ValuesNot(1), "1 \\ univesal = not 1"); }); -QUnit.test("And with nested.properties", function(){ +QUnit.test("And with nested.properties", function(assert) { - QUnit.equal( + assert.equal( set.isSubset( new types.KeysAnd({ "name.first": "Justin", @@ -293,7 +293,7 @@ QUnit.test("And with nested.properties", function(){ "dot.ed properties work with subset" ); - QUnit.equal( + assert.equal( new types.KeysAnd({ "name.first": "Justin", "name.last": "Meyer" @@ -302,7 +302,7 @@ QUnit.test("And with nested.properties", function(){ "dot.ed properties isMember match" ); - QUnit.equal( + assert.equal( new types.KeysAnd({ "name.first": "Justin", "name.last": "Meyer" @@ -314,11 +314,11 @@ QUnit.test("And with nested.properties", function(){ }); -QUnit.test("And with nested ands", function(){ +QUnit.test("And with nested ands", function(assert) { - QUnit.equal( + assert.equal( set.isSubset( new types.KeysAnd({ name: new types.KeysAnd({ @@ -336,7 +336,7 @@ QUnit.test("And with nested ands", function(){ "properties work with subset" ); - QUnit.deepEqual( + assert.deepEqual( set.intersection( new types.KeysAnd({ name: new types.KeysAnd({ @@ -358,7 +358,7 @@ QUnit.test("And with nested ands", function(){ "properties work with intersection" ); - QUnit.equal( + assert.equal( new types.KeysAnd({ name: new types.KeysAnd({ first: "Justin", @@ -369,7 +369,7 @@ QUnit.test("And with nested ands", function(){ "dot.ed properties isMember match" ); - QUnit.equal( + assert.equal( new types.KeysAnd({ name: new types.KeysAnd({ first: "Justin", @@ -382,7 +382,7 @@ QUnit.test("And with nested ands", function(){ }); -QUnit.test("union with comparisons", function(){ +QUnit.test("union with comparisons", function(assert) { var isGtJustinAndGt35 = new types.KeysAnd({ name: new is.GreaterThan("Justin"), age: new is.GreaterThan(35) @@ -391,7 +391,7 @@ QUnit.test("union with comparisons", function(){ age: new is.GreaterThan(25) }); var result = set.union(isGtJustinAndGt35, isGt25); - QUnit.deepEqual(result, isGt25); + assert.deepEqual(result, isGt25); // if filtering in fewer dimensions is a superset, use that var a = new types.KeysAnd({ @@ -404,6 +404,6 @@ QUnit.test("union with comparisons", function(){ count: new is.GreaterThan(9) }); result = set.union(b, a); - QUnit.deepEqual(result, b); + assert.deepEqual(result, b); }); diff --git a/src/types/basic-query-filter-from-test.js b/src/types/basic-query-filter-from-test.js index a4ba1f5..be98764 100644 --- a/src/types/basic-query-filter-from-test.js +++ b/src/types/basic-query-filter-from-test.js @@ -16,7 +16,7 @@ var items = [ { id: 7, note: 'C', type: 'critical' } ]; -QUnit.test("against non ranged set", function(){ +QUnit.test("against non ranged set", function(assert) { /* * 1. set b = {} evaluates to all available entities -- the univeral set * 2. set a = { type: 'critical', start: 1, end: 3 } evaluates to entities @@ -41,10 +41,10 @@ QUnit.test("against non ranged set", function(){ }); var res = query.filterFrom(items); - QUnit.deepEqual(res && res.map(getId), [2,4,6]); + assert.deepEqual(res && res.map(getId), [2,4,6]); }); -QUnit.test("ordered ascending and paginated", function() { +QUnit.test("ordered ascending and paginated", function(assert) { /* * 1. set b = {} evaluates to all available entities -- the univeral set * 2. set a = { type: 'critical', sort: 'note ASC', start: 1, end: 3 } @@ -72,10 +72,10 @@ QUnit.test("ordered ascending and paginated", function() { }); var res = query.filterFrom(items); - QUnit.deepEqual(res && res.map(getId), [7,1,2]); + assert.deepEqual(res && res.map(getId), [7,1,2]); }); -QUnit.test("ordered descending and paginated", function() { +QUnit.test("ordered descending and paginated", function(assert) { /* * 1. set b = {} evaluates to all available entities -- the univeral set * 2. set a = { type: 'critical', sort: 'note DESC', start: 1, end: 3 } @@ -98,10 +98,10 @@ QUnit.test("ordered descending and paginated", function() { }); var res = query.filterFrom(items); - QUnit.deepEqual(res && res.map(getId), [2,1,7]); + assert.deepEqual(res && res.map(getId), [2,1,7]); }); -QUnit.test("against paginated set", function(){ +QUnit.test("against paginated set", function(assert) { var query = new BasicQuery({ filter: new BasicQuery.KeysAnd({ type: 'critical'}), @@ -114,10 +114,10 @@ QUnit.test("against paginated set", function(){ var res = query.filterFrom(items, fromQuery); - QUnit.deepEqual(res && res.map(getId), [2,4,6]); + assert.deepEqual(res && res.map(getId), [2,4,6]); }); -QUnit.test("returns undefined against incompatible set", function() { +QUnit.test("returns undefined against incompatible set", function(assert) { var query = new BasicQuery({ filter: new BasicQuery.KeysAnd({ note: 'C' }) }); @@ -127,6 +127,6 @@ QUnit.test("returns undefined against incompatible set", function() { try{ var res = query.filterFrom(items, fromQuery); } catch(e) { - QUnit.ok(true, "throws an error") + assert.ok(true, "throws an error") } }); diff --git a/src/types/basic-query-merge-test.js b/src/types/basic-query-merge-test.js index 433e1f3..77171af 100644 --- a/src/types/basic-query-merge-test.js +++ b/src/types/basic-query-merge-test.js @@ -18,16 +18,16 @@ var items = [ var everything = new BasicQuery({}); -QUnit.test("basics", function(){ +QUnit.test("basics", function(assert) { var fooBar = new BasicQuery({ filter: new BasicQuery.KeysAnd({ foo: "bar" }) }); var res = everything.merge(fooBar,items, items.slice(0, 3), getId ); - deepEqual(res, items); + assert.deepEqual(res, items); }); -QUnit.test("unionMembers against ranged sets", function(){ +QUnit.test("unionMembers against ranged sets", function(assert) { var a = new BasicQuery({ page: new BasicQuery.RecordRange(10,13) }); @@ -42,11 +42,11 @@ QUnit.test("unionMembers against ranged sets", function(){ union = a.merge(b,items.slice(4,8),items.slice(0,4), getId ); - deepEqual(union, items, "disjoint after"); + assert.deepEqual(union, items, "disjoint after"); }); -QUnit.test("unionMembers against overlapping ranged sets", function(){ +QUnit.test("unionMembers against overlapping ranged sets", function(assert) { var a = new BasicQuery({ page: new BasicQuery.RecordRange(10,13) }); @@ -55,7 +55,7 @@ QUnit.test("unionMembers against overlapping ranged sets", function(){ }); var union = a.merge(b,items.slice(0,5),items.slice(3,8), getId ); - deepEqual(union, items); + assert.deepEqual(union, items); // BREAK a = new BasicQuery({ @@ -68,7 +68,7 @@ QUnit.test("unionMembers against overlapping ranged sets", function(){ items.slice(0,2), items.slice(1,8), getId ); - deepEqual(union, items); + assert.deepEqual(union, items); // BREAK @@ -82,10 +82,10 @@ QUnit.test("unionMembers against overlapping ranged sets", function(){ items.slice(1,8), items.slice(0,2), getId ); - deepEqual(union, items); + assert.deepEqual(union, items); }); -QUnit.test("unionMembers filters for uniqueness", function(){ +QUnit.test("unionMembers filters for uniqueness", function(assert) { var aItems = items.filter(function(a) { return a.type === "critical"; }); @@ -101,10 +101,10 @@ QUnit.test("unionMembers filters for uniqueness", function(){ page: new BasicQuery.KeysAnd({note: "C"}) }); var union = a.merge(b,aItems, bItems, getId ); - deepEqual(union, unionItems); + assert.deepEqual(union, unionItems); // BREAK var union = b.merge(a,bItems,aItems, getId ); - deepEqual(union, unionItems); + assert.deepEqual(union, unionItems); }); diff --git a/src/types/basic-query-sorting-test.js b/src/types/basic-query-sorting-test.js index cd025a9..32620df 100644 --- a/src/types/basic-query-sorting-test.js +++ b/src/types/basic-query-sorting-test.js @@ -67,7 +67,7 @@ function legacySubset(setA, setB) { // The following tests are taken from can-setB // ============================================= -test('rangeInclusive legacyDifference', function() { +QUnit.test('rangeInclusive legacyDifference', function(assert) { /* * X = [A0, ..., A99] * Y = [A50, ..., A101] @@ -75,7 +75,7 @@ test('rangeInclusive legacyDifference', function() { * X / Y = [A0, ..., A49] */ var res = legacyDifference({ start: 0, end: 99 }, { start: 50, end: 101 }); - deepEqual(res, { start: 0, end: 49 }, "got a diff"); + assert.deepEqual(res, { start: 0, end: 49 }, "got a diff"); /* * let: @@ -92,7 +92,7 @@ test('rangeInclusive legacyDifference', function() { * X / Y = the set of all things not in Y */ res = legacyDifference({}, { start: 0, end: 10 }); - deepEqual(res, {start: 11, end: Infinity}, 'universal set'); + assert.deepEqual(res, {start: 11, end: Infinity}, 'universal set'); /* * X = [A0, ..., A49] @@ -101,7 +101,7 @@ test('rangeInclusive legacyDifference', function() { * X / Y = X */ res = legacyDifference({ start: 0, end: 49 }, { start: 50, end: 101 }); - deepEqual(res, { start: 0, end: 49 }, "side by side"); + assert.deepEqual(res, { start: 0, end: 49 }, "side by side"); /* * X = [A0, ..., A49] @@ -110,7 +110,7 @@ test('rangeInclusive legacyDifference', function() { * X / Y = [A21, ..., A49] */ res = legacyDifference({ start: 0, end: 49 }, { start: 0, end: 20 }); - deepEqual(res, { start: 21, end: 49 }, "first set extends past second"); + assert.deepEqual(res, { start: 21, end: 49 }, "first set extends past second"); /* * X = [A0, ..., A49] @@ -119,10 +119,10 @@ test('rangeInclusive legacyDifference', function() { * X / Y = [A0, ..., A19] */ res = legacyDifference({ start: 0, end: 49 }, { start: 20, end: 49 }); - deepEqual(res, { start: 0, end: 19 }, "first set starts before second"); + assert.deepEqual(res, { start: 0, end: 19 }, "first set starts before second"); }); -test('rangeInclusive legacyIntersection', function(){ +QUnit.test('rangeInclusive legacyIntersection', function(assert) { /* * X = [A0, A99] * Y = [A50, A101] @@ -130,10 +130,10 @@ test('rangeInclusive legacyIntersection', function(){ * X ∩ Y = [A50, A99] */ var res = legacyIntersection({ start: 0, end: 99 }, { start: 50, end: 101 }); - deepEqual(res, { start: 50, end: 99 }, "got a intersection"); + assert.deepEqual(res, { start: 50, end: 99 }, "got a intersection"); }); -test('rangeInclusive legacyIsEqual', function(){ +QUnit.test('rangeInclusive legacyIsEqual', function(assert) { /* * X = [A0, ..., An] @@ -149,7 +149,7 @@ test('rangeInclusive legacyIsEqual', function(){ * X = [A0, ..., An] * Y = [A0, ..., A(n+1)] */ - ok( + assert.ok( !legacyIsEqual( {start: 0, end: 100}, {start: 0, end: 101}), @@ -159,19 +159,19 @@ test('rangeInclusive legacyIsEqual', function(){ * X = [A0, ..., An] * Y = [A1, ..., An] */ - ok( + assert.ok( !legacyIsEqual( {start: 0, end: 100}, {start: 1, end: 100}), "they are not equal" ); }); -test('rangeInclusive legacySubset', function(){ +QUnit.test('rangeInclusive legacySubset', function(assert) { /* * X = [A0, ..., An] * Y = [A0, ..., An] */ - ok( + assert.ok( legacySubset( {start: 0, end: 100}, {start: 0, end: 100}), @@ -181,7 +181,7 @@ test('rangeInclusive legacySubset', function(){ * X = [A0, ..., An] * Y = [A0, ..., A(n+1)] */ - ok( + assert.ok( legacySubset( {start: 0, end: 100}, {start: 0, end: 101}), @@ -191,7 +191,7 @@ test('rangeInclusive legacySubset', function(){ * X = [A0, ..., An] * Y = [A0, ..., A(n+1)] */ - QUnit.equal( + assert.equal( legacySubset( {start: 0, end: 101}, {start: 0, end: 100}),false, @@ -201,7 +201,7 @@ test('rangeInclusive legacySubset', function(){ * X = [A1, ..., An] * Y = [A0, ..., An] */ - ok( + assert.ok( legacySubset( {start: 1, end: 100}, {start: 0, end: 100}), @@ -211,7 +211,7 @@ test('rangeInclusive legacySubset', function(){ * X = [A1, ..., An] * Y = [A0, ..., An] */ - ok( + assert.ok( !legacySubset( {start: 0, end: 100}, {start: 1, end: 100}), @@ -219,7 +219,7 @@ test('rangeInclusive legacySubset', function(){ }); -test('rangeInclusive legacyUnion', function() { +QUnit.test('rangeInclusive legacyUnion', function(assert) { /* * X = [A0, ..., A99] * Y = [A50, ..., A101] @@ -236,7 +236,7 @@ test('rangeInclusive legacyUnion', function() { * X U Y = X */ res = legacyUnion({}, { start: 0, end: 10 }); - deepEqual(res, {}, "universal set"); + assert.deepEqual(res, {}, "universal set"); return; /* * X = [A100, ..., A199] @@ -245,7 +245,7 @@ test('rangeInclusive legacyUnion', function() { * X U Y = [A100, ..., A299] */ res = legacyUnion({start: 100, end: 199}, {start: 200, end: 299}); - deepEqual(res, {start:100, end:299}, "no intersection"); + assert.deepEqual(res, {start:100, end:299}, "no intersection"); /* * X = [A200, ..., A299] @@ -254,7 +254,7 @@ test('rangeInclusive legacyUnion', function() { * X U Y = [A100, ..., A299] */ res = legacyUnion({start: 200, end: 299}, {start: 100, end: 199}); - deepEqual(res, {start:100, end:299}, "no intersection with either argument order"); + assert.deepEqual(res, {start:100, end:299}, "no intersection with either argument order"); /* * X = [A200, ..., A299] @@ -263,7 +263,7 @@ test('rangeInclusive legacyUnion', function() { * X U Y = [A100, ..., A299] */ res = legacyUnion({start: 200, end: 299}, {start: 100, end: 209}); - deepEqual(res, {start:100, end:299}, "sets can intersect"); + assert.deepEqual(res, {start:100, end:299}, "sets can intersect"); /* * X = [A200, ..., A299] @@ -272,7 +272,7 @@ test('rangeInclusive legacyUnion', function() { * X U Y = [A100, ..., A299] */ res = legacyUnion({start: 100, end: 209}, {start: 200, end: 299}); - deepEqual(res, {start:100, end:299}, "sets can intersect with either argument order"); + assert.deepEqual(res, {start:100, end:299}, "sets can intersect with either argument order"); /* * X = [A100, ..., A299] @@ -281,7 +281,7 @@ test('rangeInclusive legacyUnion', function() { * X U Y = [A100, ..., A299] */ res = legacyUnion({start: 100, end: 299}, {start: 103, end: 209}); - deepEqual(res, {start:100, end:299}, "first set contains second"); + assert.deepEqual(res, {start:100, end:299}, "first set contains second"); /* * X = [A103, ..., A209] @@ -290,7 +290,7 @@ test('rangeInclusive legacyUnion', function() { * X U Y = [A100, ..., A299] */ res = legacyUnion({start: 100, end: 299}, {start: 103, end: 209}); - deepEqual(res, {start:100, end:299}, "second set contains first"); + assert.deepEqual(res, {start:100, end:299}, "second set contains first"); /* * X = [A100, ..., A299] @@ -299,12 +299,12 @@ test('rangeInclusive legacyUnion', function() { * X U Y = [A100, ..., A299] */ res = legacyUnion({start: 100, end: 299}, {start: 100, end: 299}); - deepEqual(res, {start:100, end:299}, "union of identical sets is the same as those sets"); + assert.deepEqual(res, {start:100, end:299}, "union of identical sets is the same as those sets"); }); -QUnit.test('rangeInclusive set.count', function(){ +QUnit.test('rangeInclusive set.count', function(assert) { /* * X = [A0, ..., A99] * |X| = 100 @@ -315,11 +315,11 @@ QUnit.test('rangeInclusive set.count', function(){ filter: set.UNIVERSAL }); var res = query.count({ start: 0, end: 99 }); - equal(res, 100, "count is right"); + assert.equal(res, 100, "count is right"); }); -QUnit.test("index uses can-reflect", function(){ +QUnit.test("index uses can-reflect", function(assert) { var query = new BasicQuery({ sort: "name" @@ -351,9 +351,9 @@ QUnit.test("index uses can-reflect", function(){ var res = query.index(item,[obj2, obj1]); - QUnit.equal(res, 1, "inserted at 1"); + assert.equal(res, 1, "inserted at 1"); - QUnit.deepEqual([obj1Read, obj2Read, itemKeyRead, itemOwnKeyRead], + assert.deepEqual([obj1Read, obj2Read, itemKeyRead, itemOwnKeyRead], [true, true, true, true], "read everything"); }); @@ -403,5 +403,5 @@ QUnit.test("index should not sort unchanged items #33", function(assert) { var res = query.index({id:4, name: "Item 1"}, items); - QUnit.equal(res, 3); + assert.equal(res, 3); }); diff --git a/src/types/comparisons-test.js b/src/types/comparisons-test.js index 7a0f2b6..6931a85 100644 --- a/src/types/comparisons-test.js +++ b/src/types/comparisons-test.js @@ -717,7 +717,7 @@ var tests = { var intermediate = set.union(gt1,lt1); var result = set.union( intermediate, eq1 ); - QUnit.equal(result, set.UNIVERSAL, "foo > 1 || foo < 1 || foo === 1 => UNIVERSAL"); + assert.equal(result, set.UNIVERSAL, "foo > 1 || foo < 1 || foo === 1 => UNIVERSAL"); }, intersection: function(assert) { var a = new is.In([5, 6]); @@ -3883,7 +3883,7 @@ names.forEach(function(name1, i) { -QUnit.test("Able to do membership, union, difference with GreaterThan", function() { +QUnit.test("Able to do membership, union, difference with GreaterThan", function(assert) { var DateStrSet = function(value) { this.value = value; @@ -3896,7 +3896,7 @@ QUnit.test("Able to do membership, union, difference with GreaterThan", function var greaterThan1980 = new compare.GreaterThan( new DateStrSet(date1980.toString()) ); - QUnit.ok(greaterThan1980.isMember(new Date(1982, 9, 20).toString()), "is member"); + assert.ok(greaterThan1980.isMember(new Date(1982, 9, 20).toString()), "is member"); var greaterThan1990 = new compare.GreaterThan( new DateStrSet(new Date(1990, 0, 1).toString()) @@ -3904,7 +3904,7 @@ QUnit.test("Able to do membership, union, difference with GreaterThan", function var union = set.union(greaterThan1980, greaterThan1990); - QUnit.deepEqual(union, new compare.GreaterThan( + assert.deepEqual(union, new compare.GreaterThan( new DateStrSet(date1980.toString()) ), "union"); @@ -3912,12 +3912,12 @@ QUnit.test("Able to do membership, union, difference with GreaterThan", function var gt1980 = new compare.GreaterThan(new DateStrSet(date1980.toString())), lte1990 = new compare.LessThanEqual(new DateStrSet(new Date(1990, 0, 1).toString())); - QUnit.deepEqual(difference, + assert.deepEqual(difference, new is.And([gt1980, lte1990]), "difference"); }); -QUnit.test("Able to do membership, union, difference with $in", function() { +QUnit.test("Able to do membership, union, difference with $in", function(assert) { var DateStrSet = function(value) { this.value = value; @@ -3935,7 +3935,7 @@ QUnit.test("Able to do membership, union, difference with $in", function() { ]); - QUnit.ok(in80or90.isMember(date1980), "is member"); + assert.ok(in80or90.isMember(date1980), "is member"); var in90or00 = new compare.In([ new DateStrSet(date1990), @@ -3944,7 +3944,7 @@ QUnit.test("Able to do membership, union, difference with $in", function() { var union = set.union(in80or90, in90or00); - QUnit.deepEqual(union, new compare.In([ + assert.deepEqual(union, new compare.In([ new DateStrSet(date1980), new DateStrSet(date1990), new DateStrSet(date2000) @@ -3956,7 +3956,7 @@ QUnit.test("Able to do membership, union, difference with $in", function() { var union = set.union(greaterThan1980, greaterThan1990); - QUnit.deepEqual(union,new compare.GreaterThan( + assert.deepEqual(union,new compare.GreaterThan( new DateStrSet( date1980.toString() ) ), "union"); @@ -3964,7 +3964,7 @@ QUnit.test("Able to do membership, union, difference with $in", function() { var gt1980 = new compare.GreaterThan( new DateStrSet( date1980.toString() ) ), lte1990 = new compare.LessThanEqual( new DateStrSet( new Date(1990,0,1).toString() ) ); - QUnit.deepEqual(difference, + assert.deepEqual(difference, new is.And([gt1980, lte1990]), "difference");*/ }); diff --git a/src/types/make-enum-test.js b/src/types/make-enum-test.js index 118d425..b6dfb0e 100644 --- a/src/types/make-enum-test.js +++ b/src/types/make-enum-test.js @@ -8,10 +8,10 @@ var canSymbol = require("can-symbol"); QUnit.module("can-query-logic/types/make-enum"); -QUnit.test(".isMember", function(){ +QUnit.test(".isMember", function(assert) { var Status = makeEnum(function(){},["assigned","complete"]); var status = new Status(["assigned"]); - QUnit.ok( status[canSymbol.for("can.isMember")]("assigned"), "assigned is member"); + assert.ok( status[canSymbol.for("can.isMember")]("assigned"), "assigned is member"); }); diff --git a/src/types/make-maybe-test.js b/src/types/make-maybe-test.js index d8358bf..6475ae0 100644 --- a/src/types/make-maybe-test.js +++ b/src/types/make-maybe-test.js @@ -24,34 +24,34 @@ ComparisonSet.prototype.valueOf = function() { var MaybeDateStringSet = makeMaybe([null, undefined], DateStringSet); -QUnit.test("construtor normalizes", function() { +QUnit.test("construtor normalizes", function(assert) { var isNull_3 = new MaybeDateStringSet({ range: new is.In([null, 3]) }); - QUnit.deepEqual(isNull_3.range, new is.In([3]), "3 left in range"); - QUnit.deepEqual(isNull_3.enum, new is.In([null]), "range moved to in"); + assert.deepEqual(isNull_3.range, new is.In([3]), "3 left in range"); + assert.deepEqual(isNull_3.enum, new is.In([null]), "range moved to in"); // with value of values var isNull_3AsDateString = new MaybeDateStringSet({ range: new is.In([new DateStringSet(null), new DateStringSet(3)]) }); - QUnit.deepEqual(isNull_3AsDateString.range, new is.In([new DateStringSet(3)]), "3 left in range"); - QUnit.deepEqual(isNull_3AsDateString.enum, new is.In([new DateStringSet(null)]), "range moved to in"); + assert.deepEqual(isNull_3AsDateString.range, new is.In([new DateStringSet(3)]), "3 left in range"); + assert.deepEqual(isNull_3AsDateString.enum, new is.In([new DateStringSet(null)]), "range moved to in"); var isNull = new MaybeDateStringSet({ range: new is.In([null]) }); - QUnit.deepEqual(isNull.range, set.EMPTY, "empty if only null"); - QUnit.deepEqual(isNull.enum, new is.In([null]), "range moved to in"); + assert.deepEqual(isNull.range, set.EMPTY, "empty if only null"); + assert.deepEqual(isNull.enum, new is.In([null]), "range moved to in"); var res = new MaybeDateStringSet({ range: new is.NotIn([null, 3]) }); - QUnit.deepEqual(res.range, new is.NotIn([3]), "not in range"); - QUnit.deepEqual(res.enum, new is.In([undefined]), "not in enum"); + assert.deepEqual(res.range, new is.NotIn([3]), "not in range"); + assert.deepEqual(res.enum, new is.In([undefined]), "not in enum"); res = new MaybeDateStringSet({ range: new is.And([ @@ -59,12 +59,12 @@ QUnit.test("construtor normalizes", function() { new is.GreaterThan(4) ]) }); - QUnit.deepEqual(res.range, new is.GreaterThan(4), "And with not in"); - QUnit.deepEqual(res.enum, set.EMPTY, "And with not in"); + assert.deepEqual(res.range, new is.GreaterThan(4), "And with not in"); + assert.deepEqual(res.enum, set.EMPTY, "And with not in"); }); -QUnit.test("difference with universal", function() { +QUnit.test("difference with universal", function(assert) { var res; var gt3 = new MaybeDateStringSet({ @@ -73,7 +73,7 @@ QUnit.test("difference with universal", function() { res = set.difference(set.UNIVERSAL, gt3); - QUnit.deepEqual(res, new MaybeDateStringSet({ + assert.deepEqual(res, new MaybeDateStringSet({ enum: new is.In([null, undefined]), range: new is.LessThanEqual(3) }), "UNIVERSAL \\ $gt:3"); @@ -85,7 +85,7 @@ QUnit.test("difference with universal", function() { }) ); - QUnit.deepEqual(res, new MaybeDateStringSet({ + assert.deepEqual(res, new MaybeDateStringSet({ range: set.UNIVERSAL, enum: new is.In([undefined]) }), "UNIVERSAL \\ null"); @@ -97,7 +97,7 @@ QUnit.test("difference with universal", function() { }) ); - QUnit.deepEqual(res, new MaybeDateStringSet({ + assert.deepEqual(res, new MaybeDateStringSet({ range: set.UNIVERSAL, enum: new is.In([null]) }), "UNIVERSAL \\ !null"); @@ -109,11 +109,11 @@ QUnit.test("difference with universal", function() { range: new is.LessThanEqual(3) }) ); - QUnit.deepEqual(res, gt3, "secondary and primary"); + assert.deepEqual(res, gt3, "secondary and primary"); }); -QUnit.test("difference", function() { +QUnit.test("difference", function(assert) { var res; var gt3 = new MaybeDateStringSet({ @@ -128,7 +128,7 @@ QUnit.test("difference", function() { range: new is.GreaterThan(4) })); - QUnit.deepEqual(res, new MaybeDateStringSet({ + assert.deepEqual(res, new MaybeDateStringSet({ range: set.difference(new is.GreaterThan(3), new is.GreaterThan(4)) }), "$gt:3 \\ $gt:4"); @@ -142,7 +142,7 @@ QUnit.test("difference", function() { enum: new is.In([null]) }) ); - QUnit.deepEqual(res, new MaybeDateStringSet({ + assert.deepEqual(res, new MaybeDateStringSet({ range: new is.GreaterThan(3) }), "{ne: undef} \\ {lt: 3} | null -> {gte: 3}"); @@ -155,7 +155,7 @@ QUnit.test("difference", function() { range: new is.LessThanEqual(3) }) ); - QUnit.deepEqual(res, new MaybeDateStringSet({ + assert.deepEqual(res, new MaybeDateStringSet({ range: new is.GreaterThan(3), enum: new is.In([null]) }), "{ne: undef} \\ {lt: 3}|null -> {gte: 3} | null"); @@ -168,7 +168,7 @@ QUnit.test("difference", function() { ); - QUnit.deepEqual(res, new MaybeDateStringSet({ + assert.deepEqual(res, new MaybeDateStringSet({ range: new is.NotIn([null]) }), "UNIVERSAL \\ null"); @@ -178,7 +178,7 @@ QUnit.test("difference", function() { range: new is.LessThanEqual(3) }) ); - QUnit.deepEqual(res, gt3, "secondary and primary"); + assert.deepEqual(res, gt3, "secondary and primary"); res = set.difference( new MaybeDateStringSet({ @@ -191,11 +191,11 @@ QUnit.test("difference", function() { }) ); - QUnit.equal(res, set.EMPTY, "equal is empty"); + assert.equal(res, set.EMPTY, "equal is empty"); }); -QUnit.test("difference with ComparisonSet", function() { +QUnit.test("difference with ComparisonSet", function(assert) { var three = new ComparisonSet(3), four = new ComparisonSet(3); var res; @@ -212,7 +212,7 @@ QUnit.test("difference with ComparisonSet", function() { range: new is.GreaterThan(four) })); - QUnit.deepEqual(res, new MaybeDateStringSet({ + assert.deepEqual(res, new MaybeDateStringSet({ range: set.difference(new is.GreaterThan(three), new is.GreaterThan(four)) }), "$gt:3 \\ $gt:4"); @@ -226,7 +226,7 @@ QUnit.test("difference with ComparisonSet", function() { enum: new is.In([null]) }) ); - QUnit.deepEqual(res, new MaybeDateStringSet({ + assert.deepEqual(res, new MaybeDateStringSet({ range: new is.GreaterThan(three) }), "{ne: undef} \\ {lt: 3} | null -> {gte: 3}"); @@ -239,7 +239,7 @@ QUnit.test("difference with ComparisonSet", function() { range: new is.LessThanEqual(three) }) ); - QUnit.deepEqual(res, new MaybeDateStringSet({ + assert.deepEqual(res, new MaybeDateStringSet({ range: new is.GreaterThan(three), enum: new is.In([null]) }), "{ne: undef} \\ {lt: 3}|null -> {gte: 3} | null"); @@ -252,7 +252,7 @@ QUnit.test("difference with ComparisonSet", function() { ); - QUnit.deepEqual(res, new MaybeDateStringSet({ + assert.deepEqual(res, new MaybeDateStringSet({ range: new is.NotIn([null]) }), "UNIVERSAL \\ null"); @@ -263,11 +263,11 @@ QUnit.test("difference with ComparisonSet", function() { range: new is.LessThanEqual(three) }) ); - QUnit.deepEqual(res, gt3, "secondary and primary"); + assert.deepEqual(res, gt3, "secondary and primary"); }); -QUnit.test("intersection", function() { +QUnit.test("intersection", function(assert) { var res; res = set.intersection( @@ -281,7 +281,7 @@ QUnit.test("intersection", function() { }) ); - QUnit.deepEqual(res, + assert.deepEqual(res, new MaybeDateStringSet({ range: new is.GreaterThan(5), enum: new is.In([null]) @@ -290,7 +290,7 @@ QUnit.test("intersection", function() { ); }); -QUnit.test("union", function() { +QUnit.test("union", function(assert) { var res; res = set.union( @@ -304,7 +304,7 @@ QUnit.test("union", function() { }) ); - QUnit.deepEqual(res, + assert.deepEqual(res, new MaybeDateStringSet({ range: new is.GreaterThan(3), enum: new is.In([null, undefined]) @@ -314,7 +314,7 @@ QUnit.test("union", function() { }); -QUnit.test("isSubset", function() { +QUnit.test("isSubset", function(assert) { var res; res = set.isSubset( @@ -328,11 +328,11 @@ QUnit.test("isSubset", function() { }) ); - QUnit.ok(res, "is a subset"); + assert.ok(res, "is a subset"); }); -QUnit.test("can make maybe type from normal type and makeMaybeSetType", function() { +QUnit.test("can make maybe type from normal type and makeMaybeSetType", function(assert) { var MaybeNumber = canReflect.assignSymbols({}, { "can.new": function(val) { if (val == null) { @@ -348,7 +348,7 @@ QUnit.test("can make maybe type from normal type and makeMaybeSetType", function } }); - QUnit.ok(makeMaybe.canMakeMaybeSetType(MaybeNumber), "got everything we need"); + assert.ok(makeMaybe.canMakeMaybeSetType(MaybeNumber), "got everything we need"); var types = makeMaybe.makeMaybeSetTypes(MaybeNumber); @@ -365,13 +365,13 @@ QUnit.test("can make maybe type from normal type and makeMaybeSetType", function notUndefined, nullOrLTE3 ); - QUnit.deepEqual(res, new types.Maybe({ + assert.deepEqual(res, new types.Maybe({ range: new is.GreaterThan(new types.ComparisonSetType(3)) }), "{ne: undef} \\ {lt: 3} | null -> {gte: 3}"); }); -QUnit.test("can make a maybe type from a ComparisonSetType", function() { +QUnit.test("can make a maybe type from a ComparisonSetType", function(assert) { function toDate(str) { var type = typeof str; if (type === 'string') { @@ -410,12 +410,12 @@ QUnit.test("can make a maybe type from a ComparisonSetType", function() { "can.ComparisonSetType": DateStringSet }); - QUnit.ok(makeMaybe.canMakeMaybeSetType(MaybeDate), "got everything we need"); + assert.ok(makeMaybe.canMakeMaybeSetType(MaybeDate), "got everything we need"); var types = makeMaybe.makeMaybeSetTypes(MaybeDate); - QUnit.equal(types.ComparisonSetType, DateStringSet, "got the comparison type"); + assert.equal(types.ComparisonSetType, DateStringSet, "got the comparison type"); var date1982_10_20 = new Date(1982, 9, 20).toString(); @@ -431,26 +431,26 @@ QUnit.test("can make a maybe type from a ComparisonSetType", function() { notUndefined, nullOrLTE3 ); - QUnit.deepEqual(res, new types.Maybe({ + assert.deepEqual(res, new types.Maybe({ range: new is.GreaterThan(new types.ComparisonSetType(date1982_10_20)) }), "{ne: undef} \\ {lt: '" + date1982_10_20 + "'} | null -> {gte: '" + date1982_10_20 + "'}"); }); -QUnit.test("orValues", function() { +QUnit.test("orValues", function(assert) { var res = new MaybeDateStringSet({ range: new is.In([3]), enum: set.EMPTY }); - QUnit.deepEqual(res.orValues(),[new is.In([3])] ,"only got range"); + assert.deepEqual(res.orValues(),[new is.In([3])] ,"only got range"); res = new MaybeDateStringSet({ range: set.EMPTY, enum: new is.In([null]) }); - QUnit.deepEqual(res.orValues(),[new is.In([null])] ,"only got enum"); + assert.deepEqual(res.orValues(),[new is.In([null])] ,"only got enum"); }); @@ -491,7 +491,7 @@ QUnit.test("difference", function(){ res = set.difference( set.UNIVERSAL, greaterThan3 ); - QUnit.deepEqual(res,); + assert.deepEqual(res,); }); */ diff --git a/src/types/make-real-number-range-inclusive-test.js b/src/types/make-real-number-range-inclusive-test.js index 3a2bc7a..bd7894e 100644 --- a/src/types/make-real-number-range-inclusive-test.js +++ b/src/types/make-real-number-range-inclusive-test.js @@ -8,9 +8,9 @@ QUnit.module("can-query-logic/types/make-real-number-range-inclusive"); // Might have "real numbers" // But want even and odds and integers // Can't "build up" to real with all those other combinations -QUnit.test("isSubset", function(){ +QUnit.test("isSubset", function(assert) { - QUnit.equal( + assert.equal( set.isSubset( new RealNumberRangeInclusive(1,4), new RealNumberRangeInclusive(0,5) @@ -18,7 +18,7 @@ QUnit.test("isSubset", function(){ true, "1-4 subset of 0-5"); - QUnit.equal( + assert.equal( set.isSubset( new RealNumberRangeInclusive(0,5), new RealNumberRangeInclusive(1,4) @@ -29,9 +29,9 @@ QUnit.test("isSubset", function(){ }); -QUnit.test("isEqual with universal", function(){ +QUnit.test("isEqual with universal", function(assert) { - QUnit.equal( + assert.equal( set.isEqual( new RealNumberRangeInclusive(1,4), set.UNIVERSAL @@ -39,7 +39,7 @@ QUnit.test("isEqual with universal", function(){ false, "universal second"); - QUnit.equal( + assert.equal( set.isEqual( set.UNIVERSAL, new RealNumberRangeInclusive(1,4) @@ -48,7 +48,7 @@ QUnit.test("isEqual with universal", function(){ false, "universal first"); - QUnit.equal( + assert.equal( set.isEqual( new RealNumberRangeInclusive(-Infinity, Infinity), set.UNIVERSAL @@ -56,7 +56,7 @@ QUnit.test("isEqual with universal", function(){ true, "eq universal second"); - QUnit.equal( + assert.equal( set.isEqual( set.UNIVERSAL, new RealNumberRangeInclusive(-Infinity, Infinity) diff --git a/test/make-enum-logic-test.js b/test/make-enum-logic-test.js index 95edcc8..853cd50 100644 --- a/test/make-enum-logic-test.js +++ b/test/make-enum-logic-test.js @@ -26,7 +26,7 @@ var TODO = canReflect.assignSymbols({},{ var algebra = new QueryLogic(TODO); -QUnit.test("union - enum", function(){ +QUnit.test("union - enum", function(assert) { var unionResult = algebra.union({ filter: { @@ -40,7 +40,7 @@ QUnit.test("union - enum", function(){ } }); - QUnit.deepEqual(unionResult, { + assert.deepEqual(unionResult, { filter: { name: "Justin", status: ["red","green"] @@ -49,7 +49,7 @@ QUnit.test("union - enum", function(){ }); -QUnit.test("automatic enum", function(){ +QUnit.test("automatic enum", function(assert) { var MaybeBoolean = canReflect.assignSymbols({},{ "can.new": function(val){ @@ -83,14 +83,14 @@ QUnit.test("automatic enum", function(){ } }); - QUnit.deepEqual(res,{ + assert.deepEqual(res,{ filter: { complete: [false, undefined, null] } }, "enum works"); }); -QUnit.test("makeEnum from homepage with schema type", function(){ +QUnit.test("makeEnum from homepage with schema type", function(assert) { var Status = canReflect.assignSymbols({},{ "can.new": function(val){ return val; @@ -114,11 +114,11 @@ QUnit.test("makeEnum from homepage with schema type", function(){ {filter: {status: "complete" }} ); - QUnit.deepEqual( unionQuery, {}); + assert.deepEqual( unionQuery, {}); }); -QUnit.test("makeEnum from homepage", function(){ +QUnit.test("makeEnum from homepage", function(assert) { var Status = QueryLogic.makeEnum(["new","assigned","complete"]); @@ -133,5 +133,5 @@ QUnit.test("makeEnum from homepage", function(){ {filter: {status: "complete" }} ); - QUnit.deepEqual( unionQuery, {}); + assert.deepEqual( unionQuery, {}); }); diff --git a/test/maybe-type-test.js b/test/maybe-type-test.js index 47ab042..ffa5c7f 100644 --- a/test/maybe-type-test.js +++ b/test/maybe-type-test.js @@ -4,7 +4,7 @@ var canReflect = require("can-reflect"); QUnit.module("can-query-logic with maybe type"); -QUnit.test("basics", function(){ +QUnit.test("basics", function(assert) { // Goal here is so the type doesn't have to know about `can-query-logic`, // but when passed to can-query-logic, it knows what to do. // @@ -36,7 +36,7 @@ QUnit.test("basics", function(){ {}, {filter: {age: {$gt: 5}}}); - QUnit.deepEqual(res.filter, + assert.deepEqual(res.filter, {$or: [ {age: {$lte: 5} }, {age: {$in: [undefined, null]}} @@ -46,7 +46,7 @@ QUnit.test("basics", function(){ var query = todoQueryLogic.hydrate({filter: {age: 21}}); var serialized = todoQueryLogic.serialize(query); - QUnit.deepEqual( serialized, {filter: {age: 21}}, "can serialize back to what was provided" ); + assert.deepEqual( serialized, {filter: {age: 21}}, "can serialize back to what was provided" ); res = todoQueryLogic.difference({},{ filter: { @@ -57,7 +57,7 @@ QUnit.test("basics", function(){ } }); - QUnit.deepEqual(res.filter, + assert.deepEqual(res.filter, {$or: [ {age: {$gte: 7} }, {age: {$lte: 3} }, @@ -70,12 +70,12 @@ QUnit.test("basics", function(){ {filter: {age: "07"}} ); - QUnit.deepEqual(unionized, {filter: {age: 7}}, "string numbers are converted to numbers"); + assert.deepEqual(unionized, {filter: {age: 7}}, "string numbers are converted to numbers"); }); -QUnit.test("MaybeDate", function(){ +QUnit.test("MaybeDate", function(assert) { // Goal here is so the type doesn't have to know about `can-query-logic`, // but when passed to can-query-logic, it knows what to do. function toDate(str) { @@ -130,7 +130,7 @@ QUnit.test("MaybeDate", function(){ {}, {filter: {due: {$gt: date1982_10_20}}}); - QUnit.deepEqual(res.filter, + assert.deepEqual(res.filter, {$or: [ {due: {$lte: date1982_10_20} }, {due: {$in: [undefined, null]}} @@ -139,32 +139,32 @@ QUnit.test("MaybeDate", function(){ var gt1982 = {filter: {due: {$gt: date1982_10_20}}}; - QUnit.ok( todoQueryLogic.isMember(gt1982,{ + assert.ok( todoQueryLogic.isMember(gt1982,{ id: 0, due: new Date(2000,0,1) }), "works with a date object"); - QUnit.ok( todoQueryLogic.isMember(gt1982,{ + assert.ok( todoQueryLogic.isMember(gt1982,{ id: 0, due: new Date(2000,0,1).toString() }), "works with a string date"); - QUnit.ok( todoQueryLogic.isMember(gt1982,{ + assert.ok( todoQueryLogic.isMember(gt1982,{ id: 0, due: new Date(2000,0,1).getTime() }), "works with a integer date"); - QUnit.notOk( todoQueryLogic.isMember(gt1982,{ + assert.notOk( todoQueryLogic.isMember(gt1982,{ id: 0, due: new Date(1970,0,1).getTime() }), "doesn't fail if falsey"); - QUnit.notOk( todoQueryLogic.isMember(gt1982,{ + assert.notOk( todoQueryLogic.isMember(gt1982,{ id: 0, due: null }), "doesn't fail if falsey"); - QUnit.ok( todoQueryLogic.isMember({filter: {due: {$in: [null,undefined]}}},{ + assert.ok( todoQueryLogic.isMember({filter: {due: {$in: [null,undefined]}}},{ id: 0, due: null }), "works if using in");*/ @@ -192,7 +192,7 @@ QUnit.test("MaybeDate", function(){ sort: "due" }, store); - QUnit.deepEqual(results, [ + assert.deepEqual(results, [ { id: 1, due: null diff --git a/test/special-comparison-logic-test.js b/test/special-comparison-logic-test.js index 0a2715c..e45df48 100644 --- a/test/special-comparison-logic-test.js +++ b/test/special-comparison-logic-test.js @@ -5,7 +5,7 @@ var canSymbol = require("can-symbol"); QUnit.module("can-query-logic special comparison logic"); -QUnit.test("where to filter", function(){ +QUnit.test("where to filter", function(assert) { var todoQueryLogic = new QueryLogic({}, { toQuery: function(params){ @@ -30,7 +30,7 @@ QUnit.test("where to filter", function(){ var q3 = todoQueryLogic.intersection(q1,q2); - QUnit.deepEqual(q3,{ + assert.deepEqual(q3,{ where: {first: "FIRST", second: "SECOND"} }, "got intersection"); }); @@ -39,7 +39,7 @@ var stringIncludes = function(strA, strB) { return strA.indexOf(strB) >= 0; }; -QUnit.test("Searchable string", function(){ +QUnit.test("Searchable string", function(assert) { // Create a set type that is used to do comparisons. function SearchableStringSet(value) { this.value = value; @@ -119,7 +119,7 @@ QUnit.test("Searchable string", function(){ filter: {name: "eat"} }); - QUnit.equal(res, true, "is subset"); + assert.equal(res, true, "is subset"); res = todoQueryLogic.isSubset({ filter: {name: "eat"} @@ -127,13 +127,13 @@ QUnit.test("Searchable string", function(){ filter: {name: "beat"} }); - QUnit.equal(res, false, "not subset"); + assert.equal(res, false, "not subset"); var hydrated = todoQueryLogic.hydrate({ filter: {name: "eat"} }); - QUnit.deepEqual(hydrated.filter, new QueryLogic.KeysAnd({ + assert.deepEqual(hydrated.filter, new QueryLogic.KeysAnd({ name: new SearchableStringSet("eat") }), "hydrated right"); @@ -143,19 +143,19 @@ QUnit.test("Searchable string", function(){ filter: {name: "foo"} }); - QUnit.deepEqual(res, { + assert.deepEqual(res, { filter: { name: ["eat","foo"] } }); - QUnit.ok( + assert.ok( todoQueryLogic.isMember({ filter: {name: "eat"} },{id: 1, name: "eat beans"}), "isMember true"); - QUnit.notOk( + assert.notOk( todoQueryLogic.isMember({ filter: {name: "eat"} },{id: 1, name: "foo bar"}), @@ -163,7 +163,7 @@ QUnit.test("Searchable string", function(){ }); -QUnit.test("value type", function(){ +QUnit.test("value type", function(assert) { @@ -219,7 +219,7 @@ QUnit.test("value type", function(){ {id: 4, date: new Date(1984,9,20).toString()}, ]); - QUnit.deepEqual( + assert.deepEqual( result.map(function(item){ return item.id;}), [3,4], "filtered correctly"); @@ -231,7 +231,7 @@ QUnit.test("value type", function(){ filter: {date: [date90s.toString()]} }); - QUnit.deepEqual(union, + assert.deepEqual(union, { filter: {date: {$in: [oct20_1982.toString(), date90s.toString()]}} }, @@ -248,7 +248,7 @@ QUnit.test("value type", function(){ ]); var ids = result.map(function(item){ return item.id}); - QUnit.deepEqual(ids,[1,2,3,4], "sorted correctly"); + assert.deepEqual(ids,[1,2,3,4], "sorted correctly"); var index = queryLogic.index({ sort: "date" @@ -261,10 +261,10 @@ QUnit.test("value type", function(){ ], {id: 4, date: new Date(2018,4,24).toString()}); //F - QUnit.equal(index, 4, "added at the end") + assert.equal(index, 4, "added at the end") }); -QUnit.test("sort a type that is similar to the member values (#31)", function(){ +QUnit.test("sort a type that is similar to the member values (#31)", function(assert) { function StringIgnoreCaseSet(value){ this.value = value; } @@ -296,7 +296,7 @@ QUnit.test("sort a type that is similar to the member values (#31)", function(){ {id: 2, name: "finish these docs"}, {id: 3, name: "Learn CanJS"}] ); - QUnit.deepEqual([ + assert.deepEqual([ {id: 2, name: "finish these docs"}, {id: 1, name: "grab coffee"}, {id: 3, name: "Learn CanJS"}