mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 09:43:54 +01:00
6b7be9f87b
Cypress and Jest both define "expect", but they come from different libraries (Cypress uses Chai, Jest uses its own thing). So we can't include both of them in the tsconfig.json. Conveniently, however, we don't need any of the test code to be part of the main project, so it suffices to give cypress its own tsconfig.json file. That being done, adding "jest" to the global types lets us remove all those imports.
26 lines
701 B
TypeScript
26 lines
701 B
TypeScript
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);
|
|
});
|
|
});
|