MCPcopy Create free account
hub / github.com/nodejs/node-addon-api / success

Function success

test/async_progress_worker.js:149–168  ·  view source on GitHub ↗
(binding)

Source from the content-addressed store, hash-verified

147}
148
149function success (binding) {
150 return new Promise((resolve, reject) => {
151 const expected = [0, 1, 2, 3];
152 const actual = [];
153 binding.doWork(expected.length,
154 common.mustCall((err) => {
155 if (err) {
156 reject(err);
157 }
158 }),
159 common.mustCall((_progress) => {
160 actual.push(_progress);
161 if (actual.length === expected.length) {
162 assert.deepEqual(actual, expected);
163 resolve();
164 }
165 }, expected.length)
166 );
167 });
168}
169
170function fail (binding) {
171 return new Promise((resolve) => {

Callers 1

testFunction · 0.70

Calls

no outgoing calls

Tested by 1

testFunction · 0.56