-
- Description and source-code:
async function assertErrorThrownAsync(asyncFunc, regexp) {
let err;
try {
await asyncFunc();
} catch (errCaught) {
err = errCaught;
}
assertOrThrow(err, "No error thrown.");
assertOrThrow(
!regexp || new RegExp(regexp).test(err.message),
err
);
}
- Example usage:
...
[10, 8],
[2, 5]
];
await Promise.all([
(async function () {
let valActual;
// test win_sinefit2-error handling-behavior
await assertErrorThrownAsync(function () {
return dbExecAsync({
db,
sql: (`
SELECT win_sinefit2(1, 2, 3) FROM (SELECT 1);
`)
});
}, "wrong number of arguments");
...
-
- Description and source-code:
function assertInt64(val) {
// This function will assert <val> is within range of c99-signed-long-long.
val = BigInt(val);
if (!(
-9_223_372_036_854_775_808n <= val && val <= 9_223_372_036_854_775_807n
)) {
throw new Error(
`integer ${val} outside signed-64-bit inclusive-range`
+ " -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807"
);
}
}
- Example usage:
...
referenceList.push(val);
break;
case SQLITE_DATATYPE_FLOAT:
// push SQLITE-REAL - 8-byte
baton.setFloat64(nused + 1, val, true);
break;
case SQLITE_DATATYPE_INTEGER:
assertInt64(val);
// push SQLITE-INTEGER - 8-byte
baton.setBigInt64(nused + 1, val, true);
break;
}
return baton;
}
...
-
- Description and source-code:
function assertJsonEqual(aa, bb, message) {
aa = JSON.stringify(objectDeepCopyWithKeysSorted(aa), undefined, 1);
bb = JSON.stringify(objectDeepCopyWithKeysSorted(bb), undefined, 1);
if (aa !== bb) {
throw new Error(
"\n" + aa + "\n!==\n" + bb
+ (
typeof message === "string"
? " - " + message
: message
? " - " + JSON.stringify(message)
: ""
)
);
}
}
- Example usage:
...
valActual,
String("1").replace(npm_config_mode_test_save, "force")
);
valExpect = await fsReadFileUnlessTest(
"test_data_sinefit.csv",
"force"
);
assertJsonEqual(valActual, valExpect);
}())
]);
});
});
jstestDescribe((
"test_sqlmathWebworkerInit"
...
-
- Description and source-code:
function assertNumericalEqual(aa, bb, message) {
assertOrThrow(aa, "value cannot be 0 or falsy");
if (!(Math.abs((aa - bb) / Math.max(aa, bb)) <= 256 * Number.EPSILON)) {
throw new Error(
JSON.stringify(aa) + " != " + JSON.stringify(bb) + (
message
? " - " + message
: ""
)
);
}
}
- Example usage:
...
jstestDescribe((
"test_assertXxx"
), function test_assertXxx() {
jstestIt((
"test assertXxx handling-behavior"
), function () {
assertErrorThrownAsync(function () {
assertNumericalEqual(0, 0);
}, "value cannot be 0 or falsy");
assertErrorThrownAsync(function () {
assertNumericalEqual(1, 2);
}, "1 != 2");
assertErrorThrownAsync(function () {
assertNumericalEqual(1, 2, "aa");
}, "aa");
...
-
- Description and source-code:
function assertOrThrow(condition, message) {
if (!condition) {
throw (
(!message || typeof message === "string")
? new Error(String(message).slice(0, 2048))
: message
);
}
}
- Example usage:
...
db,
sql: (`
SELECT doublearray_jsonto(doublearray_jsonfrom($valIn)) AS result;
`)
})
).result;
} catch (ignore) {
assertOrThrow(valExpect === "error", JSON.stringify({
ii,
valActual,
valExpect,
valIn
}, undefined, 4));
return;
}
...
-
- Description and source-code:
async function childProcessSpawn2(command, args, option) {
return await new Promise(function (resolve, reject) {
let bufList = [[], [], []];
let child;
let {
modeCapture,
modeDebug,
stdio
} = option;
if (modeDebug) {
consoleError(
`childProcessSpawn2 - ${command} ${JSON.stringify(args)}`
);
}
child = moduleChildProcessSpawn(
command,
args,
Object.assign({}, option, {
stdio: [
"ignore",
(
modeCapture
? "pipe"
: stdio[1]
),
(
modeCapture
? "pipe"
: stdio[2]
)
]
})
);
if (modeCapture) {
[
child.stdin, child.stdout, child.stderr
].forEach(function (pipe, ii) {
if (ii === 0) {
return;
}
pipe.on("data", function (chunk) {
bufList[ii].push(chunk);
if (stdio[ii] !== "ignore") {
switch (ii) {
case 1:
process.stdout.write(chunk);
break;
case 2:
process.stderr.write(chunk);
break;
}
}
});
});
}
child.on("exit", function (exitCode) {
let resolve0 = resolve;
let stderr;
let stdout;
// coverage-hack
if (exitCode || npm_config_mode_test) {
resolve = reject;
}
...
}
- Example usage:
...
jstestDescribe((
"test_childProcessSpawn2"
), function test_childProcessSpawn2() {
jstestIt((
"test childProcessSpawn2 handling-behavior"
), async function () {
await Promise.all([
childProcessSpawn2(
"aa",
[],
{modeCapture: "utf8", modeDebug: true, stdio: []}
)
]);
});
});
...
-
- Description and source-code:
async function ciBuildExt({
modeSkip,
process
}) {
let option;
option = {
binNodegyp: modulePath.resolve(
modulePath.dirname(process.execPath || ""),
"node_modules/npm/node_modules/node-gyp/bin/node-gyp.js"
).replace("/bin/node_modules/", "/lib/node_modules/"),
isWin32: process.platform === "win32",
modeDebug: npm_config_mode_debug,
modeSkip,
process
};
await ciBuildExt2NodejsBuild(option);
}
- Example usage:
...
jstestDescribe((
"test_ciBuildExtXxx"
), function test_ciBuildExtXxx() {
jstestIt((
"test ciBuildExt handling-behavior"
), async function () {
await Promise.all([
ciBuildExt({modeSkip: true, process: {}}),
ciBuildExt({process: {arch: "arm", env: {}, platform: "win32"}}),
ciBuildExt({process: {arch: "arm64", env: {}, platform: "win32"}}),
ciBuildExt({process: {arch: "ia32", env: {}, platform: "win32"}}),
ciBuildExt({process: {env: {}, platform: "darwin"}}),
ciBuildExt({process: {env: {}, platform: "win32"}}),
ciBuildExt({process: {}})
]);
...
-
- Description and source-code:
async function dbCloseAsync(db) {
// prevent segfault - do not close db if actions are pending
assertOrThrow(
db.busy === 0,
`dbCloseAsync - cannot close db with ${db.busy} actions pending`
);
// cleanup connPool
await Promise.all(db.connPool.map(async function (ptr) {
let val = ptr[0];
ptr[0] = 0n;
await dbCallAsync(jsbatonCreate("_dbClose"), [val, db.filename]);
}));
}
- Example usage:
...
) >= 0,
err
);
}
});
// test close-while-busy handling-behavior
assertErrorThrownAsync(function () {
return dbCloseAsync(db);
}, "cannot close db");
});
jstestIt((
"test dbFileXxx handling-behavior"
), async function test_dbFileXxx() {
let data;
let db = await dbOpenAsync({
...
-
- Description and source-code:
async function dbExecAndReturnFirstRow({
bindList = [],
db,
sql
}) {
return (
noop(
noop(
await dbExecAsync({
bindList,
db,
sql
})
)[0]
|| []
)[0]
|| {}
);
}
- Example usage:
...
"myy": 10,
"nnn": 6,
"rr0": 0,
"rr1": -1.63694722,
"xx1": 51,
"yy1": 5
};
valActual = await dbExecAndReturnFirstRow({
db,
sql: (`
SELECT
${sqlSinefitExtractLnr("__wsf", 0, "")}
FROM (
SELECT
win_sinefit2(1, NULL, xx, yy) AS __wsf
...
-
- Description and source-code:
async function dbExecAndReturnFirstTable({
bindList = [],
db,
sql
}) {
return (
noop(
await dbExecAsync({
bindList,
db,
sql
})
)[0]
|| []
);
}
- Example usage:
...
elem = elem.split(" ");
return {
date: elem[0],
ii,
priceClose: Number(elem[1])
};
});
valActual = await dbExecAndReturnFirstTable({
bindList: {
testDataSpx
},
db,
sql: (`
DROP TABLE IF EXISTS __sinefit_csv;
CREATE TEMP TABLE __sinefit_csv AS
...
-
- Description and source-code:
function dbExecAndReturnLastBlobAsync({
bindList = [],
db,
sql
}) {
return dbExecAsync({
bindList,
db,
responseType: "lastblob",
sql
});
}
- Example usage:
...
})
),
[]
);
// test dbExecAndReturnLastBlobAsync null-case handling-behavior
assertJsonEqual(
new TextDecoder().decode(
await dbExecAndReturnLastBlobAsync({
db,
sql: "SELECT 0 WHERE 0"
})
),
""
);
// test dbExecAndReturnLastBlobAsync string handling-behavior
...
-
- Description and source-code:
async function dbExecAsync({
bindList = [],
db,
responseType,
sql
}) {
let baton = jsbatonCreate("_dbExec");
let bindByKey = !Array.isArray(bindList);
let bufi = [0];
let referenceList = [];
let result;
if (bindByKey) {
Object.entries(bindList).forEach(function ([key, val]) {
baton = jsbatonSetValue(baton, undefined, `:${key}\u0000`);
baton = jsbatonSetValue(
baton,
undefined,
val,
bufi,
referenceList
);
});
} else {
bindList.forEach(function (val) {
baton = jsbatonSetValue(
baton,
undefined,
val,
bufi,
referenceList
);
});
}
[baton, ...result] = await dbCallAsync(
baton,
[
// 0. db
db,
// 1. sql
String(sql) + "\n;\nPRAGMA noop",
// 2. bindList.length
(
bindByKey
? Object.keys(bindList).length
: bindList.length
),
// 3. bindByKey
bindByKey,
// 4. responseType
(
responseType === "lastblob"
? SQLITE_RESPONSETYPE_LASTBLOB
: 0
)
],
"modeDb"
);
result = result[0];
if (!IS_BROWSER) {
result = cModule._jsbatonStealCbuffer(
baton.buffer,
0,
Number(
responseType !== "arraybuffer" && responseType !== "lastblob"
)
);
}
switch (responseType) {
case "arraybuffer":
case "lastblob":
return result;
case "list":
return jsonParseArraybuffer(result);
default:
return jsonParseArraybuffer(result).map(...
}
- Example usage:
...
[2, 5]
];
await Promise.all([
(async function () {
let valActual;
// test win_sinefit2-error handling-behavior
await assertErrorThrownAsync(function () {
return dbExecAsync({
db,
sql: (`
SELECT win_sinefit2(1, 2, 3) FROM (SELECT 1);
`)
});
}, "wrong number of arguments");
// test win_sinefit2-null-case handling-behavior
...
-
- Description and source-code:
async function dbFileLoadAsync({
db,
dbData,
filename,
modeNoop,
modeSave = 0
}) {
let filename2;
async function _dbFileLoad() {
dbData = await dbCallAsync(
jsbatonCreate("_dbFileLoad"),
[
// 0. sqlite3 * pInMemory
db,
// 1. char *zFilename
filename,
// 2. const int isSave
modeSave,
// 3. undefined
undefined,
// 4. dbData - same position as dbOpenAsync
dbData
],
"modeDb"
);
}
if (modeNoop) {
return;
}
if (IS_BROWSER) {
filename = FILENAME_DBTMP;
}
assertOrThrow(
typeof filename === "string" && filename,
`invalid filename ${filename}`
);
// Save to tmpfile and then atomically-rename to actual-filename.
if (moduleFs && modeSave) {
filename2 = filename;
filename = modulePath.join(
modulePath.dirname(filename),
`.dbFileSaveAsync.${moduleCrypto.randomUUID()}`
);
try {
await _dbFileLoad();
await moduleFs.promises.rename(filename, filename2);
} finally {
await moduleFs.promises.unlink(filename).catch(noop);
}
} else {
await _dbFileLoad();
}
return dbData[1 + 0];
}
- Example usage:
...
await dbFileSaveAsync({
db,
filename: ".testDbFileXxx.sqlite"
});
db = await dbOpenAsync({
filename: ":memory:"
});
await dbFileLoadAsync({
db,
filename: ".testDbFileXxx.sqlite"
});
data = await dbExecAsync({
db,
sql: "SELECT * FROM t01"
});
...
-
- Description and source-code:
async function dbFileSaveAsync({
db,
dbData,
filename,
modeNoop
}) {
return await dbFileLoadAsync({
db,
dbData,
filename,
modeNoop,
modeSave: 1
});
}
- Example usage:
...
});
assertErrorThrownAsync(function () {
return dbFileLoadAsync({
db
});
}, "invalid filename undefined");
assertErrorThrownAsync(function () {
return dbFileSaveAsync({
db
});
}, "invalid filename undefined");
await dbExecAsync({
db,
sql: "CREATE TABLE t01 AS SELECT 1 AS c01"
});
...
-
- Description and source-code:
async function dbNoopAsync(...argList) {
return await dbCallAsync(jsbatonCreate("_dbNoop"), argList);
}
- Example usage:
...
// 8. undefined
[undefined, 0]
].map(async function ([valIn, valExpect], ii) {
let baton;
let valActual;
if (valExpect === Error) {
assertErrorThrownAsync(function () {
return dbNoopAsync(undefined, valIn, undefined);
}, "invalid arg|integer");
return;
}
baton = await dbNoopAsync(undefined, valIn, undefined);
baton = baton[0];
valActual = (
typeof valIn === "string"
...
-
- Description and source-code:
async function dbOpenAsync({
afterFinalization,
dbData,
filename,
flags,
threadCount = 1
}) {
// int sqlite3_open_v2(
// const char *filename, /* Database filename (UTF-8) */
// sqlite3 **ppDb, /* OUT: SQLite db handle */
// int flags, /* Flags */
// const char *zVfs /* Name of VFS module to use */
// );
let connPool;
let db = {busy: 0, filename, ii: 0};
assertOrThrow(typeof filename === "string", `invalid filename ${filename}`);
assertOrThrow(
!dbData || isExternalBuffer(dbData),
"dbData must be ArrayBuffer"
);
connPool = await Promise.all(Array.from(new Array(
threadCount
), async function () {
let [ptr] = await dbCallAsync(
jsbatonCreate("_dbOpen"),
[
// 0. const char *filename, Database filename (UTF-8)
filename,
// 1. sqlite3 **ppDb, OUT: SQLite db handle
undefined,
// 2. int flags, Flags
flags ?? (
SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE | SQLITE_OPEN_URI
),
// 3. const char *zVfs Name of VFS module to use
undefined,
// 4. wasm-only - arraybuffer of raw sqlite-database
dbData
]
);
ptr = [ptr.getBigInt64(JSBATON_OFFSET_ARGV + 0, true)];
dbFinalizationRegistry.register(db, {afterFinalization, ptr});
return ptr;
}));
db.connPool = connPool;
return db;
}
- Example usage:
...
jstestDescribe((
"test_sqlmathWebworkerInit"
), function test_sqlmathWebworkerInit() {
jstestIt((
"test sqlmathWebworkerInit handling-behavior"
), async function () {
let db = await dbOpenAsync({
dbData: new ArrayBuffer(),
filename: ":memory:"
});
sqlmathWebworkerInit({
db,
modeTest: true
});
...
-
- Description and source-code:
async function dbTableImportAsync({
db,
mode,
tableName,
textData
}) {
// this function will create table from imported csv/json <textData>
let colList;
let rowList;
let rowidList;
let tmp;
switch (mode) {
case "csv":
rowList = jsonRowListFromCsv({
csv: textData
});
break;
case "tsv":
rowList = [];
textData.trimEnd().replace((/.+/g), function (line) {
rowList.push(line.split("\t"));
});
break;
// case "json":
default:
rowList = JSON.parse(textData);
}
if (!(typeof rowList === "object" && rowList)) {
rowList = [];
}
// normalize rowList to list
if (!Array.isArray(rowList)) {
rowidList = [];
rowList = Object.entries(rowList).map(function ([
key, val
]) {
rowidList.push(key);
return val;
});
}
// normalize rowList[ii] to list
if (rowList.length === 0) {
rowList.push([
"undefined"
]);
}
if (!Array.isArray(rowList[0])) {
colList = Array.from(
new Set(
rowList.map(function (obj) {
return Object.keys(obj);
}).flat()
)
);
rowList = rowList.map(function (obj) {
return colList.map(function (key) {
return obj[key];
});
});
rowList.unshift(colList);
}
// init colList
colList = rowList.shift();
// preserve rowid
if (rowidList) {
colList.unshift("rowid");
rowList.forEach(function (row, ii) {
row.unshift(rowidList[ii]);
});
}
// normalize colList
tmp = new Set();
colList = colList.map(function (colName) {
let colName2;
let duplicate = 0;
colName = "c_" + colName.toLowerCase().replace((
/\W/g
), "_");
while (true) {
duplicate += 1;
colNam...
}
- Example usage:
...
duplicate_header,duplicate_header
"aaa","b""bb","ccc"
"aaa","b
bb","ccc"
zzz,yyy,xxx
`).trim()
}),
dbTableImportAsync({
db,
mode: "json",
tableName: "__json0",
textData: "null"
}),
dbTableImportAsync({
db,
...
-
- Description and source-code:
function debug(...argv) {
__consoleError("\n\ndebugInline");
__consoleError(...argv);
__consoleError("\n");
return argv[0];
}
- Example usage:
N/A
-
- Description and source-code:
async function fsCopyFileUnlessTest(file1, file2, mode) {
if (npm_config_mode_test && mode !== "force") {
return;
}
await moduleFs.promises.copyFile(file1, file2, mode | 0);
}
- Example usage:
...
jstestDescribe((
"test_fsXxx"
), function test_fsXxx() {
jstestIt((
"test fsXxx handling-behavior"
), async function () {
await Promise.all([
fsCopyFileUnlessTest("", ""),
fsExistsUnlessTest(""),
fsReadFileUnlessTest("", ""),
fsWriteFileUnlessTest("", ""),
//
fsCopyFileUnlessTest(
"package.json",
".tmp/test_fsCopyFileUnlessTest_force",
...
-
- Description and source-code:
async function fsExistsUnlessTest(file, mode) {
if (npm_config_mode_test && mode !== "force") {
return false;
}
try {
await moduleFs.promises.access(file);
return true;
} catch (ignore) {
return false;
}
}
- Example usage:
...
"test_fsXxx"
), function test_fsXxx() {
jstestIt((
"test fsXxx handling-behavior"
), async function () {
await Promise.all([
fsCopyFileUnlessTest("", ""),
fsExistsUnlessTest(""),
fsReadFileUnlessTest("", ""),
fsWriteFileUnlessTest("", ""),
//
fsCopyFileUnlessTest(
"package.json",
".tmp/test_fsCopyFileUnlessTest_force",
"force"
...
-
- Description and source-code:
async function fsReadFileUnlessTest(file, mode, defaultData) {
if (npm_config_mode_test && mode !== "force") {
return defaultData;
}
return await moduleFs.promises.readFile(
file,
mode && mode.replace("force", "utf8")
);
}
- Example usage:
...
valActual = valActual.replace((/ /g), "\t");
valActual = valActual.trim() + "\n";
await fsWriteFileUnlessTest(
"test_data_sinefit.csv",
valActual,
String("1").replace(npm_config_mode_test_save, "force")
);
valExpect = await fsReadFileUnlessTest(
"test_data_sinefit.csv",
"force"
);
assertJsonEqual(valActual, valExpect);
}())
]);
});
...
-
- Description and source-code:
async function fsWriteFileUnlessTest(file, data, mode) {
if (npm_config_mode_test && mode !== "force") {
return;
}
await moduleFs.promises.writeFile(file, data);
}
- Example usage:
...
}).join(" ");
}).join("\n")
);
valActual = valActual.replace((/ /g), " null ");
valActual = valActual.replace((/ \n/g), "\n");
valActual = valActual.replace((/ /g), "\t");
valActual = valActual.trim() + "\n";
await fsWriteFileUnlessTest(
"test_data_sinefit.csv",
valActual,
String("1").replace(npm_config_mode_test_save, "force")
);
valExpect = await fsReadFileUnlessTest(
"test_data_sinefit.csv",
"force"
...
-
- Description and source-code:
function jsbatonGetInt64(baton, argi) {
return baton.getBigInt64(JSBATON_OFFSET_ARGV + argi * 8, true);
}
- Example usage:
...
return;
}
baton = await dbNoopAsync(undefined, valIn, undefined);
baton = baton[0];
valActual = (
typeof valIn === "string"
? jsbatonGetString(baton, 1)
: String(jsbatonGetInt64(baton, 1))
);
valExpect = String(valExpect);
if (typeof valIn === "bigint") {
valIn = String(valIn);
}
assertJsonEqual(valActual, valExpect, {
ii,
...
-
- Description and source-code:
function jsbatonGetString(baton, argi) {
let offset = baton.getInt32(JSBATON_OFFSET_ARGV + argi * 8, true);
return new TextDecoder().decode(new Uint8Array(
baton.buffer,
baton.byteOffset + offset + 1 + 4,
// remove null-terminator from string
baton.getInt32(offset + 1, true) - 1
));
}
- Example usage:
...
}, "invalid arg|integer");
return;
}
baton = await dbNoopAsync(undefined, valIn, undefined);
baton = baton[0];
valActual = (
typeof valIn === "string"
? jsbatonGetString(baton, 1)
: String(jsbatonGetInt64(baton, 1))
);
valExpect = String(valExpect);
if (typeof valIn === "bigint") {
valIn = String(valIn);
}
assertJsonEqual(valActual, valExpect, {
...
-
- Description and source-code:
function listOrEmptyList(list) {
return list || [];
}
- Example usage:
...
await assertErrorThrownAsync(function () {
assertOrThrow(undefined, "undefined");
}, "undefined");
await assertErrorThrownAsync(function () {
assertOrThrow(undefined, new Error());
}, "");
// test listOrEmptyList null-case handling-behavior
assertJsonEqual(listOrEmptyList(), []);
// test waitAsync null-case handling-behavior
await waitAsync();
});
});
jstestDescribe((
"test_sqlite"
...
-
- Description and source-code:
function noop(val) {
return val;
}
- Example usage:
...
}).forEach(function ([
arg, funcDict
]) {
Object.entries(funcDict).forEach(async function ([
func, valExpect
]) {
let sql = `SELECT ${func}(${arg}) AS val`;
let valActual = noop(
await dbExecAndReturnFirstRow({
db,
sql
})
).val;
assertJsonEqual(valActual, valExpect, {
sql,
...
-
- Description and source-code:
function objectDeepCopyWithKeysSorted(obj) {
let sorted;
if (typeof obj !== "object" || !obj) {
return obj;
}
// Recursively deep-copy list with child-keys sorted.
if (Array.isArray(obj)) {
return obj.map(objectDeepCopyWithKeysSorted);
}
// Recursively deep-copy obj with keys sorted.
sorted = Object.create(null);
Object.keys(obj).sort().forEach(function (key) {
sorted[key] = objectDeepCopyWithKeysSorted(obj[key]);
});
return sorted;
}
- Example usage:
...
return obj.map(objectDeepCopyWithKeysSorted);
}
// Recursively deep-copy obj with keys sorted.
sorted = Object.create(null);
Object.keys(obj).sort().forEach(function (key) {
sorted[key] = objectDeepCopyWithKeysSorted(obj[key]);
});
return sorted;
}
async function sqlmathInit() {
// This function will init sqlmath.
...
-
- Description and source-code:
function sqlmathWebworkerInit({
db,
modeTest
}) {
// Feature-detect browser.
let Worker = globalThis.Worker;
IS_BROWSER = true;
if (modeTest) {
Worker = function () {
return;
};
}
sqlWorker = new Worker("sqlmath_wasm.js");
sqlWorker.onmessage = function ({
data
}) {
sqlMessageDict[data.id](data);
};
if (modeTest) {
sqlWorker.postMessage = function (data) {
setTimeout(function () {
sqlWorker.onmessage({data});
});
};
// test dbCallAsync handling-behavior
dbCallAsync(jsbatonCreate("testTimeElapsed"), [true]);
// test dbFileLoadAsync handling-behavior
dbFileLoadAsync({db, filename: "aa", modeTest});
// test jsonParseArraybuffer handling-behavior
jsonParseArraybuffer(new TextEncoder().encode("0"));
// revert IS_BROWSER
IS_BROWSER = undefined;
}
}
- Example usage:
...
jstestIt((
"test sqlmathWebworkerInit handling-behavior"
), async function () {
let db = await dbOpenAsync({
dbData: new ArrayBuffer(),
filename: ":memory:"
});
sqlmathWebworkerInit({
db,
modeTest: true
});
});
});
...
-
- Description and source-code:
function waitAsync(timeout) {
return new Promise(function (resolve) {
setTimeout(resolve, timeout * !npm_config_mode_test);
});
}
- Example usage:
...
}, "undefined");
await assertErrorThrownAsync(function () {
assertOrThrow(undefined, new Error());
}, "");
// test listOrEmptyList null-case handling-behavior
assertJsonEqual(listOrEmptyList(), []);
// test waitAsync null-case handling-behavior
await waitAsync();
});
});
jstestDescribe((
"test_sqlite"
), function test_sqlite() {
jstestIt((
...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-