mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-21 00:32:51 +02:00
JEST: Refactor tests that add home server manually (#2358)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Player, setPlayer } from "@player";
|
||||
import { Player } from "@player";
|
||||
import { AugmentationName, GoColor, GoOpponent, GoPlayType } from "@enums";
|
||||
import { Go } from "../../../src/Go/Go";
|
||||
import {
|
||||
@@ -22,33 +22,21 @@ import {
|
||||
resetBoardState,
|
||||
validateMove,
|
||||
} from "../../../src/Go/effects/netscriptGoImplementation";
|
||||
import { PlayerObject } from "../../../src/PersonObjects/Player/PlayerObject";
|
||||
import "../../../src/Faction/Factions";
|
||||
import { getNewBoardState, getNewBoardStateFromSimpleBoard } from "../../../src/Go/boardState/boardState";
|
||||
import { installAugmentations } from "../../../src/Augmentation/AugmentationHelpers";
|
||||
import { AddToAllServers } from "../../../src/Server/AllServers";
|
||||
import { Server } from "../../../src/Server/Server";
|
||||
import { initSourceFiles } from "../../../src/SourceFile/SourceFiles";
|
||||
import { getMockedNetscriptContext } from "../Utilities";
|
||||
import { getMockedNetscriptContext, initGameEnvironment, setupBasicTestingEnvironment } from "../Utilities";
|
||||
|
||||
jest.mock("../../../src/Faction/Factions", () => ({
|
||||
Factions: {},
|
||||
}));
|
||||
initGameEnvironment();
|
||||
|
||||
beforeEach(() => {
|
||||
setupBasicTestingEnvironment();
|
||||
});
|
||||
|
||||
jest.mock("../../../src/ui/GameRoot", () => ({
|
||||
Router: {
|
||||
page: () => ({}),
|
||||
toPage: () => ({}),
|
||||
},
|
||||
}));
|
||||
const mockLogger: (s: string) => void = jest.fn();
|
||||
const mockCtx = getMockedNetscriptContext((_: string, txt: () => string) => {
|
||||
mockLogger(txt());
|
||||
});
|
||||
|
||||
setPlayer(new PlayerObject());
|
||||
AddToAllServers(new Server({ hostname: "home" }));
|
||||
|
||||
describe("Netscript Go API unit tests", () => {
|
||||
describe("makeMove() tests", () => {
|
||||
it("should handle invalid moves", () => {
|
||||
@@ -365,7 +353,6 @@ describe("Netscript Go API unit tests", () => {
|
||||
|
||||
it("should have a scaled chance based on layer cheat success level", () => {
|
||||
Player.setBitNodeNumber(13);
|
||||
initSourceFiles();
|
||||
Player.queueAugmentation(AugmentationName.BrachiBlades);
|
||||
Player.queueAugmentation(AugmentationName.GrapheneBrachiBlades);
|
||||
Player.queueAugmentation(AugmentationName.INFRARet);
|
||||
|
||||
Reference in New Issue
Block a user