Repository navigation
Expand file tree
/
Copy pathbundle.test.js
More file actions
44 lines (38 loc) · 1.51 KB
/
Copy pathbundle.test.js
File metadata and controls
44 lines (38 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/** @file
* Tests implementations as a Javascript browser bundle.
*
* This file is a translation of the library.test.ts file,
* to test the bundles instead of the libraries.
* The changes are:
* - removal of TypeScript-specific syntax and types
* - additional import of "./self-in-node.js"
* - imports from "../bundle/.../api.js" instead of "vc-prototyping-library/..."
* - test suite description
*/
// We need the next import because the SolidApi implementation relies on self (used in the crypto library)
// which is not defined in the Vitest node environment we are using here.
// Note that we stick to the Vitest node environment because of ./utils.js, which uses node's fs module.
import "./self-in-node.js";
import { describe } from "vitest";
import { loadConfig, sharedTests } from "./shared.js";
// To support extra implementations: add imports similar to the one for solid
import { SolidApi } from "../bundle/solid/api.js";
const implementations = [
// To support extra implementations: add entries similar to the one for solid
{
name: "solid",
cases: [
{
description: "without preloaded contexts",
api: new SolidApi(loadConfig("./test/configs/solid-config-no-preloads.json"))
},
{
description: "with preloaded contexts",
api: new SolidApi(loadConfig("./test/configs/solid-config.json"))
}
]
}
];
describe.each(implementations)("Testing implementation $name as a Javascript browser bundle", ({ name, cases }) => {
sharedTests(name, cases);
});