Skip to content

Commit

Permalink
Replace assert.equal by assert.strictEqual
Browse files Browse the repository at this point in the history
  • Loading branch information
fsmanuel committed May 14, 2023
1 parent 5dd2400 commit c21d5c0
Show file tree
Hide file tree
Showing 11 changed files with 133 additions and 112 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ module('basic acceptance test', function(hooks) {

test('can visit /', async function(assert) {
await visit('/');
assert.equal(currentURL(), '/');
assert.strictEqual(currentURL(), '/');
});
});

Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/storage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
function storageEqual(assert, actual, expected, message) {
actual = actual ? JSON.parse(actual) : undefined;
assert.equal(actual, expected, message);
assert.strictEqual(actual, expected, message);
}

function storageDeepEqual(assert, actual, expected, message) {
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/array-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ module('array - likes', function (hooks) {
test('it has correct defaults', function (assert) {
assert.expect(3);

assert.equal(get(subject, 'anonymousLikes._storageType'), 'local');
assert.equal(
assert.strictEqual(get(subject, 'anonymousLikes._storageType'), 'local');
assert.strictEqual(
get(subject, 'anonymousLikes._storageKey'),
'storage:anonymous-likes'
);
Expand Down Expand Up @@ -129,7 +129,7 @@ module('array - likes', function (hooks) {
run(function () {
get(subject, 'postLikes').clear();
});
assert.equal(window.localStorage['storage:post-likes'], undefined);
assert.strictEqual(window.localStorage['storage:post-likes'], undefined);
});

test('after .clear() the array works as expected', function (assert) {
Expand All @@ -145,7 +145,7 @@ module('array - likes', function (hooks) {
run(function () {
get(subject, 'postLikes').clear();
});
assert.equal(window.localStorage['storage:post-likes'], undefined);
assert.strictEqual(window.localStorage['storage:post-likes'], undefined);

run(function () {
get(subject, 'postLikes').addObject('martin');
Expand Down
20 changes: 10 additions & 10 deletions tests/unit/helpers/import-export-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ module('Unit | Helpers | import/export', function (hooks) {
});
})
.then(function (data) {
assert.equal(get(data.posts, 'length'), 2);
assert.equal(get(data.comments, 'length'), 3);
assert.strictEqual(get(data.posts, 'length'), 2);
assert.strictEqual(get(data.comments, 'length'), 3);
});
});

Expand All @@ -60,8 +60,8 @@ module('Unit | Helpers | import/export', function (hooks) {
});
})
.then(function (data) {
assert.equal(get(data.posts, 'length'), 2);
assert.equal(get(data.comments, 'length'), 3);
assert.strictEqual(get(data.posts, 'length'), 2);
assert.strictEqual(get(data.comments, 'length'), 3);
});
});

Expand All @@ -84,13 +84,13 @@ module('Unit | Helpers | import/export', function (hooks) {
});
})
.then(function (data) {
assert.equal(get(data.posts, 'length'), 2);
assert.equal(get(data.comments, 'length'), 3);
assert.equal(
assert.strictEqual(get(data.posts, 'length'), 2);
assert.strictEqual(get(data.comments, 'length'), 3);
assert.strictEqual(
JSON.parse(window.localStorage['index-comments']).length,
3
);
assert.equal(
assert.strictEqual(
JSON.parse(window.sessionStorage['index-posts']).length,
2
);
Expand All @@ -117,7 +117,7 @@ module('Unit | Helpers | import/export', function (hooks) {
return exportData(store, ['posts', 'comments'], { json: false });
})
.then(function (data) {
assert.equal(data.data.length, 5);
assert.strictEqual(data.data.length, 5);
});
});

Expand All @@ -142,7 +142,7 @@ module('Unit | Helpers | import/export', function (hooks) {
return exportData(store, ['posts', 'comments'], { json: false });
})
.then(function (data) {
assert.equal(data.data.length, 5);
assert.strictEqual(data.data.length, 5);
});
});
});
25 changes: 14 additions & 11 deletions tests/unit/models/blog/post-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module('Unit | Model | blog/post', function (hooks) {

let posts = store.findAll('blog/post');

assert.equal(get(posts, 'length'), 0);
assert.strictEqual(get(posts, 'length'), 0);

run(function () {
store.createRecord('blog/post', { name: 'Super Name' }).save();
Expand All @@ -27,7 +27,7 @@ module('Unit | Model | blog/post', function (hooks) {
});

store.findAll('blog/post').then(function (posts) {
assert.equal(get(posts, 'length'), 3);
assert.strictEqual(get(posts, 'length'), 3);
done();
});
});
Expand All @@ -39,7 +39,7 @@ module('Unit | Model | blog/post', function (hooks) {

let posts = store.findAll('blog/post');

assert.equal(get(posts, 'length'), 0);
assert.strictEqual(get(posts, 'length'), 0);

run(function () {
store.push({
Expand All @@ -59,7 +59,7 @@ module('Unit | Model | blog/post', function (hooks) {
});

store.findAll('blog/post').then(function (posts) {
assert.equal(get(posts, 'length'), 2);
assert.strictEqual(get(posts, 'length'), 2);
done();
});
});
Expand All @@ -81,8 +81,11 @@ module('Unit | Model | blog/post', function (hooks) {

run(function () {
store.findRecord('blog/post', get(newPost, 'id')).then(function (post) {
assert.equal(get(post, 'id'), get(newPost, 'id'));
assert.equal(get(post, 'name'), 'Ember.js: 10 most common mistakes');
assert.strictEqual(get(post, 'id'), get(newPost, 'id'));
assert.strictEqual(
get(post, 'name'),
'Ember.js: 10 most common mistakes'
);
done();
});
});
Expand All @@ -94,7 +97,7 @@ module('Unit | Model | blog/post', function (hooks) {
const store = this.owner.lookup('service:store');
let posts = store.findAll('blog/post');

assert.equal(get(posts, 'length'), 0);
assert.strictEqual(get(posts, 'length'), 0);

run(function () {
store
Expand All @@ -111,7 +114,7 @@ module('Unit | Model | blog/post', function (hooks) {
});

store.findAll('blog/post').then(function (posts) {
assert.equal(get(posts, 'length'), 2);
assert.strictEqual(get(posts, 'length'), 2);
done();
});
});
Expand All @@ -122,7 +125,7 @@ module('Unit | Model | blog/post', function (hooks) {
const store = this.owner.lookup('service:store');
let posts = store.findAll('blog/post');

assert.equal(get(posts, 'length'), 0);
assert.strictEqual(get(posts, 'length'), 0);

run(function () {
store
Expand All @@ -145,13 +148,13 @@ module('Unit | Model | blog/post', function (hooks) {
});

store.findAll('blog/post').then(function (posts) {
assert.equal(get(posts, 'length'), 3);
assert.strictEqual(get(posts, 'length'), 3);
});

store
.queryRecord('blog/post', { filter: { name: 'Super Name' } })
.then(function (post) {
assert.equal(get(post, 'name'), 'Super Name');
assert.strictEqual(get(post, 'name'), 'Super Name');
done();
});
});
Expand Down
46 changes: 26 additions & 20 deletions tests/unit/models/post-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module('Unit | Model | post', function (hooks) {

let posts = store.findAll('post');

assert.equal(get(posts, 'length'), 0);
assert.strictEqual(get(posts, 'length'), 0);

run(function () {
store.createRecord('post', { name: 'Super Name' }).save();
Expand All @@ -43,7 +43,7 @@ module('Unit | Model | post', function (hooks) {
});

store.findAll('post').then(function (posts) {
assert.equal(get(posts, 'length'), 3);
assert.strictEqual(get(posts, 'length'), 3);
done();
});
});
Expand All @@ -55,7 +55,7 @@ module('Unit | Model | post', function (hooks) {

let posts = store.findAll('post');

assert.equal(get(posts, 'length'), 0);
assert.strictEqual(get(posts, 'length'), 0);

run(function () {
store.push({
Expand All @@ -75,7 +75,7 @@ module('Unit | Model | post', function (hooks) {
});

store.findAll('post').then(function (posts) {
assert.equal(get(posts, 'length'), 2);
assert.strictEqual(get(posts, 'length'), 2);
done();
});
});
Expand All @@ -97,8 +97,11 @@ module('Unit | Model | post', function (hooks) {

run(function () {
store.findRecord('post', get(newPost, 'id')).then(function (post) {
assert.equal(get(post, 'id'), get(newPost, 'id'));
assert.equal(get(post, 'name'), 'Ember.js: 10 most common mistakes');
assert.strictEqual(get(post, 'id'), get(newPost, 'id'));
assert.strictEqual(
get(post, 'name'),
'Ember.js: 10 most common mistakes'
);
done();
});
});
Expand All @@ -110,7 +113,7 @@ module('Unit | Model | post', function (hooks) {
const store = this.owner.lookup('service:store');
let posts = store.findAll('post');

assert.equal(get(posts, 'length'), 0);
assert.strictEqual(get(posts, 'length'), 0);

run(function () {
store
Expand All @@ -127,7 +130,7 @@ module('Unit | Model | post', function (hooks) {
});

store.findAll('post').then(function (posts) {
assert.equal(get(posts, 'length'), 2);
assert.strictEqual(get(posts, 'length'), 2);
done();
});
});
Expand All @@ -138,7 +141,7 @@ module('Unit | Model | post', function (hooks) {
const store = this.owner.lookup('service:store');
let posts = store.findAll('post');

assert.equal(get(posts, 'length'), 0);
assert.strictEqual(get(posts, 'length'), 0);

let paul;

Expand Down Expand Up @@ -173,13 +176,13 @@ module('Unit | Model | post', function (hooks) {
});

store.findAll('post').then(function (posts) {
assert.equal(get(posts, 'length'), 3);
assert.strictEqual(get(posts, 'length'), 3);
});

store
.queryRecord('post', { filter: { name: 'Super Name' } })
.then(function (post) {
assert.equal(get(post, 'name'), 'Super Name');
assert.strictEqual(get(post, 'name'), 'Super Name');
done();
});
});
Expand All @@ -190,12 +193,12 @@ module('Unit | Model | post', function (hooks) {
const store = this.owner.lookup('service:store');
let posts = store.findAll('post');

assert.equal(get(posts, 'length'), 0);
assert.strictEqual(get(posts, 'length'), 0);

store
.queryRecord('post', { filter: { name: 'Super Name' } })
.then(function (post) {
assert.equal(post, null);
assert.strictEqual(post, null);

done();
})
Expand All @@ -222,7 +225,7 @@ module('Unit | Model | post', function (hooks) {
});

store.findAll('post').then(function (posts) {
assert.equal(get(posts, 'length'), 1);
assert.strictEqual(get(posts, 'length'), 1);
done();
});
});
Expand All @@ -240,7 +243,7 @@ module('Unit | Model | post', function (hooks) {
});

store.findAll('post').then(function (posts) {
assert.equal(get(posts, 'length'), 1);
assert.strictEqual(get(posts, 'length'), 1);
done();
});
});
Expand All @@ -259,7 +262,7 @@ module('Unit | Model | post', function (hooks) {
});

store.findAll('post').then(function (posts) {
assert.equal(get(posts, 'length'), 1);
assert.strictEqual(get(posts, 'length'), 1);
done();
});
});
Expand All @@ -274,7 +277,7 @@ module('Unit | Model | post', function (hooks) {

let posts = store.findAll('post');

assert.equal(get(posts, 'length'), 0);
assert.strictEqual(get(posts, 'length'), 0);

run(function () {
store.push({
Expand All @@ -294,7 +297,7 @@ module('Unit | Model | post', function (hooks) {
});

store.findAll('post').then(function (posts) {
assert.equal(get(posts, 'length'), 2);
assert.strictEqual(get(posts, 'length'), 2);
done();
});
});
Expand All @@ -319,8 +322,11 @@ module('Unit | Model | post', function (hooks) {

run(function () {
store.findRecord('post', get(newPost, 'id')).then(function (post) {
assert.equal(get(post, 'id'), get(newPost, 'id'));
assert.equal(get(post, 'name'), 'Ember.js: 10 most common mistakes');
assert.strictEqual(get(post, 'id'), get(newPost, 'id'));
assert.strictEqual(
get(post, 'name'),
'Ember.js: 10 most common mistakes'
);
done();
});
});
Expand Down
Loading

0 comments on commit c21d5c0

Please sign in to comment.