mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-21 23:23:51 +01:00
Fix test
Was using old method of saving scripts which is now removed (was removing possible sources of the script hostname mismatch error)
This commit is contained in:
parent
ae8f26f03b
commit
7f852373d8
@ -1,4 +1,5 @@
|
|||||||
import { Script } from "../../../src/Script/Script";
|
import { resolveScriptFilePath } from "../../../src/Paths/ScriptFilePath";
|
||||||
|
import { Server } from "../../../src/Server/Server";
|
||||||
|
|
||||||
const code = `/** @param {NS} ns */
|
const code = `/** @param {NS} ns */
|
||||||
export async function main(ns) {
|
export async function main(ns) {
|
||||||
@ -7,13 +8,17 @@ export async function main(ns) {
|
|||||||
|
|
||||||
describe("Validate Save Script Works", function () {
|
describe("Validate Save Script Works", function () {
|
||||||
it("Save", function () {
|
it("Save", function () {
|
||||||
const server = "home";
|
const hostname = "TestServer";
|
||||||
const filename = "test.js";
|
const server = new Server({ hostname });
|
||||||
const script = new Script();
|
const filename = resolveScriptFilePath("test.js");
|
||||||
script.saveScript(filename, code, server);
|
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.filename).toEqual(filename);
|
||||||
expect(script.code).toEqual(code);
|
expect(script.code).toEqual(code);
|
||||||
expect(script.server).toEqual(server);
|
expect(script.server).toEqual(hostname);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user