mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-06-02 16:19:48 -04:00
Add scar tests.
This commit is contained in:
parent
1cba9290b6
commit
c4fa90a747
12 changed files with 263 additions and 3 deletions
32
test-scar/tests/unit/config.js
Normal file
32
test-scar/tests/unit/config.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
const {test, assert} = require('scar');
|
||||
|
||||
const ID = 'config';
|
||||
const DEPS = [];
|
||||
|
||||
const getDef = () => window.modulejs._private.definitions[ID];
|
||||
const createInst = () => getDef().fn();
|
||||
|
||||
test(`module '${ID}' is defined`, () => {
|
||||
assert.ok(getDef());
|
||||
});
|
||||
|
||||
test(`module '${ID}' has correct id`, () => {
|
||||
assert.equal(getDef().id, ID);
|
||||
});
|
||||
|
||||
test(`module '${ID}' has correct deps`, () => {
|
||||
assert.deepEqual(getDef().deps, DEPS);
|
||||
});
|
||||
|
||||
test(`module '${ID}' has args for each dependency`, () => {
|
||||
const def = getDef();
|
||||
assert.deepEqual(def.deps.length, def.fn.length);
|
||||
});
|
||||
|
||||
test(`module '${ID}' inits without errors`, () => {
|
||||
createInst();
|
||||
});
|
||||
|
||||
test(`module '${ID}' is only dummy definiton`, () => {
|
||||
assert.deepEqual(createInst(), {_dummyConfig: true});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue