mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-04 21:43:48 +01:00
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
import { getDefaultAllGangs } from "../../../src/Gang/AllGangs";
|
|
import { JsonSchemaValidator } from "../../../src/JsonSchema/JsonSchemaValidator";
|
|
|
|
describe("Success", () => {
|
|
test("Default AllGangs", () => {
|
|
const defaultAllGangs = getDefaultAllGangs();
|
|
expect(JsonSchemaValidator.AllGangs(defaultAllGangs)).toStrictEqual(true);
|
|
});
|
|
});
|
|
|
|
describe("Failure", () => {
|
|
test("Do not have all gangs", () => {
|
|
const defaultAllGangs = getDefaultAllGangs() as Record<string, unknown>;
|
|
delete defaultAllGangs["Slum Snakes"];
|
|
expect(JsonSchemaValidator.AllGangs(defaultAllGangs)).toStrictEqual(false);
|
|
});
|
|
test("Have an unexpected gang", () => {
|
|
const defaultAllGangs = getDefaultAllGangs() as Record<string, unknown>;
|
|
defaultAllGangs["CyberSec"] = {
|
|
power: 1,
|
|
territory: 1 / 7,
|
|
};
|
|
expect(JsonSchemaValidator.AllGangs(defaultAllGangs)).toStrictEqual(false);
|
|
});
|
|
test("Have invalid power", () => {
|
|
const defaultAllGangs = getDefaultAllGangs() as Record<string, unknown>;
|
|
defaultAllGangs["Slum Snakes"] = {
|
|
power: "1",
|
|
territory: 1 / 7,
|
|
};
|
|
expect(JsonSchemaValidator.AllGangs(defaultAllGangs)).toStrictEqual(false);
|
|
});
|
|
test("Have invalid territory", () => {
|
|
const defaultAllGangs = getDefaultAllGangs() as Record<string, unknown>;
|
|
defaultAllGangs["Slum Snakes"] = {
|
|
power: 1,
|
|
territory: "1 / 7",
|
|
};
|
|
expect(JsonSchemaValidator.AllGangs(defaultAllGangs)).toStrictEqual(false);
|
|
});
|
|
});
|