MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / testAsync

Function testAsync

node/test.js:45–58  ·  view source on GitHub ↗
(tc, cfg, expected)

Source from the content-addressed store, hash-verified

43};
44
45const testAsync = function (tc, cfg, expected) {
46 return new Promise(function (resolve, reject) {
47 const opencc = new OpenCC(cfg + '.json');
48 opencc.convert(tc.input, function (err, converted) {
49 if (err) return reject(err);
50 try {
51 assert.equal(converted, expected);
52 resolve();
53 } catch (e) {
54 reject(e);
55 }
56 });
57 });
58};
59
60async function testAsyncPromise(tc, cfg, expected) {
61 const opencc = new OpenCC(cfg + '.json');

Callers 1

test.jsFile · 0.85

Calls 2

convertMethod · 0.95
equalMethod · 0.45

Tested by

no test coverage detected