Skip to content

Commit

Permalink
Use assert.deepStrictEqual instead of deepEqual. (#253)
Browse files Browse the repository at this point in the history
  • Loading branch information
sduskis authored and JustinBeckwith committed Jul 24, 2018
1 parent a292b54 commit 30c19a8
Show file tree
Hide file tree
Showing 14 changed files with 209 additions and 156 deletions.
3 changes: 3 additions & 0 deletions samples/hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"dependencies": {
"@google-cloud/bigtable": "^0.15.0",
"co": "^4.6.0"
},
"engines": {
"node": ">=8.0.0"
}
}
22 changes: 13 additions & 9 deletions system-test/bigtable.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ describe('Bigtable', function() {
assert.ifError(err);
assert.strictEqual(families.length, 3);
assert(families[0] instanceof Family);
assert.notEqual(
assert.notStrictEqual(
-1,
families
.map(f => {
Expand Down Expand Up @@ -554,7 +554,7 @@ describe('Bigtable', function() {
assert.ifError(err);
var maxAge = metadata.gcRule.maxAge;

assert.strictEqual(maxAge.seconds, rule.age.seconds);
assert.strictEqual(maxAge.seconds, rule.age.seconds.toString());
assert.strictEqual(maxAge.nanas, rule.age.nanas);
done();
});
Expand Down Expand Up @@ -942,7 +942,7 @@ describe('Bigtable', function() {
})
.sort();

assert.deepEqual(keys, ['alincoln', 'jadams', 'tjefferson']);
assert.deepStrictEqual(keys, ['alincoln', 'jadams', 'tjefferson']);

done();
});
Expand Down Expand Up @@ -1002,7 +1002,7 @@ describe('Bigtable', function() {
rows.forEach(function(row) {
var keys = Object.keys(row.data.follows).sort();

assert.deepEqual(keys, ['gwashington', 'jadams']);
assert.deepStrictEqual(keys, ['gwashington', 'jadams']);
});

done();
Expand Down Expand Up @@ -1087,7 +1087,7 @@ describe('Bigtable', function() {
assert(rows.length > 0);

var families = Object.keys(rows[0].data);
assert.deepEqual(families, ['traits']);
assert.deepStrictEqual(families, ['traits']);
done();
});
});
Expand Down Expand Up @@ -1121,7 +1121,7 @@ describe('Bigtable', function() {
})
.sort();

assert.deepEqual(ids, ['gwashington', 'tjefferson']);
assert.deepStrictEqual(ids, ['gwashington', 'tjefferson']);

done();
});
Expand All @@ -1140,7 +1140,7 @@ describe('Bigtable', function() {

Object.keys(follows).forEach(function(column) {
follows[column].forEach(function(cell) {
assert.deepEqual(cell.labels, [filter.label]);
assert.deepStrictEqual(cell.labels, [filter.label]);
});
});
});
Expand All @@ -1163,7 +1163,7 @@ describe('Bigtable', function() {
})
.sort();

assert.deepEqual(keys, ['gwashington', 'tjefferson']);
assert.deepStrictEqual(keys, ['gwashington', 'tjefferson']);

done();
});
Expand Down Expand Up @@ -1204,7 +1204,11 @@ describe('Bigtable', function() {

var columns = Object.keys(rows[0].data.follows).sort();

assert.deepEqual(columns, ['gwashington', 'jadams', 'tjefferson']);
assert.deepStrictEqual(columns, [
'gwashington',
'jadams',
'tjefferson',
]);

done();
});
Expand Down
6 changes: 3 additions & 3 deletions system-test/mutate-rows.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('Bigtable/Table', () => {
responses = test.responses;
TABLE.maxRetries = test.max_retries;
TABLE.mutate(test.mutations_request, error => {
assert.deepEqual(
assert.deepStrictEqual(
mutationBatchesInvoked,
test.mutation_batches_invoked
);
Expand All @@ -116,11 +116,11 @@ describe('Bigtable/Table', () => {
const expectedIndices = test.errors.map(error => {
return error.index_in_mutations_request;
});
assert.deepEqual(error.name, 'PartialFailureError');
assert.deepStrictEqual(error.name, 'PartialFailureError');
const actualIndices = error.errors.map(error => {
return test.mutations_request.indexOf(error.entry);
});
assert.deepEqual(expectedIndices, actualIndices);
assert.deepStrictEqual(expectedIndices, actualIndices);
} else {
assert.ifError(error);
}
Expand Down
2 changes: 1 addition & 1 deletion system-test/read-rows-acceptance-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe('Read Row Acceptance tests', function() {
function verify() {
assert.strictEqual(errors.length, errorCount, ' error count mismatch');
assert.strictEqual(rows.length, results.length, 'row count mismatch');
assert.deepEqual(rows, tableRows, 'row mismatch');
assert.deepStrictEqual(rows, tableRows, 'row mismatch');
done();
}
});
Expand Down
8 changes: 4 additions & 4 deletions test/app-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ describe('Bigtable/AppProfile', function() {
assert.strictEqual(config.client, 'BigtableInstanceAdminClient');
assert.strictEqual(config.method, 'deleteAppProfile');

assert.deepEqual(config.reqOpts, {
assert.deepStrictEqual(config.reqOpts, {
name: appProfile.name,
});

Expand Down Expand Up @@ -290,7 +290,7 @@ describe('Bigtable/AppProfile', function() {

it('should not require gaxOptions', function(done) {
appProfile.getMetadata = function(gaxOptions) {
assert.deepEqual(gaxOptions, {});
assert.deepStrictEqual(gaxOptions, {});
done();
};

Expand Down Expand Up @@ -332,11 +332,11 @@ describe('Bigtable/AppProfile', function() {
assert.strictEqual(config.client, 'BigtableInstanceAdminClient');
assert.strictEqual(config.method, 'getAppProfile');

assert.deepEqual(config.reqOpts, {
assert.deepStrictEqual(config.reqOpts, {
name: appProfile.name,
});

assert.deepEqual(config.gaxOpts, {});
assert.deepStrictEqual(config.gaxOpts, {});

done();
};
Expand Down
98 changes: 67 additions & 31 deletions test/chunktransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,28 @@ describe('Bigtable/ChunkTransformer', function() {
this.qualifier = {};
this.row = {};
this.state = RowStateEnum.NEW_ROW;
assert.deepEqual(chunkTransformer.row, {}, 'invalid initial state');
assert.deepEqual(
assert.deepStrictEqual(chunkTransformer.row, {}, 'invalid initial state');
assert.deepStrictEqual(
chunkTransformer.prevRowKey,
null,
'invalid initial state'
);
assert.deepEqual(chunkTransformer.family, {}, 'invalid initial state');
assert.deepEqual(
assert.deepStrictEqual(
chunkTransformer.family,
{},
'invalid initial state'
);
assert.deepStrictEqual(
chunkTransformer.qualifiers,
[],
'invalid initial state'
);
assert.deepEqual(chunkTransformer.qualifier, {}, 'invalid initial state');
assert.deepEqual(
assert.deepStrictEqual(
chunkTransformer.qualifier,
{},
'invalid initial state'
);
assert.deepStrictEqual(
chunkTransformer.state,
RowStateEnum.NEW_ROW,
'invalid initial state'
Expand Down Expand Up @@ -204,7 +212,7 @@ describe('Bigtable/ChunkTransformer', function() {
},
},
};
assert.deepEqual(rows[0], expectedRow);
assert.deepStrictEqual(rows[0], expectedRow);
});
it('partial row ', function() {
const chunk = {
Expand Down Expand Up @@ -235,7 +243,7 @@ describe('Bigtable/ChunkTransformer', function() {
},
},
};
assert.deepEqual(chunkTransformer.row, partialRow);
assert.deepStrictEqual(chunkTransformer.row, partialRow);
assert.strictEqual(
chunkTransformer.state,
RowStateEnum.ROW_IN_PROGRESS,
Expand Down Expand Up @@ -271,7 +279,7 @@ describe('Bigtable/ChunkTransformer', function() {
},
},
};
assert.deepEqual(chunkTransformer.row, partialRow);
assert.deepStrictEqual(chunkTransformer.row, partialRow);
assert.strictEqual(
chunkTransformer.state,
RowStateEnum.CELL_IN_PROGRESS,
Expand Down Expand Up @@ -407,7 +415,7 @@ describe('Bigtable/ChunkTransformer', function() {
},
};
const row = rows[0];
assert.deepEqual(row, expectedRow, 'row mismatch');
assert.deepStrictEqual(row, expectedRow, 'row mismatch');
assert.strictEqual(
chunkTransformer.state,
RowStateEnum.NEW_ROW,
Expand Down Expand Up @@ -453,7 +461,7 @@ describe('Bigtable/ChunkTransformer', function() {
},
};
const row = rows[0];
assert.deepEqual(row, expectedRow, 'row mismatch');
assert.deepStrictEqual(row, expectedRow, 'row mismatch');
assert.strictEqual(
chunkTransformer.state,
RowStateEnum.NEW_ROW,
Expand Down Expand Up @@ -502,7 +510,7 @@ describe('Bigtable/ChunkTransformer', function() {
},
};
const row = rows[0];
assert.deepEqual(row, expectedRow, 'row mismatch');
assert.deepStrictEqual(row, expectedRow, 'row mismatch');
assert.strictEqual(
chunkTransformer.state,
RowStateEnum.NEW_ROW,
Expand Down Expand Up @@ -544,7 +552,7 @@ describe('Bigtable/ChunkTransformer', function() {
},
},
};
assert.deepEqual(
assert.deepStrictEqual(
chunkTransformer.row,
expectedState,
'row state mismatch'
Expand Down Expand Up @@ -596,7 +604,11 @@ describe('Bigtable/ChunkTransformer', function() {
},
},
};
assert.deepEqual(chunkTransformer.row, expectedState, 'row mismatch');
assert.deepStrictEqual(
chunkTransformer.row,
expectedState,
'row mismatch'
);
assert.strictEqual(
chunkTransformer.state,
RowStateEnum.ROW_IN_PROGRESS,
Expand Down Expand Up @@ -727,7 +739,7 @@ describe('Bigtable/ChunkTransformer', function() {
},
};
const row = rows[0];
assert.deepEqual(row, expectedRow, 'row mismatch');
assert.deepStrictEqual(row, expectedRow, 'row mismatch');
assert.strictEqual(
chunkTransformer.state,
RowStateEnum.NEW_ROW,
Expand Down Expand Up @@ -775,7 +787,11 @@ describe('Bigtable/ChunkTransformer', function() {
},
},
};
assert.deepEqual(chunkTransformer.row, expectedState, 'row mismatch');
assert.deepStrictEqual(
chunkTransformer.row,
expectedState,
'row mismatch'
);
assert.strictEqual(
chunkTransformer.state,
RowStateEnum.ROW_IN_PROGRESS,
Expand Down Expand Up @@ -834,7 +850,11 @@ describe('Bigtable/ChunkTransformer', function() {
},
},
};
assert.deepEqual(chunkTransformer.row, expectedState, 'row mismatch');
assert.deepStrictEqual(
chunkTransformer.row,
expectedState,
'row mismatch'
);
assert.strictEqual(
chunkTransformer.state,
RowStateEnum.ROW_IN_PROGRESS,
Expand Down Expand Up @@ -938,7 +958,7 @@ describe('Bigtable/ChunkTransformer', function() {
{},
callback
);
assert.deepEqual(chunkTransformer.lastRowKey, 'foo');
assert.deepStrictEqual(chunkTransformer.lastRowKey, 'foo');
});
});
describe('reset', function() {
Expand All @@ -962,20 +982,28 @@ describe('Bigtable/ChunkTransformer', function() {
};
this.state = RowStateEnum.CELL_IN_PROGRESS;
chunkTransformer.reset();
assert.deepEqual(chunkTransformer.row, {}, 'invalid initial state');
assert.deepEqual(
assert.deepStrictEqual(chunkTransformer.row, {}, 'invalid initial state');
assert.deepStrictEqual(
chunkTransformer.prevRowKey,
null,
'invalid initial state'
);
assert.deepEqual(chunkTransformer.family, {}, 'invalid initial state');
assert.deepEqual(
assert.deepStrictEqual(
chunkTransformer.family,
{},
'invalid initial state'
);
assert.deepStrictEqual(
chunkTransformer.qualifiers,
[],
'invalid initial state'
);
assert.deepEqual(chunkTransformer.qualifier, {}, 'invalid initial state');
assert.deepEqual(
assert.deepStrictEqual(
chunkTransformer.qualifier,
{},
'invalid initial state'
);
assert.deepStrictEqual(
chunkTransformer.state,
RowStateEnum.NEW_ROW,
'invalid initial state'
Expand Down Expand Up @@ -1008,20 +1036,28 @@ describe('Bigtable/ChunkTransformer', function() {
this.state = RowStateEnum.CELL_IN_PROGRESS;
chunkTransformer.commit();
assert(resetSpy.called, 'did not call reset');
assert.deepEqual(chunkTransformer.row, {}, 'invalid initial state');
assert.deepEqual(
assert.deepStrictEqual(chunkTransformer.row, {}, 'invalid initial state');
assert.deepStrictEqual(
chunkTransformer.prevRowKey,
'key',
'invalid initial state'
);
assert.deepEqual(chunkTransformer.family, {}, 'invalid initial state');
assert.deepEqual(
assert.deepStrictEqual(
chunkTransformer.family,
{},
'invalid initial state'
);
assert.deepStrictEqual(
chunkTransformer.qualifiers,
[],
'invalid initial state'
);
assert.deepEqual(chunkTransformer.qualifier, {}, 'invalid initial state');
assert.deepEqual(
assert.deepStrictEqual(
chunkTransformer.qualifier,
{},
'invalid initial state'
);
assert.deepStrictEqual(
chunkTransformer.state,
RowStateEnum.NEW_ROW,
'invalid initial state'
Expand Down Expand Up @@ -1072,7 +1108,7 @@ describe('Bigtable/ChunkTransformer', function() {
},
};
const row = rows[0];
assert.deepEqual(row, expectedRow, 'row mismatch');
assert.deepStrictEqual(row, expectedRow, 'row mismatch');
assert.strictEqual(
chunkTransformer.state,
RowStateEnum.NEW_ROW,
Expand Down
Loading

0 comments on commit 30c19a8

Please sign in to comment.