How to use the strictEqual function from assert
Find comprehensive JavaScript assert.strictEqual code examples handpicked from public code repositorys.
693 694 695 696 697 698 699 700 701 702
dirMode: this._dirMode, async validator() { await input.task if (expectedSize !== undefined) { // check that we read all the stream strictEqual( container.size, expectedSize, `transferred size ${container.size}, expected file size : ${expectedSize}` )
204
563
41
GitHub: algorand/js-algorand-sdk
1563 1564 1565 1566 1567 1568 1569 1570 1571 1572
if (this.expectedMockResponseCode === 200) { // assert.deepStrictEqual considers a Buffer and Uint8Array with the same contents as unequal. // These types are fairly interchangable in different parts of the SDK, so we need to normalize // them before comparing, which is why we chain encoding/decoding below. if (responseFormat === 'json') { assert.strictEqual( JSON.stringify(JSON.parse(expectedMockResponse)), JSON.stringify(this.actualMockResponse) ); } else {
185
264
27
+ 86 other calls in file
292 293 294 295 296 297 298 299 300 301
Common: { class: 'Tenant', optimisticLockKey: 'theOptimisticKeyOfLocking' } }; assert.strictEqual(validate(data), true, 'optimisticLockKey must be set'); }); it('should validate additional properties that are applications', () => { const data = {
57
140
51
+ 185 other calls in file
162 163 164 165 166 167 168 169 170 171
const data = { "class": "License", "licenseType": "regKey", "regKey": "ABCD-FGHIJ-KLMNO-PQRST-UVWXYZZ" }; assert.strictEqual(validate(data), false, 'bad reg keys should not be valid'); assert(getErrorString().includes('should match pattern')); }); it('should invalidate bad addOnKeys', () => {
22
51
21
+ 61 other calls in file
6 7 8 9 10 11 12 13 14 15
it('should return value when the value is present', function() { var my_validator = new FieldVal({ "my_value": 13 }) assert.equal(13, my_validator.get("my_value", bval.integer(true))); assert.strictEqual(null, my_validator.end()); }) it('should not continue if required=false and the value is missing', function(){ var my_validator = new FieldVal({
9
137
4
+ 143 other calls in file
67 68 69 70 71 72 73 74 75 76
var validator_one = new FieldVal({ 'my_unrecognized_key': 42 },{ ignore_unrecognized: true }); assert.strictEqual(validator_one.end(),null); var validator_two = new FieldVal({ 'my_unrecognized_key': 42 });
9
137
4
+ 92 other calls in file
669 670 671 672 673 674 675 676 677 678
it('should convert hours into ms', async () => { assert.strictEqual(tester.hours(1), 3600000); assert.strictEqual(tester.hours(10), 36000000); }); it('should convert days into ms', async () => { assert.strictEqual(tester.days(1), 86400000); assert.strictEqual(tester.days(2), 172800000); }); it('should fail if not a number', async () => { assert.throws(() => {
9
93
6
+ 49 other calls in file
GitHub: wingbotai/wingbot
291 292 293 294 295 296 297 298 299 300
bar: false } } }); assert.strictEqual(ret, false); }); it('works with objects', () => { const resolver = customCondition([[{
4
5
5
+ 3 other calls in file
GitHub: thylacine/websub-hub
285 286 287 288 289 290 291 292 293
const _queryFile = db._queryFileHelper(pgpStub); try { _queryFile(); assert.fail(noExpectedException); } catch (e) { assert.strictEqual(e, err); } }); }); // _queryFileHelper
0
1
1
+ 2 other calls in file
GitHub: nodejs/node-addon-api
64 65 66 67 68 69 70 71 72 73
}); const err = binding.error.catchError( () => { throw new TypeError('test'); }); assert(err instanceof TypeError); assert.strictEqual(err.message, 'test'); const msg = binding.error.catchErrorMessage( () => { throw new TypeError('test'); }); assert.strictEqual(msg, 'test');
457
0
52
305 306 307 308 309 310 311 312 313 314
{ I.say('And x coordinate of panels should be equal due to limitation of moving panel through the border'); const panel1HeaderBbox = await AtOutlinerPanel.grabHeaderBbox(); const panel2HeaderBbox = await AtOutlinerPanel.grabHeaderBbox(); assert.strictEqual(panel1HeaderBbox.x, panel2HeaderBbox.x); } { I.say('Drag panel somewhere to the center of the screen');
210
295
18
+ 32 other calls in file
258 259 260 261 262 263 264 265 266 267
headers: { Cookie: `sRefreshToken=${res.refreshToken}`, "anti-csrf": res.antiCsrf, }, }); assert.strictEqual(res3.result.success, true); let cookies = extractInfoFromResponse(res3); assert.strictEqual(cookies.antiCsrf, undefined); assert.strictEqual(cookies.accessToken, "");
46
218
9
+ 43 other calls in file
1261 1262 1263 1264 1265 1266 1267 1268 1269 1270
if (!fullOptions.checkForFail) { const tenant = result.results.find((r) => r.tenant === partition); const message = (tenant) ? tenant.message : `Unable to find tenant ${partition}` + `\n${JSON.stringify(result.results, null, 2)}`; assert.strictEqual(message, 'success', 'declaration did not delete successfully'); } }) .catch((newError) => { if (error) throw error;
57
140
51
+ 15 other calls in file
204 205 206 207 208 209 210 211 212 213
if (params.abort) { // The tail should be stopped when we match a line and abort, but if // something didn't work we need to make sure the tail is stopped tail.unwatch(); // Assert that the process was aborted as expected assert.strictEqual(signal, 'SIGTERM', `The backup should have terminated with SIGTERM, but was ${signal}.`); } else if (params.expectedBackupError) { assert.strictEqual(code, params.expectedBackupError.code, `The backup exited with unexpected code ${code}.`); } else { assert.strictEqual(code, 0, `The backup should exit normally, got exit code ${code} and signal ${signal}.`);
16
60
63
+ 19 other calls in file
352 353 354 355 356 357 358 359 360 361 362
// 4. Pure assertion tests whether a value is truthy, as determined // by !!guard. // assert.ok(guard, message_opt); // This statement is equivalent to assert.equal(true, guard, // message_opt);. To test strictly for the value true, use // assert.strictEqual(true, guard, message_opt);. function ok(value, message) { if (!!!value) fail(value, true, message, '==', assert.ok); }
11
21
6
+ 3 other calls in file
56 57 58 59 60 61 62 63 64 65
const parsed = declarationParser.parse(); const parsedDeclaration = parsed.parsedDeclaration; const tenants = parsed.tenants; // tenants assert.strictEqual(tenants.length, 1); assert.strictEqual(tenants[0], 'Common'); assert.deepStrictEqual( parsedDeclaration.Common, {
22
51
21
+ 41 other calls in file
378 379 380 381 382 383 384 385 386 387
it('should match dns resolver', () => { assert.ok(testDnsResolver(body.Common.myResolver, currentState)); }); it('should match ip mirroring', () => { assert.strictEqual(currentState.MirrorIp.mirrorIp, '::ffff:10.148.85.46'); assert.strictEqual(currentState.MirrorIp.mirrorSecondaryIp, 'any6'); }); it('should match RoutingAccessList', () => assert.deepStrictEqual(
22
51
21
+ 6 other calls in file
115 116 117 118 119 120 121 122 123 124
it('should set dependencies', () => new Promise((resolve, reject) => { restWorker.restHelper.makeRestjavadUri = () => 'https://path/to/deviceInfo'; const success = () => { assert.strictEqual(restWorker.dependencies[0], 'https://path/to/deviceInfo'); resolve(); }; const error = (err) => { reject(new Error(`Should have called success, but got error: ${err}`));
22
51
21
+ 76 other calls in file
13 14 15 16 17 18 19 20 21 22
describe('info.json', () => { it('produces a valid info.json', async () => { subject = new iiif.Processor(`${base}/info.json`, streamResolver, { pathPrefix: 'iiif/2/ab/cd/ef/gh' }); const result = await subject.execute(); const info = JSON.parse(result.body); assert.strictEqual(info['@id'], 'https://example.org/iiif/2/ab/cd/ef/gh/i'); assert.strictEqual(info.profile[1].maxWidth, undefined); assert.strictEqual(info.width, 621); assert.strictEqual(info.height, 327); });
4
21
55
+ 71 other calls in file
72 73 74 75 76 77 78 79 80 81
'user-agent': 'yandex', }, }, (err, response, body) => { assert.ifError(err); assert.equal(response.statusCode, 200); assert.strictEqual(body.csrf_token, false); assert.strictEqual(body.uid, -1); assert.strictEqual(body.loggedIn, false); done(); });
1
0
5
+ 31 other calls in file
assert.equal is the most popular function in assert (3580 examples)