53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
"use strict";
|
|
|
|
const Mimicry = require("../node");
|
|
|
|
test();
|
|
function test () {
|
|
if (!Mimicry) {
|
|
log("Mimicry class was not loaded");
|
|
return;
|
|
}
|
|
|
|
log("Mimicry class is loaded");
|
|
log("Mimicry ready: " + Mimicry.ready);
|
|
|
|
let mimicry;
|
|
try {
|
|
mimicry = new Mimicry({
|
|
baseUrl: "test"
|
|
});
|
|
global.mimicry = mimicry;
|
|
global.Mimicry = Mimicry;
|
|
log("Mimicry was successfully instantiated");
|
|
} catch (e) {
|
|
log("Error instantiating Mimicry");
|
|
return;
|
|
}
|
|
|
|
try {
|
|
mimicry.module(["module"], function (global, [module]) {
|
|
log("Mimicry empty module successfully resolved");
|
|
log("The background now is supposed to be bluish if you're testing in browser")
|
|
if (module === true)
|
|
log("Value returned from additional module is correct");
|
|
else
|
|
log("Value returned from additional module is \"" + module + "\", which is incorrect");
|
|
|
|
const json = mimicry.getAsset("simple");
|
|
if (json instanceof Object && json.I === "am")
|
|
log("loaded by one of the modules asset (json) is present and valid");
|
|
else
|
|
log("loaded by one of the modules asset (json) is not present or invalid");
|
|
|
|
});
|
|
log("Successfully launched Mimicry empty module");
|
|
} catch (e) {
|
|
log("Error launching Mimicry empty module");
|
|
//return;
|
|
}
|
|
}
|
|
|
|
function log (message) {
|
|
console.log(message);
|
|
} |