Skip to content

Commit 1c78af9

Browse files
authored
test: refactor tests
Signed-off-by: Athan <kgryte@gmail.com>
1 parent 60c616a commit 1c78af9

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

  • lib/node_modules/@stdlib/wasm/module-wrapper/test

lib/node_modules/@stdlib/wasm/module-wrapper/test/test.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,37 +71,37 @@ tape( 'the function is a constructor', opts, function test( t ) {
7171
var mod;
7272

7373
wasm = new Uint8Array( [ 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00 ] );
74-
mod = new Module( wasm, null );
74+
mod = new Module( wasm, {} );
7575

76-
t.strictEqual( mod instanceof Module, true, 'returns an instance' );
76+
t.strictEqual( mod instanceof Module, true, 'returns expected value' );
7777
t.end();
7878
});
7979

80-
tape( 'the `initialize` method returns a promise', opts, function test( t ) {
80+
tape( 'the function returns an instance having an `initialize` method which returns a promise', opts, function test( t ) {
8181
var wasm;
8282
var mod;
8383
var p;
8484

8585
wasm = new Uint8Array( [ 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00 ] );
86-
mod = new Module( wasm, null );
86+
mod = new Module( wasm, {} );
8787
p = mod.initialize();
8888

89-
t.strictEqual( typeof p.then, 'function', 'returns a promise' );
89+
t.strictEqual( typeof p.then, 'function', 'returns expected value' );
9090
t.end();
9191
});
9292

93-
tape( 'the `initialize` method resolves with the module instance', opts, function test( t ) {
93+
tape( 'the function returns an instance having an `initialize` method which returns a promise resolving with the module instance', opts, function test( t ) {
9494
var wasm;
9595
var mod;
9696

9797
wasm = new Uint8Array( [ 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00 ] );
98-
mod = new Module( wasm, null );
98+
mod = new Module( wasm, {} );
9999

100100
mod.initialize().then( onResolve, onReject );
101101

102102
function onResolve( result ) {
103-
t.strictEqual( result, mod, 'resolves with module instance' );
104-
t.strictEqual( typeof result.exports, 'object', 'exports is accessible after initialization' );
103+
t.strictEqual( result, mod, 'resolves expected value' );
104+
t.strictEqual( typeof result.exports, 'object', 'returns expected value' );
105105
t.end();
106106
}
107107

@@ -111,12 +111,12 @@ tape( 'the `initialize` method resolves with the module instance', opts, functio
111111
}
112112
});
113113

114-
tape( 'the `initializeAsync` method invokes a callback', opts, function test( t ) {
114+
tape( 'the function returns an instance having an `initializeAsync` method which invokes a callback', opts, function test( t ) {
115115
var wasm;
116116
var mod;
117117

118118
wasm = new Uint8Array( [ 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00 ] );
119-
mod = new Module( wasm, null );
119+
mod = new Module( wasm, {} );
120120

121121
mod.initializeAsync( clbk );
122122

@@ -130,12 +130,12 @@ tape( 'the `initializeAsync` method invokes a callback', opts, function test( t
130130
}
131131
});
132132

133-
tape( 'the `initializeAsync` method invokes callback with the module instance', opts, function test( t ) {
133+
tape( 'the function returns an instance having an `initializeAsync` method which invokes a callback with the module instance', opts, function test( t ) {
134134
var wasm;
135135
var mod;
136136

137137
wasm = new Uint8Array( [ 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00 ] );
138-
mod = new Module( wasm, null );
138+
mod = new Module( wasm, {} );
139139

140140
mod.initializeAsync( clbk );
141141

@@ -145,24 +145,24 @@ tape( 'the `initializeAsync` method invokes callback with the module instance',
145145
t.end();
146146
return;
147147
}
148-
t.strictEqual( result, mod, 'callback receives module instance' );
149-
t.strictEqual( typeof result.exports, 'object', 'exports is accessible after initialization' );
148+
t.strictEqual( result, mod, 'returns expected value' );
149+
t.strictEqual( typeof result.exports, 'object', 'returns expected value' );
150150
t.end();
151151
}
152152
});
153153

154-
tape( 'the `exports` property returns instance exports after initialization', opts, function test( t ) {
154+
tape( 'the function returns an instance having an `exports` property which is available after initialization', opts, function test( t ) {
155155
var wasm;
156156
var mod;
157157

158158
wasm = new Uint8Array( [ 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00 ] );
159-
mod = new Module( wasm, null );
159+
mod = new Module( wasm, {} );
160160

161161
mod.initialize().then( onResolve, onReject );
162162

163163
function onResolve( result ) {
164164
var exports = result.exports;
165-
t.strictEqual( typeof exports, 'object', 'exports is an object' );
165+
t.strictEqual( typeof exports, 'object', 'returns expected value' );
166166
t.end();
167167
}
168168

0 commit comments

Comments
 (0)