diff options
author | Rich Trott <rtrott@gmail.com> | 2016-08-19 16:39:19 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2016-08-23 11:25:05 -0700 |
commit | 1aa47d8e839aa6342257d3f42628a38437c779ba (patch) | |
tree | 4f3d4186e1b274fdcc19f0cc7823fbbba996e0bd /test/parallel/test-timers-linked-list.js | |
parent | 9cee8b1b621f2803bbdd7209aea74c918081eaad (diff) | |
download | node-new-1aa47d8e839aa6342257d3f42628a38437c779ba.tar.gz |
test: refactor test-timers-linked-list.js
* check that empty linked lists have identical properties
* `assert.equal()` -> `assert.strictEqual()`
* `var` -> `const`
PR-URL: https://github.com/nodejs/node/pull/8193
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaƫl Zasso <mic.besace@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'test/parallel/test-timers-linked-list.js')
-rw-r--r-- | test/parallel/test-timers-linked-list.js | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/test/parallel/test-timers-linked-list.js b/test/parallel/test-timers-linked-list.js index 4ec7770cfa..c89c3e23c6 100644 --- a/test/parallel/test-timers-linked-list.js +++ b/test/parallel/test-timers-linked-list.js @@ -9,11 +9,11 @@ const internalL = require('internal/linkedlist'); assert.strictEqual(L, internalL); -var list = { name: 'list' }; -var A = { name: 'A' }; -var B = { name: 'B' }; -var C = { name: 'C' }; -var D = { name: 'D' }; +const list = { name: 'list' }; +const A = { name: 'A' }; +const B = { name: 'B' }; +const C = { name: 'C' }; +const D = { name: 'D' }; L.init(list); @@ -23,55 +23,53 @@ L.init(C); L.init(D); assert.ok(L.isEmpty(list)); -assert.equal(null, L.peek(list)); +assert.strictEqual(null, L.peek(list)); L.append(list, A); // list -> A -assert.equal(A, L.peek(list)); +assert.strictEqual(A, L.peek(list)); L.append(list, B); // list -> A -> B -assert.equal(A, L.peek(list)); +assert.strictEqual(A, L.peek(list)); L.append(list, C); // list -> A -> B -> C -assert.equal(A, L.peek(list)); +assert.strictEqual(A, L.peek(list)); L.append(list, D); // list -> A -> B -> C -> D -assert.equal(A, L.peek(list)); +assert.strictEqual(A, L.peek(list)); -var x = L.shift(list); -assert.equal(A, x); +assert.strictEqual(A, L.shift(list)); // list -> B -> C -> D -assert.equal(B, L.peek(list)); +assert.strictEqual(B, L.peek(list)); -x = L.shift(list); -assert.equal(B, x); +assert.strictEqual(B, L.shift(list)); // list -> C -> D -assert.equal(C, L.peek(list)); +assert.strictEqual(C, L.peek(list)); // B is already removed, so removing it again shouldn't hurt. L.remove(B); // list -> C -> D -assert.equal(C, L.peek(list)); +assert.strictEqual(C, L.peek(list)); // Put B back on the list L.append(list, B); // list -> C -> D -> B -assert.equal(C, L.peek(list)); +assert.strictEqual(C, L.peek(list)); L.remove(C); // list -> D -> B -assert.equal(D, L.peek(list)); +assert.strictEqual(D, L.peek(list)); L.remove(B); // list -> D -assert.equal(D, L.peek(list)); +assert.strictEqual(D, L.peek(list)); L.remove(D); // list -assert.equal(null, L.peek(list)); +assert.strictEqual(null, L.peek(list)); assert.ok(L.isEmpty(list)); @@ -79,7 +77,7 @@ assert.ok(L.isEmpty(list)); L.append(list, D); // list -> D -assert.equal(D, L.peek(list)); +assert.strictEqual(D, L.peek(list)); L.append(list, C); L.append(list, B); @@ -90,16 +88,16 @@ L.append(list, A); L.append(list, C); // list -> D -> B -> A -> C -assert.equal(D, L.shift(list)); +assert.strictEqual(D, L.shift(list)); // list -> B -> A -> C -assert.equal(B, L.peek(list)); -assert.equal(B, L.shift(list)); +assert.strictEqual(B, L.peek(list)); +assert.strictEqual(B, L.shift(list)); // list -> A -> C -assert.equal(A, L.peek(list)); -assert.equal(A, L.shift(list)); +assert.strictEqual(A, L.peek(list)); +assert.strictEqual(A, L.shift(list)); // list -> C -assert.equal(C, L.peek(list)); -assert.equal(C, L.shift(list)); +assert.strictEqual(C, L.peek(list)); +assert.strictEqual(C, L.shift(list)); // list assert.ok(L.isEmpty(list)); @@ -107,4 +105,7 @@ const list2 = L.create(); const list3 = L.create(); assert.ok(L.isEmpty(list2)); assert.ok(L.isEmpty(list3)); -assert.ok(list2 != list3); + +// Objects should have identical keys/properties, but be different objects. +assert.deepStrictEqual(list2, list3); +assert.notStrictEqual(list2, list3); |