2022-01-15 04:32:44 +01:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
import { jest, describe, expect, test } from "@jest/globals";
|
|
|
|
|
2022-01-25 22:24:09 +01:00
|
|
|
import { Script } from "../../../src/Script/Script";
|
|
|
|
import { Player } from "../../../src/Player";
|
2022-01-15 04:32:44 +01:00
|
|
|
|
|
|
|
jest.mock(`!!raw-loader!../NetscriptDefinitions.d.ts`, () => "", {
|
|
|
|
virtual: true,
|
|
|
|
});
|
|
|
|
|
|
|
|
const code = `/** @param {NS} ns **/
|
|
|
|
export async function main(ns) {
|
|
|
|
ns.print(ns.getWeakenTime('n00dles'));
|
|
|
|
}`;
|
|
|
|
|
|
|
|
describe("Validate Save Script Works", function () {
|
|
|
|
|
|
|
|
it("Save", function () {
|
|
|
|
const server = "home";
|
|
|
|
const filename = "test.js";
|
|
|
|
const player = Player;
|
|
|
|
const script = new Script();
|
|
|
|
script.saveScript(player, filename, code, server, []);
|
|
|
|
|
|
|
|
expect(script.filename).toEqual(filename)
|
|
|
|
expect(script.code).toEqual(code)
|
|
|
|
expect(script.server).toEqual(server)
|
|
|
|
});
|
2022-01-25 22:24:09 +01:00
|
|
|
});
|