mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-21 23:23:51 +01:00
Add Test
This commit is contained in:
parent
5f864c123b
commit
c9391130f4
29
test/Script/Script.test.ts
Normal file
29
test/Script/Script.test.ts
Normal file
@ -0,0 +1,29 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
import { jest, describe, expect, test } from "@jest/globals";
|
||||
|
||||
import { Script } from "../../src/Script/Script";
|
||||
import { Player } from "../../src/Player";
|
||||
|
||||
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)
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user