bitburner-src/test/jest/Script/Script.test.ts
omuretsu 7f852373d8 Fix test
Was using old method of saving scripts which is now removed (was removing possible sources of the script hostname mismatch error)
2023-05-28 05:43:09 -04:00

25 lines
833 B
TypeScript

import { resolveScriptFilePath } from "../../../src/Paths/ScriptFilePath";
import { Server } from "../../../src/Server/Server";
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 hostname = "TestServer";
const server = new Server({ hostname });
const filename = resolveScriptFilePath("test.js");
if (!filename) throw new Error("Could not resolve hardcoded filepath.");
server.writeToContentFile(filename, code);
const script = server.scripts.get(filename);
if (!script) throw new Error("Script was not saved.");
expect(script.filename).toEqual(filename);
expect(script.code).toEqual(code);
expect(script.server).toEqual(hostname);
});
});