diff --git a/packages/frint-data/src/Types.spec.js b/packages/frint-data/src/Types.spec.js index ad8351bd..2e203f43 100644 --- a/packages/frint-data/src/Types.spec.js +++ b/packages/frint-data/src/Types.spec.js @@ -11,10 +11,10 @@ describe('frint-data › Types', function () { it('accepts any values', function () { const type = Types.any; - expect(type(1)).to.eql(1); - expect(type('hello')).to.eql('hello'); - expect(type([])).to.eql([]); - expect(type({})).to.eql({}); + expect(type(1)).to.equal(1); + expect(type('hello')).to.equal('hello'); + expect(type([])).to.deep.equal([]); + expect(type({})).to.deep.equal({}); }); it('checks for required values', function () { @@ -26,8 +26,8 @@ describe('frint-data › Types', function () { it('allows empty values when default is set', function () { const type = Types.any.defaults(123); - expect(type()).to.eql(123); - expect(type(234)).to.eql(234); + expect(type()).to.equal(123); + expect(type(234)).to.equal(234); }); }); @@ -42,8 +42,8 @@ describe('frint-data › Types', function () { it('accepts array values', function () { const type = Types.array; - expect(type([])).to.eql([]); - expect(type([1, 2, 3])).to.eql([1, 2, 3]); + expect(type([])).to.deep.equal([]); + expect(type([1, 2, 3])).to.deep.equal([1, 2, 3]); }); it('rejects non-array values', function () { @@ -65,8 +65,8 @@ describe('frint-data › Types', function () { it('allows empty values when default is set', function () { const type = Types.array.defaults(['hi', 'there']); - expect(type()).to.eql(['hi', 'there']); - expect(type([1, 2, 3])).to.eql([1, 2, 3]); + expect(type()).to.deep.equal(['hi', 'there']); + expect(type([1, 2, 3])).to.deep.equal([1, 2, 3]); expect(() => type(123)).to.throw(/value is not an array/); }); }); @@ -82,8 +82,8 @@ describe('frint-data › Types', function () { it('accepts boolean values', function () { const type = Types.bool; - expect(type(true)).to.eql(true); - expect(type(false)).to.eql(false); + expect(type(true)).to.equal(true); + expect(type(false)).to.equal(false); }); it('rejects non-boolean values', function () { @@ -104,7 +104,7 @@ describe('frint-data › Types', function () { it('allows empty values when default is set', function () { const type = Types.bool.defaults(true); - expect(type()).to.eql(true); + expect(type()).to.equal(true); expect(() => type(123)).to.throw(/value is not a boolean/); }); }); @@ -131,7 +131,7 @@ describe('frint-data › Types', function () { const people = new People([{ name: 'Frint' }]); - expect(type(people)).to.eql(people); + expect(type(people)).to.equal(people); }); it('rejects non-collection values', function () { @@ -163,10 +163,10 @@ describe('frint-data › Types', function () { const people = new People([{ name: 'Frint' }]); const type = Types.collection.defaults(people); - expect(type()).to.eql(people); + expect(type()).to.equal(people); const otherPeople = new People([{ name: 'Dark Lord' }]); - expect(type(otherPeople)).to.eql(otherPeople); + expect(type(otherPeople)).to.equal(otherPeople); expect(() => type('hello world')).to.throw(/value is not a Collection/); }); @@ -183,7 +183,7 @@ describe('frint-data › Types', function () { const type = Types.collection.of(People); const people = new People([{ name: 'Frint' }]); - expect(type(people)).to.eql(people); + expect(type(people)).to.equal(people); expect(type([{ name: 'Name here' }])).to.be.instanceof(People); const Post = createModel({ @@ -211,9 +211,9 @@ describe('frint-data › Types', function () { it('accepts enum values', function () { const type = Types.enum([1, 2, 3]); - expect(type(1)).to.eql(1); - expect(type(2)).to.eql(2); - expect(type(3)).to.eql(3); + expect(type(1)).to.equal(1); + expect(type(2)).to.equal(2); + expect(type(3)).to.equal(3); }); it('rejects non-enum values', function () { @@ -230,14 +230,14 @@ describe('frint-data › Types', function () { const type = Types.enum([1, 2, 3]).isRequired; expect(() => type()).to.throw(/value is not defined/); - expect(type(1)).to.eql(1); + expect(type(1)).to.equal(1); }); it('allows empty values when default is set', function () { const type = Types.enum([1, 2, 3]).defaults(2); - expect(type()).to.eql(2); - expect(type(3)).to.eql(3); + expect(type()).to.equal(2); + expect(type(3)).to.equal(3); expect(() => type('hello world')).to.throw(/value is none of the provided enums/); }); @@ -247,9 +247,9 @@ describe('frint-data › Types', function () { Types.number ]).isRequired; - expect(type(1)).to.eql(1); - expect(type(2)).to.eql(2); - expect(type('hi')).to.eql('hi'); + expect(type(1)).to.equal(1); + expect(type(2)).to.equal(2); + expect(type('hi')).to.equal('hi'); expect(() => type({})).to.throw('value is none of the provided enum types'); }); }); @@ -266,7 +266,7 @@ describe('frint-data › Types', function () { const type = Types.func; const fn = () => {}; - expect(type(fn)).to.eql(fn); + expect(type(fn)).to.equal(fn); }); it('rejects non-function values', function () { @@ -289,7 +289,7 @@ describe('frint-data › Types', function () { const defaultFunc = () => {}; const type = Types.func.defaults(defaultFunc); - expect(type()).to.eql(defaultFunc); + expect(type()).to.equal(defaultFunc); expect(() => type(123)).to.throw(/value is not a function/); }); }); @@ -312,7 +312,7 @@ describe('frint-data › Types', function () { const person = new Person({ name: 'Frint' }); - expect(type(person)).to.eql(person); + expect(type(person)).to.equal(person); }); it('rejects non-model values', function () { @@ -341,10 +341,10 @@ describe('frint-data › Types', function () { const person = new Person({ name: 'Frint' }); const type = Types.model.defaults(person); - expect(type()).to.eql(person); + expect(type()).to.equal(person); const anotherPerson = new Person({ name: 'Dark Lord' }); - expect(type(anotherPerson)).to.eql(anotherPerson); + expect(type(anotherPerson)).to.equal(anotherPerson); expect(() => type('hello world')).to.throw(/value is not a Model/); }); @@ -363,7 +363,7 @@ describe('frint-data › Types', function () { const type = Types.model.of(Person); const person = new Person({ name: 'Frint' }); - expect(type(person)).to.eql(person); + expect(type(person)).to.equal(person); expect(type({ name: 'Name here' })).to.be.instanceof(Person); const post = new Post({ title: 'Hello World' }); @@ -382,8 +382,8 @@ describe('frint-data › Types', function () { it('accepts number values', function () { const type = Types.number; - expect(type(123)).to.eql(123); - expect(type(0)).to.eql(0); + expect(type(123)).to.equal(123); + expect(type(0)).to.equal(0); }); it('rejects non-number values', function () { @@ -404,8 +404,8 @@ describe('frint-data › Types', function () { it('allows empty values when default is set', function () { const type = Types.number.defaults(123); - expect(type()).to.eql(123); - expect(type(345)).to.eql(345); + expect(type()).to.equal(123); + expect(type(345)).to.equal(345); expect(() => type('hello world')).to.throw(/value is not a number/); }); }); @@ -421,8 +421,8 @@ describe('frint-data › Types', function () { it('accepts object values', function () { const type = Types.object; - expect(type({})).to.eql({}); - expect(type({ a: 1, b: 2 })).to.eql({ a: 1, b: 2 }); + expect(type({})).to.deep.equal({}); + expect(type({ a: 1, b: 2 })).to.deep.equal({ a: 1, b: 2 }); }); it('rejects non-object values', function () { @@ -444,8 +444,8 @@ describe('frint-data › Types', function () { it('allows empty values when default is set', function () { const type = Types.object.defaults({ hi: 'there' }); - expect(type()).to.eql({ hi: 'there' }); - expect(type({ hello: 'world' })).to.eql({ hello: 'world' }); + expect(type()).to.deep.equal({ hi: 'there' }); + expect(type({ hello: 'world' })).to.deep.equal({ hello: 'world' }); expect(() => type(123)).to.throw(/value is not an object/); }); @@ -461,7 +461,7 @@ describe('frint-data › Types', function () { street: 'Amsterdam', city: 'Amsterdam', postalCode: 123 - })).to.eql({ + })).to.deep.equal({ street: 'Amsterdam', city: 'Amsterdam', postalCode: 123, @@ -493,7 +493,7 @@ describe('frint-data › Types', function () { city: 'Amsterdam', postalCode: 123 } - })).to.eql({ + })).to.deep.equal({ name: 'Frint', address: { street: 'Amsterdam', @@ -525,9 +525,9 @@ describe('frint-data › Types', function () { it('accepts string values', function () { const type = Types.string; - expect(type('hello')).to.eql('hello'); - expect(type('hello world')).to.eql('hello world'); - expect(type('')).to.eql(''); + expect(type('hello')).to.equal('hello'); + expect(type('hello world')).to.equal('hello world'); + expect(type('')).to.equal(''); }); it('rejects non-string values', function () { @@ -548,8 +548,8 @@ describe('frint-data › Types', function () { it('allows empty values when default is set', function () { const type = Types.string.defaults('hello'); - expect(type()).to.eql('hello'); - expect(type('something')).to.eql('something'); + expect(type()).to.equal('hello'); + expect(type('something')).to.equal('something'); expect(() => type(123)).to.throw(/value is not a string/); }); }); @@ -565,8 +565,8 @@ describe('frint-data › Types', function () { it('accepts UUIDs values', function () { const type = Types.uuid; - expect(type('27961a0e-f4e8-4eb3-bf95-c5203e1d87b9')).to.eql('27961a0e-f4e8-4eb3-bf95-c5203e1d87b9'); - expect(type('90691cbc-b5ea-5826-ae98-951e30fc3b2d')).to.eql('90691cbc-b5ea-5826-ae98-951e30fc3b2d'); + expect(type('27961a0e-f4e8-4eb3-bf95-c5203e1d87b9')).to.equal('27961a0e-f4e8-4eb3-bf95-c5203e1d87b9'); + expect(type('90691cbc-b5ea-5826-ae98-951e30fc3b2d')).to.equal('90691cbc-b5ea-5826-ae98-951e30fc3b2d'); }); it('rejects non-UUID values', function () { @@ -587,8 +587,8 @@ describe('frint-data › Types', function () { it('allows empty values when default is set', function () { const type = Types.uuid.defaults('90691cbc-b5ea-5826-ae98-951e30fc3b2d'); - expect(type()).to.eql('90691cbc-b5ea-5826-ae98-951e30fc3b2d'); - expect(type('27961a0e-f4e8-4eb3-bf95-c5203e1d87b9')).to.eql('27961a0e-f4e8-4eb3-bf95-c5203e1d87b9'); + expect(type()).to.equal('90691cbc-b5ea-5826-ae98-951e30fc3b2d'); + expect(type('27961a0e-f4e8-4eb3-bf95-c5203e1d87b9')).to.equal('27961a0e-f4e8-4eb3-bf95-c5203e1d87b9'); expect(() => type('hello world')).to.throw(/value is not a valid UUID/); }); }); diff --git a/packages/frint-data/src/createCollection.spec.js b/packages/frint-data/src/createCollection.spec.js index 8ab31207..27e4cd26 100644 --- a/packages/frint-data/src/createCollection.spec.js +++ b/packages/frint-data/src/createCollection.spec.js @@ -41,19 +41,19 @@ describe('frint-data › createCollection', function () { ]); expect(people).to.be.instanceof(People); - expect(isCollection(people)).to.eql(true); + expect(isCollection(people)).to.equal(true); // first - expect(isModel(people.at(0))).to.eql(true); - expect(people.at(0).name).to.eql('Harry'); + expect(isModel(people.at(0))).to.equal(true); + expect(people.at(0).name).to.equal('Harry'); // second - expect(isModel(people.at(1))).to.eql(true); - expect(people.at(1).name).to.eql('Hermione'); + expect(isModel(people.at(1))).to.equal(true); + expect(people.at(1).name).to.equal('Hermione'); // third - expect(isModel(people.at(2))).to.eql(true); - expect(people.at(2).name).to.eql('Ron'); + expect(isModel(people.at(2))).to.equal(true); + expect(people.at(2).name).to.equal('Ron'); }); it('checks with multiple collection instances', function () { @@ -78,13 +78,13 @@ describe('frint-data › createCollection', function () { { name: 'C' } ]); - expect(people1.at(0).name).to.eql('Harry'); - expect(people1.at(1).name).to.eql('Hermione'); - expect(people1.at(2).name).to.eql('Ron'); + expect(people1.at(0).name).to.equal('Harry'); + expect(people1.at(1).name).to.equal('Hermione'); + expect(people1.at(2).name).to.equal('Ron'); - expect(people2.at(0).name).to.eql('A'); - expect(people2.at(1).name).to.eql('B'); - expect(people2.at(2).name).to.eql('C'); + expect(people2.at(0).name).to.equal('A'); + expect(people2.at(1).name).to.equal('B'); + expect(people2.at(2).name).to.equal('C'); }); it('creates collection with methods', function () { @@ -107,7 +107,7 @@ describe('frint-data › createCollection', function () { ]); expect(people.findAt).to.be.a('function'); - expect(people.findAt(1).name).to.eql('Blah'); + expect(people.findAt(1).name).to.equal('Blah'); }); it('throws error on conflicting method', function () { @@ -220,9 +220,9 @@ describe('frint-data › createCollection', function () { .take(1) .last() .subscribe(function ({ collection }) { - expect(collection.length).to.eql(2); - expect(collection.at(0).name).to.eql('Harry'); - expect(collection.at(1).name).to.eql('Ron'); + expect(collection.length).to.equal(2); + expect(collection.at(0).name).to.equal('Harry'); + expect(collection.at(1).name).to.equal('Ron'); done(); }); @@ -249,7 +249,7 @@ describe('frint-data › createCollection', function () { const people = new People(); - expect(people.at(0).name).to.eql('Initialize'); + expect(people.at(0).name).to.equal('Initialize'); }); describe('Collection :: at()', function () { @@ -269,9 +269,9 @@ describe('frint-data › createCollection', function () { { name: 'Ron' } ]); - expect(people.at(0).name).to.eql('Harry'); - expect(people.at(1).name).to.eql('Hermione'); - expect(people.at(2).name).to.eql('Ron'); + expect(people.at(0).name).to.equal('Harry'); + expect(people.at(1).name).to.equal('Hermione'); + expect(people.at(2).name).to.equal('Ron'); people.at$(1) .subscribe(function (model) { @@ -303,16 +303,16 @@ describe('frint-data › createCollection', function () { return person.name.startsWith('H'); }); - expect(modelsWithH.length).to.eql(2); - expect(modelsWithH[0].name).to.eql('Harry'); - expect(modelsWithH[1].name).to.eql('Hermione'); + expect(modelsWithH.length).to.equal(2); + expect(modelsWithH[0].name).to.equal('Harry'); + expect(modelsWithH[1].name).to.equal('Hermione'); people .filter$(p => p.name.startsWith('H')) .subscribe(function (models) { expect(models.length).to.equal(2); - expect(models[0].name).to.eql('Harry'); - expect(models[1].name).to.eql('Hermione'); + expect(models[0].name).to.equal('Harry'); + expect(models[1].name).to.equal('Hermione'); done(); }); @@ -336,13 +336,13 @@ describe('frint-data › createCollection', function () { { name: 'Ron' } ]); - expect(people.length).to.eql(3); + expect(people.length).to.equal(3); const hermione = people.find(function (person) { return person.name === 'Hermione'; }); - expect(hermione.name).to.eql('Hermione'); + expect(hermione.name).to.equal('Hermione'); people .find$(p => p.name === 'Hermione') @@ -371,12 +371,12 @@ describe('frint-data › createCollection', function () { { name: 'Ron' } ]); - expect(people.length).to.eql(3); + expect(people.length).to.equal(3); const hermione = people.at(1); const index = people.findIndex(hermione); - expect(index).to.eql(1); + expect(index).to.equal(1); people .findIndex$(hermione) @@ -410,7 +410,7 @@ describe('frint-data › createCollection', function () { names.push(person.name); }); - expect(names).to.eql([ + expect(names).to.deep.equal([ 'Harry', 'Hermione', 'Ron' @@ -439,7 +439,7 @@ describe('frint-data › createCollection', function () { return person.name; }); - expect(names).to.eql([ + expect(names).to.deep.equal([ 'Harry', 'Hermione', 'Ron' @@ -464,17 +464,17 @@ describe('frint-data › createCollection', function () { { name: 'Ron' } ]); - expect(people.length).to.eql(3); + expect(people.length).to.equal(3); const lastModel = people.pop(); - expect(people.length).to.eql(2); + expect(people.length).to.equal(2); - expect(people.toJS()).to.eql([ + expect(people.toJS()).to.deep.equal([ { name: 'Harry' }, { name: 'Hermione' } ]); - expect(lastModel.name).to.eql('Ron'); + expect(lastModel.name).to.equal('Ron'); }); }); @@ -495,9 +495,9 @@ describe('frint-data › createCollection', function () { people.push(new Person({ name: 'Hermione' })); people.push(new Person({ name: 'Ron' })); - expect(people.at(0).name).to.eql('Harry'); - expect(people.at(1).name).to.eql('Hermione'); - expect(people.at(2).name).to.eql('Ron'); + expect(people.at(0).name).to.equal('Harry'); + expect(people.at(1).name).to.equal('Hermione'); + expect(people.at(2).name).to.equal('Ron'); }); }); @@ -522,7 +522,7 @@ describe('frint-data › createCollection', function () { return result + model.age; }, 0); - expect(totalAge).to.eql(10 + 20 + 30); + expect(totalAge).to.equal(10 + 20 + 30); }); }); @@ -543,14 +543,14 @@ describe('frint-data › createCollection', function () { { name: 'Ron' } ]); - expect(people.length).to.eql(3); + expect(people.length).to.equal(3); const hermione = people.at(1); people.remove(hermione); - expect(people.length).to.eql(2); + expect(people.length).to.equal(2); - expect(people.toJS()).to.eql([ + expect(people.toJS()).to.deep.equal([ { name: 'Harry' }, { name: 'Ron' } ]); @@ -574,13 +574,13 @@ describe('frint-data › createCollection', function () { { name: 'Ron' } ]); - expect(people.length).to.eql(3); + expect(people.length).to.equal(3); people.removeFrom(0); - expect(people.length).to.eql(2); + expect(people.length).to.equal(2); - expect(people.toJS()).to.eql([ + expect(people.toJS()).to.deep.equal([ { name: 'Hermione' }, { name: 'Ron' } ]); @@ -604,17 +604,17 @@ describe('frint-data › createCollection', function () { { name: 'Ron' } ]); - expect(people.length).to.eql(3); + expect(people.length).to.equal(3); const firstModel = people.shift(); - expect(people.length).to.eql(2); + expect(people.length).to.equal(2); - expect(people.toJS()).to.eql([ + expect(people.toJS()).to.deep.equal([ { name: 'Hermione' }, { name: 'Ron' } ]); - expect(firstModel.name).to.eql('Harry'); + expect(firstModel.name).to.equal('Harry'); }); }); @@ -635,11 +635,11 @@ describe('frint-data › createCollection', function () { { name: 'Ron' } ]); - expect(isModel(people.at(0))).to.eql(true); - expect(isModel(people.at(1))).to.eql(true); - expect(isModel(people.at(2))).to.eql(true); + expect(isModel(people.at(0))).to.equal(true); + expect(isModel(people.at(1))).to.equal(true); + expect(isModel(people.at(2))).to.equal(true); - expect(people.toJS()).to.eql([ + expect(people.toJS()).to.deep.equal([ { name: 'Harry' }, { name: 'Hermione' }, { name: 'Ron' } @@ -665,9 +665,9 @@ describe('frint-data › createCollection', function () { people.unshift(new Person({ name: 'Ron' })); - expect(people.at(0).name).to.eql('Ron'); - expect(people.at(1).name).to.eql('Harry'); - expect(people.at(2).name).to.eql('Hermione'); + expect(people.at(0).name).to.equal('Ron'); + expect(people.at(1).name).to.equal('Harry'); + expect(people.at(2).name).to.equal('Hermione'); }); }); }); diff --git a/packages/frint-data/src/createModel.spec.js b/packages/frint-data/src/createModel.spec.js index a7845a0d..0aa1bf57 100644 --- a/packages/frint-data/src/createModel.spec.js +++ b/packages/frint-data/src/createModel.spec.js @@ -30,8 +30,8 @@ describe('frint-data › createModel', function () { }); expect(model).to.be.instanceof(Model); - expect(model.name).to.eql('Frint'); - expect(model.language).to.eql('English'); + expect(model.name).to.equal('Frint'); + expect(model.language).to.equal('English'); }); it('disables instance property mutations', function () { @@ -47,9 +47,9 @@ describe('frint-data › createModel', function () { }); expect(model).to.be.instanceof(Model); - expect(model.name).to.eql('Frint'); + expect(model.name).to.equal('Frint'); - expect(model.name).to.eql('Frint'); + expect(model.name).to.equal('Frint'); }); it('makes only attributes enumerable', function () { @@ -64,7 +64,7 @@ describe('frint-data › createModel', function () { name: 'Frint' }); - expect(Object.keys(model)).to.eql(['name', 'language']); + expect(Object.keys(model)).to.deep.equal(['name', 'language']); }); it('creates Model class with nested types', function () { @@ -87,17 +87,17 @@ describe('frint-data › createModel', function () { }); expect(model).to.be.instanceof(Model); - expect(model.name).to.eql('Frint'); - expect(model.address.street).to.eql('Straat'); - expect(model.address.city).to.eql('Amsterdam'); - expect(model.address).to.eql({ + expect(model.name).to.equal('Frint'); + expect(model.address.street).to.equal('Straat'); + expect(model.address.city).to.equal('Amsterdam'); + expect(model.address).to.deep.equal({ street: 'Straat', city: 'Amsterdam' }); - expect(model.address.street).to.eql('Straat'); + expect(model.address.street).to.equal('Straat'); - expect(model.address).to.eql({ + expect(model.address).to.deep.equal({ street: 'Straat', city: 'Amsterdam' }); @@ -121,13 +121,13 @@ describe('frint-data › createModel', function () { }); expect(model).to.be.instanceof(Model); - expect(model.name).to.eql('Frint'); + expect(model.name).to.equal('Frint'); expect(model.setName).to.be.a('function'); - expect(model.getName()).to.eql('Frint'); + expect(model.getName()).to.equal('Frint'); model.setName('Heylaal'); - expect(model.name).to.eql('Heylaal'); + expect(model.name).to.equal('Heylaal'); }); it('allows methods to call other methods', function () { @@ -168,23 +168,23 @@ describe('frint-data › createModel', function () { }); expect(model).to.be.instanceof(Model); - expect(model.firstName).to.eql('Frint'); - expect(model.lastName).to.eql('Heylaal'); + expect(model.firstName).to.equal('Frint'); + expect(model.lastName).to.equal('Heylaal'); expect(model.getFirstName).to.be.a('function'); - expect(model.getFirstName()).to.eql('Frint'); + expect(model.getFirstName()).to.equal('Frint'); expect(model.getLastName).to.be.a('function'); - expect(model.getLastName()).to.eql('Heylaal'); + expect(model.getLastName()).to.equal('Heylaal'); - expect(model.getFullName()).to.eql('Frint Heylaal'); + expect(model.getFullName()).to.equal('Frint Heylaal'); model.setFirstName('John'); model.setLastName('Smith'); - expect(model.getFullName()).to.eql('John Smith'); + expect(model.getFullName()).to.equal('John Smith'); model.setFullName('Foo', 'Bar'); - expect(model.getFullName()).to.eql('Foo Bar'); + expect(model.getFullName()).to.equal('Foo Bar'); }); it('throws error when method name conflicts', function () { @@ -267,11 +267,11 @@ describe('frint-data › createModel', function () { expect(person).to.be.instanceof(Person); expect(person.address).to.be.instanceof(Address); - expect(isModel(person.address)).to.eql(true); + expect(isModel(person.address)).to.equal(true); - expect(person.name).to.eql('Frint'); - expect(person.address.street).to.eql('Straat'); - expect(person.address.country).to.eql('Netherlands'); + expect(person.name).to.equal('Frint'); + expect(person.address.street).to.equal('Straat'); + expect(person.address.country).to.equal('Netherlands'); }); it('checks for types on re-assignments', function () { @@ -288,17 +288,17 @@ describe('frint-data › createModel', function () { name: 'Frint' }); - expect(person.name).to.eql('Frint'); + expect(person.name).to.equal('Frint'); person.setName('Frint [updated]'); - expect(person.name).to.eql('Frint [updated]'); + expect(person.name).to.equal('Frint [updated]'); function changeName() { person.setName(123); } expect(changeName).to.throw(/value is not a string/); - expect(person.name).to.eql('Frint [updated]'); + expect(person.name).to.equal('Frint [updated]'); }); it('checks with multiple model instances', function () { @@ -312,9 +312,9 @@ describe('frint-data › createModel', function () { const hermione = new Person({ name: 'Hermione' }); const ron = new Person({ name: 'Ron' }); - expect(harry.name).to.eql('Harry'); - expect(hermione.name).to.eql('Hermione'); - expect(ron.name).to.eql('Ron'); + expect(harry.name).to.equal('Harry'); + expect(hermione.name).to.equal('Hermione'); + expect(ron.name).to.equal('Ron'); }); it('sets falsy values', function () { @@ -339,7 +339,7 @@ describe('frint-data › createModel', function () { counter.decrement(); counter.decrement(); - expect(counter.value).to.eql(-1); + expect(counter.value).to.equal(-1); }); it('embeds collections', function () { @@ -372,23 +372,23 @@ describe('frint-data › createModel', function () { ] }); - expect(author.name).to.eql('Frint'); - expect(isCollection(author.posts)).to.eql(true); + expect(author.name).to.equal('Frint'); + expect(isCollection(author.posts)).to.equal(true); expect(isModel(author.posts.at(0))); - expect(author.posts.at(0).title).to.eql('Hello World'); + expect(author.posts.at(0).title).to.equal('Hello World'); expect(isModel(author.posts.at(1))); - expect(author.posts.at(1).title).to.eql('About'); + expect(author.posts.at(1).title).to.equal('About'); expect(isModel(author.posts.at(2))); - expect(author.posts.at(2).title).to.eql('Contact'); + expect(author.posts.at(2).title).to.equal('Contact'); const about = author.posts.at(1); about.setTitle('About Us'); - expect(about.title).to.eql('About Us'); - expect(author.posts.at(1).title).to.eql('About Us'); + expect(about.title).to.equal('About Us'); + expect(author.posts.at(1).title).to.equal('About Us'); }); it('listens for self assignments', function (done) { @@ -517,9 +517,9 @@ describe('frint-data › createModel', function () { const book = new Book({ title: 'Prisoner of Azkaban' }); book._on('change', function (event) { - expect(isEvent(event)).to.eql(true); - expect(event.path).to.eql(['title']); - expect(book.title).to.eql('Harry Potter and The Prisoner of Azkaban'); + expect(isEvent(event)).to.equal(true); + expect(event.path).to.deep.equal(['title']); + expect(book.title).to.equal('Harry Potter and The Prisoner of Azkaban'); done(); }); @@ -555,10 +555,10 @@ describe('frint-data › createModel', function () { person.listen$('change') .subscribe(function ({ model, event }) { - expect(isEvent(event)).to.eql(true); - expect(event.path).to.eql(['address', 'street']); - expect(model.address.street).to.eql('4 Privet Drive'); - expect(model.getIn(event.path)).to.eql('4 Privet Drive'); + expect(isEvent(event)).to.equal(true); + expect(event.path).to.deep.equal(['address', 'street']); + expect(model.address.street).to.equal('4 Privet Drive'); + expect(model.getIn(event.path)).to.equal('4 Privet Drive'); done(); }); @@ -597,10 +597,10 @@ describe('frint-data › createModel', function () { // first change const firstSubscription = author.listen$('change') .subscribe(function ({ model, event }) { - expect(isEvent(event)).to.eql(true); - expect(event.path).to.eql(['books', 0, 'title']); - expect(model.books.at(0).title).to.eql('The Life and Lies of Albus Dumbledore'); - expect(model.getIn(event.path)).to.eql('The Life and Lies of Albus Dumbledore'); + expect(isEvent(event)).to.equal(true); + expect(event.path).to.deep.equal(['books', 0, 'title']); + expect(model.books.at(0).title).to.equal('The Life and Lies of Albus Dumbledore'); + expect(model.getIn(event.path)).to.equal('The Life and Lies of Albus Dumbledore'); firstSubscription.unsubscribe(); }); @@ -610,10 +610,10 @@ describe('frint-data › createModel', function () { // second change const secondSubscription = author.listen$('change') .subscribe(function ({ model, event }) { - expect(isEvent(event)).to.eql(true); - expect(event.path).to.eql(['books', 1]); - expect(model.books.at(1).title).to.eql(`Dumbledore's Army`); - expect(model.getIn(event.path)).to.eql(model.books.at(1)); + expect(isEvent(event)).to.equal(true); + expect(event.path).to.deep.equal(['books', 1]); + expect(model.books.at(1).title).to.equal(`Dumbledore's Army`); + expect(model.getIn(event.path)).to.equal(model.books.at(1)); secondSubscription.unsubscribe(); done(); @@ -641,7 +641,7 @@ describe('frint-data › createModel', function () { name: 'Initial name' }); - expect(person.name).to.eql('Updated by initialize'); + expect(person.name).to.equal('Updated by initialize'); }); describe('Model :: get()', function () { @@ -654,11 +654,11 @@ describe('frint-data › createModel', function () { const person = new Person({ name: 'Newt Scamander' }); - expect(person.get('name')).to.eql('Newt Scamander'); + expect(person.get('name')).to.equal('Newt Scamander'); person.get$('name') .subscribe(function (name) { - expect(name).to.eql('Newt Scamander'); + expect(name).to.equal('Newt Scamander'); done(); }); @@ -690,9 +690,9 @@ describe('frint-data › createModel', function () { } }); - expect(isModel(person.get('address'))).to.eql(true); - expect(person.get('address')).to.eql(person.address); - expect(person.get('address.city')).to.eql('Surrey'); + expect(isModel(person.get('address'))).to.equal(true); + expect(person.get('address')).to.equal(person.address); + expect(person.get('address.city')).to.equal('Surrey'); }); it('gets value by dot-separated path from child-collection', function () { @@ -724,11 +724,11 @@ describe('frint-data › createModel', function () { ] }); - expect(author.get('books')).to.eql(author.books); - expect(author.get('books.0')).to.eql(author.books.at(0)); - expect(author.get('books.0.title')).to.eql('The Life and Lies of Dumbledore'); - expect(author.get('books.1')).to.eql(author.books.at(1)); - expect(author.get('books.1.title')).to.eql(`Dumbledore's Army`); + expect(author.get('books')).to.equal(author.books); + expect(author.get('books.0')).to.equal(author.books.at(0)); + expect(author.get('books.0.title')).to.equal('The Life and Lies of Dumbledore'); + expect(author.get('books.1')).to.equal(author.books.at(1)); + expect(author.get('books.1.title')).to.equal(`Dumbledore's Army`); }); }); @@ -742,11 +742,11 @@ describe('frint-data › createModel', function () { const person = new Person({ name: 'Newt Scamander' }); - expect(person.getIn(['name'])).to.eql('Newt Scamander'); + expect(person.getIn(['name'])).to.equal('Newt Scamander'); person.getIn$(['name']) .subscribe(function (name) { - expect(name).to.eql('Newt Scamander'); + expect(name).to.equal('Newt Scamander'); done(); }); @@ -778,9 +778,9 @@ describe('frint-data › createModel', function () { } }); - expect(isModel(person.getIn(['address']))).to.eql(true); - expect(person.getIn(['address'])).to.eql(person.address); - expect(person.getIn(['address', 'city'])).to.eql('Surrey'); + expect(isModel(person.getIn(['address']))).to.equal(true); + expect(person.getIn(['address'])).to.equal(person.address); + expect(person.getIn(['address', 'city'])).to.equal('Surrey'); }); it('gets value by path from child-collection', function () { @@ -812,11 +812,11 @@ describe('frint-data › createModel', function () { ] }); - expect(author.getIn(['books'])).to.eql(author.books); - expect(author.getIn(['books', 0])).to.eql(author.books.at(0)); - expect(author.getIn(['books', 0, 'title'])).to.eql('The Life and Lies of Dumbledore'); - expect(author.getIn(['books', 1])).to.eql(author.books.at(1)); - expect(author.getIn(['books', 1, 'title'])).to.eql(`Dumbledore's Army`); + expect(author.getIn(['books'])).to.equal(author.books); + expect(author.getIn(['books', 0])).to.equal(author.books.at(0)); + expect(author.getIn(['books', 0, 'title'])).to.equal('The Life and Lies of Dumbledore'); + expect(author.getIn(['books', 1])).to.equal(author.books.at(1)); + expect(author.getIn(['books', 1, 'title'])).to.equal(`Dumbledore's Army`); }); }); @@ -831,7 +831,7 @@ describe('frint-data › createModel', function () { name: 'Blah' }); - expect(model.toJS()).to.eql({ name: 'Blah' }); + expect(model.toJS()).to.deep.equal({ name: 'Blah' }); model.toJS$() .subscribe(function (obj) { @@ -862,9 +862,9 @@ describe('frint-data › createModel', function () { } }); - expect(isModel(person.address)).to.eql(true); + expect(isModel(person.address)).to.equal(true); - expect(person.toJS()).to.eql({ + expect(person.toJS()).to.deep.equal({ name: 'Blah', address: { street: 'Straat' @@ -888,7 +888,7 @@ describe('frint-data › createModel', function () { todo.y = 'y'; - expect(todo.toJS()).to.eql({ + expect(todo.toJS()).to.deep.equal({ id: 1, title: 'My first todo' }); diff --git a/packages/frint-data/src/isCollection.spec.js b/packages/frint-data/src/isCollection.spec.js index a413a6a7..5f4138ef 100644 --- a/packages/frint-data/src/isCollection.spec.js +++ b/packages/frint-data/src/isCollection.spec.js @@ -20,14 +20,14 @@ describe('frint-data › isCollection', function () { const people = new People([]); - expect(isCollection(people)).to.eql(true); + expect(isCollection(people)).to.equal(true); }); it('returns false when object is NOT a collection', function () { - expect(isCollection(123)).to.eql(false); - expect(isCollection('hi')).to.eql(false); - expect(isCollection({})).to.eql(false); - expect(isCollection([])).to.eql(false); - expect(isCollection(() => {})).to.eql(false); + expect(isCollection(123)).to.equal(false); + expect(isCollection('hi')).to.equal(false); + expect(isCollection({})).to.equal(false); + expect(isCollection([])).to.equal(false); + expect(isCollection(() => {})).to.equal(false); }); }); diff --git a/packages/frint-data/src/isModel.spec.js b/packages/frint-data/src/isModel.spec.js index be609a49..cf50eeb5 100644 --- a/packages/frint-data/src/isModel.spec.js +++ b/packages/frint-data/src/isModel.spec.js @@ -15,12 +15,12 @@ describe('frint-data › isModel', function () { }); const model = new Person({ name: 'Frint' }); - expect(isModel(model)).to.eql(true); + expect(isModel(model)).to.equal(true); }); it('returns false when object is NOT a model', function () { - expect(isModel(123)).to.eql(false); - expect(isModel('hi')).to.eql(false); - expect(isModel(() => {})).to.eql(false); + expect(isModel(123)).to.equal(false); + expect(isModel('hi')).to.equal(false); + expect(isModel(() => {})).to.equal(false); }); });