ran npm run tdd & generated TDD
This commit is contained in:
16
test/runAsync/runAsync.js
Normal file
16
test/runAsync/runAsync.js
Normal file
@ -0,0 +1,16 @@
|
||||
module.exports = fn => {
|
||||
const blob = `var fn = ${fn.toString()}; postMessage(fn());`;
|
||||
const worker = new Worker(
|
||||
URL.createObjectURL(new Blob([blob]), {
|
||||
type: 'application/javascript; charset=utf-8'
|
||||
})
|
||||
);
|
||||
return new Promise((res, rej) => {
|
||||
worker.onmessage = ({ data }) => {
|
||||
res(data), worker.terminate();
|
||||
};
|
||||
worker.onerror = err => {
|
||||
rej(err), worker.terminate();
|
||||
};
|
||||
});
|
||||
};
|
||||
13
test/runAsync/runAsync.test.js
Normal file
13
test/runAsync/runAsync.test.js
Normal file
@ -0,0 +1,13 @@
|
||||
const test = require('tape');
|
||||
const runAsync = require('./runAsync.js');
|
||||
|
||||
test('Testing runAsync', (t) => {
|
||||
//For more information on all the methods supported by tape
|
||||
//Please go to https://github.com/substack/tape
|
||||
t.true(typeof runAsync === 'function', 'runAsync is a Function');
|
||||
//t.deepEqual(runAsync(args..), 'Expected');
|
||||
//t.equal(runAsync(args..), 'Expected');
|
||||
//t.false(runAsync(args..), 'Expected');
|
||||
//t.throws(runAsync(args..), 'Expected');
|
||||
t.end();
|
||||
});
|
||||
Reference in New Issue
Block a user