How to use the deepEqual function from assert
Find comprehensive JavaScript assert.deepEqual code examples handpicked from public code repositorys.
GitHub: dependents/node-precinct
17 18 19 20 21 22 23 24 25 26
const deps = precinct(ast); assert.equal(deps.length, 1); }); it('dangles off a given ast', () => { assert.deepEqual(precinct.ast, ast); }); it('dangles off the parsed ast from a .js file', () => { precinct(read('amd.js'));
39
177
0
+ 27 other calls in file
377 378 379 380 381 382 383 384 385 386 387 388
fail(actual, expected, message, '!=', assert.notEqual); } }; // 7. The equivalence assertion tests a deep equality relation. // assert.deepEqual(actual, expected, message_opt); assert.deepEqual = function deepEqual(actual, expected, message) { if (!_deepEqual(actual, expected)) { fail(actual, expected, message, 'deepEqual', assert.deepEqual);
11
21
6
134 135 136 137 138 139 140 141 142 143
}); it("adds object in object list", () => { nucleoid.run("class Student { }"); nucleoid.run("user0 = new Student ( )"); deepEqual( nucleoid.run("Student.find ( student => student.id === 'user0')"), { id: "user0" } ); deepEqual(nucleoid.run("Student['user0']"), { id: "user0" });
7
447
8
+ 25 other calls in file
41 42 43 44 45 46 47 48 49 50
it('should create an error when an integer is requested and the value is an integer string, but parse flag is not set to true', function() { var my_validator = new FieldVal({ "my_integer": "26" }) assert.strictEqual(undefined, my_validator.get("my_integer", bval.integer(true))); assert.deepEqual({ "invalid":{ "my_integer":{ "error_message":"Incorrect field type. Expected integer, but received string.", "error":2,
9
137
4
+ 91 other calls in file
108 109 110 111 112 113 114 115 116 117
} }, "error_message": "One or more errors.", "error": 5 }; assert.deepEqual(expected, actual); }) }) describe('date_format()', function() {
9
137
4
+ 5 other calls in file
72 73 74 75 76 77 78 79 80 81
assert.strictEqual(validator_one.end(),null); var validator_two = new FieldVal({ 'my_unrecognized_key': 42 }); assert.deepEqual(validator_two.end(),{ "invalid":{ "my_unrecognized_key":{ "error_message": "Unrecognized field.", "error": 3
9
137
4
+ 164 other calls in file
625 626 627 628 629 630 631 632 633 634
it('should return state for most recent task if no path is specified', () => new Promise((resolve, reject) => { restOperationMock.complete = () => { try { assert.strictEqual(Array.isArray(responseBody), false); assert.deepEqual(responseBody.declaration, { foo: 'bar' }); assert.strictEqual(responseBody.result.code, 200); resolve(); } catch (err) { reject(err);
22
51
21
+ 7 other calls in file
GitHub: porterhq/porter
82 83 84 85 86 87 88 89 90 91
]); }); it('should resolve unknown module types as stub', async function() { const entry = porter.packet.files['notfound.jsx']; assert.deepEqual(entry.children.map(mod => path.relative(root, mod.fpath)), [ 'app/web/notfound_dep.coffee', 'app/web/notfound.styl', 'app/web/editor.jsx', ]);
7
40
9
+ 90 other calls in file
GitHub: porterhq/porter
134 135 136 137 138 139 140 141 142 143
expect(Object.keys(iconv.dependencies)).to.not.contain('stream'); }); it('should fallback stream to readable-stream', function() { const restructure = porter.packet.find({ name: 'restructure' }); assert.deepEqual(restructure.browser, { stream: 'readable-stream' }); }); }); describe('packet.prepare()', function() {
7
40
9
+ 69 other calls in file
74 75 76 77 78 79 80 81 82
const positionUpdate1 = {workspaceId: 'mockId1', position: this.position}; const positionUpdate2 = {workspaceId: 'mockId2', position: this.position}; const marker1 = this.userDataManager.createMarker_(positionUpdate1); const marker2 = this.userDataManager.createMarker_(positionUpdate2); assert.notEqual(marker1.colour, marker2.colour); assert.deepEqual(this.BlocklyMarkerManager.getMarker('mockId1'), marker1); assert.deepEqual(this.BlocklyMarkerManager.getMarker('mockId2'), marker2); }); });
0
1
0
+ 2 other calls in file
1644 1645 1646 1647 1648 1649 1650 1651 1652 1653
privileges.global.rescind(['groups:view:users'], 'guests', (err) => { assert.ifError(err); request(`${nconf.get('url')}/api/user/foo`, { json: true }, (err, res, body) => { assert.ifError(err); assert.equal(res.statusCode, 401); assert.deepEqual(body, { response: {}, status: { code: 'not-authorised', message: 'A valid login session was not found. Please log in and try again.',
1
0
5
GitHub: bonavadeur/konnichiwa
26 27 28 29 30 31 32 33 34 35
var bytes = []; while(b.length() > 0) { bytes.push(b.getByte()); } ASSERT.deepEqual( bytes, [1, 2, 3, 4, 0, 0, 0, 4, 1, 2, 3, 255, 255, 255, 255]); }); it('should put bytes from an Uint8Array into a buffer', function() {
0
0
1
+ 2 other calls in file
298 299 300 301 302 303 304 305 306 307
assert.equal(docs[1].name, 'The Empire Strikes Back'); }); it('returns empty array if no documents (gh-8130)', function() { const Movie = db.model('Movie', Schema({ name: String })); return Movie.insertMany([]).then(docs => assert.deepEqual(docs, [])); }); it('insertMany() multi validation error with ordered false (gh-5337)', async function() { const schema = new Schema({
0
0
494
GitHub: Automattic/mongoose
188 189 190 191 192 193 194 195 196 197
assert.equal(post.get('title'), undefined); assert.equal(post.get('slug'), undefined); assert.equal(post.get('date'), undefined); assert.equal(typeof post.get('meta'), 'object'); assert.deepEqual(post.get('meta'), {}); assert.equal(post.get('meta.date'), undefined); assert.equal(post.get('meta.visitors'), undefined); assert.equal(post.get('published'), undefined); assert.equal(Object.keys(post.get('nested')).length, 1);
0
0
494
+ 95 other calls in file
412 413 414 415 416 417 418 419 420 421
assert.deepEqual( 'aaron' , mpath.get('first.second.third.1.name', o, special) ); assert.deepEqual([ { name: 'one' }, { name: 'two', _doc: { name: '2' } }, { name: 'three', comments: [{}, { comments: [{ val: 'twoo' }] }],
0
0
1
+ 193 other calls in file
2349 2350 2351 2352 2353 2354 2355 2356 2357 2358
}); describe('with 3 args', function() { it('conditions + update + options', function() { const m = mquery(); const n = m.findOneAndUpdate({ name: name }, { works: true }, { returnDocument: 'before' }); assert.deepEqual({ name: name }, n._conditions); assert.deepEqual({ works: true }, n._update); assert.deepEqual({ returnDocument: 'before' }, n.options); }); it('conditions + update + callback', function(done) {
0
0
1
+ 136 other calls in file
18 19 20 21 22 23 24 25 26 27
storage: {}, extensions: ['mp4'], urlUtils: {} }); assert.deepEqual(contentFileImporter.extensions, ['mp4']); }); it('returns configured contentTypes', function () { const contentFileImporter = new ImporterContentFileHandler({
0
0
0
+ 3 other calls in file
5 6 7 8 9 10 11 12 13 14 15 16
const mirrorArray = require("../problems/05-arrow-mirror-array.js"); describe("mirrorArray()", function () { it("should return a single array where the first half is the original array and the second half is a mirror of the first half", function () { assert.deepEqual(mirrorArray([1, 2, 3]), [1, 2, 3, 3, 2, 1]); assert.deepEqual(mirrorArray(["a", "b", "c", "d"]), [ "a", "b", "c",
0
0
1
15 16 17 18 19 20 21 22 23 24
const test3 = addFive(37); const result3 = 42; assert.deepEqual(test1, result1); assert.deepEqual(test2, result2); assert.deepEqual(test3, result3); }); it("should be an arrow function", function () {
0
0
1
+ 2 other calls in file
13 14 15 16 17 18 19 20 21
const result2 = "nedrag"; const test3 = reverseStr("potato"); const result3 = "otatop"; assert.deepEqual(test, result); assert.deepEqual(test2, result2); assert.deepEqual(test3, result3); });
0
0
1
+ 2 other calls in file
assert.equal is the most popular function in assert (3580 examples)