Skip to content

Commit daa3502

Browse files
jkwluiJustinBeckwith
authored andcommitted
chore: use assert.deepStrictEqual instead of assert.deepEqual (#274)
1 parent d315471 commit daa3502

13 files changed

Lines changed: 253 additions & 237 deletions

handwritten/spanner/system-test/spanner.js

Lines changed: 78 additions & 78 deletions
Large diffs are not rendered by default.

handwritten/spanner/test/batch-transaction.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var fakeUtil = extend({}, util, {
2626
return;
2727
}
2828

29-
assert.deepEqual(options.exclude, ['identifier']);
29+
assert.deepStrictEqual(options.exclude, ['identifier']);
3030
promisified = true;
3131
},
3232
});
@@ -73,7 +73,7 @@ describe('BatchTransaction', function() {
7373

7474
assert(batchTransaction instanceof FakeTransaction);
7575
assert.strictEqual(batchTransaction.calledWith_[0], SESSION);
76-
assert.deepEqual(batchTransaction.calledWith_[1], {readOnly: true});
76+
assert.deepStrictEqual(batchTransaction.calledWith_[1], {readOnly: true});
7777
});
7878
});
7979

@@ -96,7 +96,7 @@ describe('BatchTransaction', function() {
9696

9797
it('should make the correct request', function(done) {
9898
fakeCodec.encodeQuery = function(query) {
99-
assert.deepEqual(query, {sql: QUERY.sql});
99+
assert.deepStrictEqual(query, {sql: QUERY.sql});
100100
return QUERY;
101101
};
102102

@@ -122,7 +122,7 @@ describe('BatchTransaction', function() {
122122
};
123123

124124
batchTransaction.createPartitions_ = function(config, callback) {
125-
assert.deepEqual(config.reqOpts, {sql: QUERY.sql, a: 'b'});
125+
assert.deepStrictEqual(config.reqOpts, {sql: QUERY.sql, a: 'b'});
126126
assert.strictEqual(config.gaxOpts, GAX_OPTS);
127127
callback(); // the done fn
128128
};
@@ -155,7 +155,7 @@ describe('BatchTransaction', function() {
155155
batchTransaction.request = function(config) {
156156
assert.strictEqual(config.reqOpts.a, 'b');
157157
assert.strictEqual(config.reqOpts.session, SESSION.formattedName_);
158-
assert.deepEqual(config.reqOpts.transaction, {id: ID});
158+
assert.deepStrictEqual(config.reqOpts.transaction, {id: ID});
159159
done();
160160
};
161161

@@ -190,7 +190,7 @@ describe('BatchTransaction', function() {
190190

191191
parts.forEach(function(partition, i) {
192192
var expectedPartition = extend({}, expectedQuery, PARTITIONS[i]);
193-
assert.deepEqual(partition, expectedPartition);
193+
assert.deepStrictEqual(partition, expectedPartition);
194194
});
195195

196196
done();
@@ -248,7 +248,7 @@ describe('BatchTransaction', function() {
248248
};
249249

250250
batchTransaction.createPartitions_ = function(config, callback) {
251-
assert.deepEqual(config.reqOpts, {table: QUERY.table});
251+
assert.deepStrictEqual(config.reqOpts, {table: QUERY.table});
252252
assert.strictEqual(config.gaxOpts, GAX_OPTS);
253253
callback(); // the done fn
254254
};

handwritten/spanner/test/codec.js

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,12 @@ describe('codec', function() {
169169
var json = {a: 'b', c: 'd'};
170170
var struct = codec.Struct.fromJSON(json);
171171

172-
assert.deepEqual(struct, [
172+
var expected = new codec.Struct();
173+
expected.push.apply(expected, [
173174
{name: 'a', value: 'b'},
174175
{name: 'c', value: 'd'},
175176
]);
177+
assert.deepStrictEqual(struct, expected);
176178
});
177179
});
178180

@@ -181,8 +183,11 @@ describe('codec', function() {
181183
var arr = [{name: 'a', value: 1}, {name: 'b', value: 2}];
182184
var struct = codec.Struct.fromArray(arr);
183185

186+
var expectedStruct = new codec.Struct();
187+
expectedStruct.push.apply(expectedStruct, arr);
188+
184189
assert(codec.Struct.isStruct(struct));
185-
assert.deepEqual(struct, arr);
190+
assert.deepStrictEqual(struct, expectedStruct);
186191
});
187192
});
188193

@@ -233,7 +238,7 @@ describe('codec', function() {
233238
});
234239

235240
it('should return serialized rows', function() {
236-
assert.deepEqual(toJSON(), {
241+
assert.deepStrictEqual(toJSON(), {
237242
name: 'value',
238243
});
239244
});
@@ -246,7 +251,7 @@ describe('codec', function() {
246251
];
247252

248253
var toJSON = codec.generateToJSONFromRow(row);
249-
assert.deepEqual(toJSON(), {});
254+
assert.deepStrictEqual(toJSON(), {});
250255
});
251256

252257
it('should not wrap numbers by default', function() {
@@ -276,7 +281,7 @@ describe('codec', function() {
276281
var value = toJSON({wrapNumbers: true}).Number;
277282

278283
assert(value instanceof codec.Int);
279-
assert.deepEqual(value, int);
284+
assert.deepStrictEqual(value, int);
280285
});
281286

282287
it('should throw an error if number is out of bounds', function() {
@@ -336,7 +341,7 @@ describe('codec', function() {
336341
},
337342
});
338343

339-
assert.deepEqual(decoded, Buffer.from(value, 'base64'));
344+
assert.deepStrictEqual(decoded, Buffer.from(value, 'base64'));
340345
});
341346

342347
it('should decode FLOAT64', function() {
@@ -374,7 +379,7 @@ describe('codec', function() {
374379
},
375380
});
376381

377-
assert.deepEqual(decoded, value);
382+
assert.deepStrictEqual(decoded, value);
378383
});
379384

380385
it('should decode DATE', function() {
@@ -386,7 +391,7 @@ describe('codec', function() {
386391
},
387392
});
388393

389-
assert.deepEqual(decoded, value);
394+
assert.deepStrictEqual(decoded, value);
390395
});
391396

392397
it('should decode ARRAY and inner members', function() {
@@ -430,13 +435,17 @@ describe('codec', function() {
430435
},
431436
},
432437
});
438+
assert(codec.Struct.isStruct(decoded));
433439

434-
assert.deepEqual(decoded, [
440+
var expectedStruct = new codec.Struct();
441+
expectedStruct.push.apply(expectedStruct, [
435442
{
436443
name: 'fieldName',
437444
value: int,
438445
},
439446
]);
447+
448+
assert.deepStrictEqual(decoded, expectedStruct);
440449
});
441450
});
442451

@@ -472,7 +481,7 @@ describe('codec', function() {
472481
var value = codec.Struct.fromJSON({a: 'b', c: 'd'});
473482
var encoded = codec.encode(value);
474483

475-
assert.deepEqual(encoded, ['b', 'd']);
484+
assert.deepStrictEqual(encoded, ['b', 'd']);
476485
});
477486

478487
it('should stringify Infinity', function() {
@@ -512,7 +521,7 @@ describe('codec', function() {
512521

513522
var encoded = codec.encode(value);
514523

515-
assert.deepEqual(encoded, [
524+
assert.deepStrictEqual(encoded, [
516525
value.toString(), // (tests that it is stringified)
517526
]);
518527
});
@@ -555,7 +564,7 @@ describe('codec', function() {
555564
i: new codec.Int(10),
556565
};
557566
var encoded = codec.encode(obj);
558-
assert.deepEqual(encoded, {f: 10, i: '10'});
567+
assert.deepStrictEqual(encoded, {f: 10, i: '10'});
559568
});
560569

561570
it('should only encode public properties of objects', function() {
@@ -568,8 +577,8 @@ describe('codec', function() {
568577
public: new codec.Int(10),
569578
};
570579
var encoded = codec.encode(obj);
571-
assert.deepEqual(encoded._private, obj._private);
572-
assert.deepEqual(encoded.public, 10);
580+
assert.deepStrictEqual(encoded._private, obj._private);
581+
assert.deepStrictEqual(encoded.public, '10');
573582
});
574583
});
575584

@@ -611,7 +620,7 @@ describe('codec', function() {
611620
var struct = codec.Struct.fromJSON({a: 'b'});
612621
var type = codec.getType(struct);
613622

614-
assert.deepEqual(type, {
623+
assert.deepStrictEqual(type, {
615624
type: 'struct',
616625
fields: [
617626
{
@@ -623,7 +632,7 @@ describe('codec', function() {
623632
});
624633

625634
it('should attempt to determine arrays and their values', function() {
626-
assert.deepEqual(codec.getType([Infinity]), {
635+
assert.deepStrictEqual(codec.getType([Infinity]), {
627636
type: 'array',
628637
child: 'float64',
629638
});
@@ -632,7 +641,7 @@ describe('codec', function() {
632641
it('should return unspecified for unknown values', function() {
633642
assert.strictEqual(codec.getType(null), 'unspecified');
634643

635-
assert.deepEqual(codec.getType([null]), {
644+
assert.deepStrictEqual(codec.getType([null]), {
636645
type: 'array',
637646
child: 'unspecified',
638647
});
@@ -641,7 +650,7 @@ describe('codec', function() {
641650

642651
describe('TYPES', function() {
643652
it('should export types', function() {
644-
assert.deepEqual(codec.TYPES, TYPES);
653+
assert.deepStrictEqual(codec.TYPES, TYPES);
645654
});
646655
});
647656

@@ -734,7 +743,7 @@ describe('codec', function() {
734743

735744
var encodedQuery = codec.encodeQuery(fakeQuery);
736745

737-
assert.deepEqual(encodedQuery.paramTypes, {
746+
assert.deepStrictEqual(encodedQuery.paramTypes, {
738747
unspecified: {
739748
code: 0,
740749
},
@@ -795,7 +804,7 @@ describe('codec', function() {
795804

796805
var query = codec.encodeQuery(fakeQuery);
797806

798-
assert.deepEqual(query.paramTypes, {test: fakeTypeObject});
807+
assert.deepStrictEqual(query.paramTypes, {test: fakeTypeObject});
799808
});
800809

801810
it('should delete the type map from the request options', function() {
@@ -1007,14 +1016,14 @@ describe('codec', function() {
10071016
TYPES.forEach(function(typeName, i) {
10081017
var type = codec.createTypeObject(typeName);
10091018

1010-
assert.deepEqual(type.code, i);
1019+
assert.deepStrictEqual(type.code, i);
10111020
});
10121021
});
10131022

10141023
it('should default to unspecified for unknown types', function() {
10151024
var type = codec.createTypeObject('unicorn');
10161025

1017-
assert.deepEqual(type, {code: TYPES.indexOf('unspecified')});
1026+
assert.deepStrictEqual(type, {code: TYPES.indexOf('unspecified')});
10181027
});
10191028

10201029
it('should set the arrayElementType', function() {
@@ -1023,7 +1032,7 @@ describe('codec', function() {
10231032
child: 'bool',
10241033
});
10251034

1026-
assert.deepEqual(type, {
1035+
assert.deepStrictEqual(type, {
10271036
code: TYPES.indexOf('array'),
10281037
arrayElementType: {
10291038
code: TYPES.indexOf('bool'),
@@ -1040,7 +1049,7 @@ describe('codec', function() {
10401049
],
10411050
});
10421051

1043-
assert.deepEqual(type, {
1052+
assert.deepStrictEqual(type, {
10441053
code: TYPES.indexOf('struct'),
10451054
structType: {
10461055
fields: [
@@ -1080,7 +1089,7 @@ describe('codec', function() {
10801089
],
10811090
});
10821091

1083-
assert.deepEqual(type, {
1092+
assert.deepStrictEqual(type, {
10841093
code: TYPES.indexOf('struct'),
10851094
structType: {
10861095
fields: [

handwritten/spanner/test/data/streaming-read-acceptance-test.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
"23",
138138
"4",
139139
null,
140-
5
140+
"5"
141141
]
142142
]
143143
]
@@ -334,4 +334,4 @@
334334
"name": "Multiple Row Chunks/Non Chunks Interleaved"
335335
}
336336
]
337-
}
337+
}

0 commit comments

Comments
 (0)