Skip to content

Commit

Permalink
test: remove messages for assert
Browse files Browse the repository at this point in the history
  • Loading branch information
ka3e committed Nov 6, 2017
1 parent 8eef52e commit 207b1c9
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions test/addons-napi/test_promise/test.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
'use strict';

const common = require('../../common');
const test_promise = require(`./build/${common.buildType}/test_promise`);
const assert = require('assert');

// Testing api calls for promises
const test_promise = require(`./build/${common.buildType}/test_promise`);

// A resolution
{
const expected_result = 42;
const promise = test_promise.createPromise();
promise.then(
common.mustCall(function(result) {
assert.strictEqual(result, expected_result,
`promise resolved as expected, received ${result}`);
assert.strictEqual(result, expected_result);
}),
common.mustNotCall());
test_promise.concludeCurrentPromise(expected_result, true);
Expand All @@ -24,23 +25,25 @@ const assert = require('assert');
promise.then(
common.mustNotCall(),
common.mustCall(function(result) {
assert.strictEqual(result, expected_result,
`promise rejected as expected, received ${result}`);
assert.strictEqual(result, expected_result);
}));
test_promise.concludeCurrentPromise(expected_result, false);
}

// Chaining
const promise = test_promise.createPromise();
promise.then(
common.mustCall(function(result) {
assert.strictEqual(result, 'chained answer',
'resolving with a promise chains properly');
}),
common.mustNotCall());
test_promise.concludeCurrentPromise(Promise.resolve('chained answer'), true);
{
const expected_result = 'chained answer';
const promise = test_promise.createPromise();
promise.then(
common.mustCall(function(result) {
assert.strictEqual(result, expected_result);
}),
common.mustNotCall());
test_promise.concludeCurrentPromise(Promise.resolve('chained answer'), true);

assert.strictEqual(test_promise.isPromise(promise), true);
}

assert.strictEqual(test_promise.isPromise(promise), true);
assert.strictEqual(test_promise.isPromise(Promise.reject(-1)), true);
assert.strictEqual(test_promise.isPromise(2.4), false);
assert.strictEqual(test_promise.isPromise('I promise!'), false);
Expand Down

0 comments on commit 207b1c9

Please sign in to comment.