|
1 |
| -#!/usr/bin/env ts-node |
| 1 | +#!/usr/bin/env node --loader ts-node/esm |
2 | 2 |
|
3 |
| -// tslint:disable:no-shadowed-variable |
4 |
| -import test from 'blue-tape' |
5 |
| -import sinon from 'sinon' |
| 3 | +import { |
| 4 | + test, |
| 5 | + sinon, |
| 6 | +} from 'tstest' |
6 | 7 |
|
7 |
| -import { StateSwitch } from './state-switch' |
| 8 | +import { StateSwitch } from './state-switch.js' |
8 | 9 |
|
9 | 10 | test('on()', async t => {
|
10 | 11 | const ss = new StateSwitch()
|
@@ -111,26 +112,26 @@ test('on/off events emitting', async t => {
|
111 | 112 | ss.addListener('on', spyOn)
|
112 | 113 | ss.addListener('off', spyOff)
|
113 | 114 |
|
114 |
| - t.true(spyOn.notCalled, 'spyOn is not called') |
115 |
| - t.true(spyOff.notCalled, 'spyOff is not called') |
| 115 | + t.ok(spyOn.notCalled, 'spyOn is not called') |
| 116 | + t.ok(spyOff.notCalled, 'spyOff is not called') |
116 | 117 |
|
117 | 118 | ss.on('pending')
|
118 |
| - t.true(spyOn.calledOnce, 'spyOn is called once after on(pending)') |
119 |
| - t.deepEqual(spyOn.args[0], ['pending'], 'spyOn should be called with `pending` arg') |
120 |
| - t.true(spyOff.notCalled, 'spyOff is not called') |
| 119 | + t.ok(spyOn.calledOnce, 'spyOn is called once after on(pending)') |
| 120 | + t.same(spyOn.args[0], ['pending'], 'spyOn should be called with `pending` arg') |
| 121 | + t.ok(spyOff.notCalled, 'spyOff is not called') |
121 | 122 |
|
122 | 123 | ss.on(true)
|
123 |
| - t.true(spyOn.calledTwice, 'spyOn is called once after on(pending)') |
124 |
| - t.deepEqual(spyOn.args[1], [true], 'spyOn should be called with `true` arg') |
125 |
| - t.true(spyOff.notCalled, 'spyOff is not called') |
| 124 | + t.ok(spyOn.calledTwice, 'spyOn is called once after on(pending)') |
| 125 | + t.same(spyOn.args[1], [true], 'spyOn should be called with `true` arg') |
| 126 | + t.ok(spyOff.notCalled, 'spyOff is not called') |
126 | 127 |
|
127 | 128 | ss.off('pending')
|
128 |
| - t.true(spyOff.calledOnce, 'spyOff is called once after off(pending)') |
129 |
| - t.deepEqual(spyOff.args[0], ['pending'], 'spyOff should be called with `pending` arg') |
| 129 | + t.ok(spyOff.calledOnce, 'spyOff is called once after off(pending)') |
| 130 | + t.same(spyOff.args[0], ['pending'], 'spyOff should be called with `pending` arg') |
130 | 131 |
|
131 | 132 | ss.off(true)
|
132 |
| - t.true(spyOff.calledTwice, 'spyOff is called twice after off(true)') |
133 |
| - t.deepEqual(spyOff.args[1], [true], 'spyOff should be called with `true` arg') |
| 133 | + t.ok(spyOff.calledTwice, 'spyOff is called twice after off(true)') |
| 134 | + t.same(spyOff.args[1], [true], 'spyOff should be called with `true` arg') |
134 | 135 |
|
135 |
| - t.true(spyOn.calledTwice, 'spyOn called twice at last') |
| 136 | + t.ok(spyOn.calledTwice, 'spyOn called twice at last') |
136 | 137 | })
|
0 commit comments