Permalink
Browse files

test: guarantee test runs in test-readline-keys

Use common.mustCall() to guarantee that test functions (created by a
factory function) are run.

PR-URL: #11023
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information...
Trott committed Jan 26, 2017
1 parent ae21a51 commit 87b4486da2fe8b74e2fcdb16928092f82a8be755
Showing with 4 additions and 3 deletions.
  1. +4 −3 test/parallel/test-readline-keys.js
@@ -1,5 +1,5 @@
'use strict';
require('../common');
const common = require('../common');
const PassThrough = require('stream').PassThrough;
const assert = require('assert');
const inherits = require('util').inherits;
@@ -55,7 +55,7 @@ function addTest(sequences, expectedKeys) {
const addKeyIntervalTest = (sequences, expectedKeys, interval = 550,
assertDelay = 550) => {
return (next) => () => {
const fn = common.mustCall((next) => () => {
if (!Array.isArray(sequences)) {
sequences = [ sequences ];
@@ -84,7 +84,8 @@ const addKeyIntervalTest = (sequences, expectedKeys, interval = 550,
}
};
emitKeys(sequences);
};
});
return fn;
};
// regular alphanumerics

0 comments on commit 87b4486

Please sign in to comment.