Skip to content

Commit f1997b7

Browse files
Tim Cheungjasnell
Tim Cheung
authored andcommitted
test: flip assertion arguments for make-callback/test.js
Assertion arguments should have the first value be the actual value, while the second value be the expected value. PR-URL: #23470 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent ec675b8 commit f1997b7

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

test/addons/make-callback/test.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,39 @@ const vm = require('vm');
66
const binding = require(`./build/${common.buildType}/binding`);
77
const makeCallback = binding.makeCallback;
88

9-
assert.strictEqual(42, makeCallback(process, common.mustCall(function() {
10-
assert.strictEqual(0, arguments.length);
11-
assert.strictEqual(this, process);
9+
assert.strictEqual(makeCallback(process, common.mustCall(function() {
10+
assert.strictEqual(arguments.length, 0);
11+
assert.strictEqual(process, this);
1212
return 42;
13-
})));
13+
})), 42);
1414

15-
assert.strictEqual(42, makeCallback(process, common.mustCall(function(x) {
16-
assert.strictEqual(1, arguments.length);
17-
assert.strictEqual(this, process);
15+
assert.strictEqual(makeCallback(process, common.mustCall(function(x) {
16+
assert.strictEqual(arguments.length, 1);
17+
assert.strictEqual(process, this);
1818
assert.strictEqual(x, 1337);
1919
return 42;
20-
}), 1337));
20+
}), 1337), 42);
2121

2222
const recv = {
2323
one: common.mustCall(function() {
24-
assert.strictEqual(0, arguments.length);
25-
assert.strictEqual(this, recv);
24+
assert.strictEqual(arguments.length, 0);
25+
assert.strictEqual(recv, this);
2626
return 42;
2727
}),
2828
two: common.mustCall(function(x) {
29-
assert.strictEqual(1, arguments.length);
30-
assert.strictEqual(this, recv);
29+
assert.strictEqual(arguments.length, 1);
30+
assert.strictEqual(recv, this);
3131
assert.strictEqual(x, 1337);
3232
return 42;
3333
}),
3434
};
3535

36-
assert.strictEqual(42, makeCallback(recv, 'one'));
37-
assert.strictEqual(42, makeCallback(recv, 'two', 1337));
36+
assert.strictEqual(makeCallback(recv, 'one'), 42);
37+
assert.strictEqual(makeCallback(recv, 'two', 1337), 42);
3838

3939
// Check that callbacks on a receiver from a different context works.
4040
const foreignObject = vm.runInNewContext('({ fortytwo() { return 42; } })');
41-
assert.strictEqual(42, makeCallback(foreignObject, 'fortytwo'));
41+
assert.strictEqual(makeCallback(foreignObject, 'fortytwo'), 42);
4242

4343
// Check that the callback is made in the context of the receiver.
4444
const target = vm.runInNewContext(`
@@ -48,7 +48,7 @@ const target = vm.runInNewContext(`
4848
return Object;
4949
})
5050
`);
51-
assert.notStrictEqual(Object, makeCallback(process, target, Object));
51+
assert.notStrictEqual(makeCallback(process, target, Object), Object);
5252

5353
// Runs in inner context.
5454
const forward = vm.runInNewContext(`
@@ -62,4 +62,4 @@ function endpoint($Object) {
6262
throw new Error('bad');
6363
return Object;
6464
}
65-
assert.strictEqual(Object, makeCallback(process, forward, endpoint));
65+
assert.strictEqual(makeCallback(process, forward, endpoint), Object);

0 commit comments

Comments
 (0)