mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-17 21:23:54 +01:00
format and lint
This commit is contained in:
parent
9774235404
commit
3addda7173
2
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
2
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -75,7 +75,7 @@ interface Player {
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Multipliers {
|
||||
export interface Multipliers {
|
||||
/** Multiplier to hacking skill */
|
||||
hacking?: number;
|
||||
/** Multiplier to strength skill */
|
||||
|
@ -803,7 +803,9 @@ export function Root(props: IProps): React.ReactElement {
|
||||
...colorProps,
|
||||
};
|
||||
|
||||
const scriptTabText = `${hostname}:~${fileName.startsWith("/") ? "" : "/"}${fileName} ${dirty(index)}`;
|
||||
const scriptTabText = `${hostname}:~${fileName.startsWith("/") ? "" : "/"}${fileName} ${dirty(
|
||||
index,
|
||||
)}`;
|
||||
return (
|
||||
<Draggable
|
||||
key={fileName + hostname}
|
||||
|
@ -62,7 +62,7 @@ class NumeralFormatter {
|
||||
if (n === Infinity) return "∞";
|
||||
for (let i = 0; i < extraFormats.length; i++) {
|
||||
if (extraFormats[i] < nAbs && nAbs <= extraFormats[i] * 1000) {
|
||||
return this.format(n as number / extraFormats[i], "0." + "0".repeat(decimalPlaces)) + extraNotations[i];
|
||||
return this.format((n as number) / extraFormats[i], "0." + "0".repeat(decimalPlaces)) + extraNotations[i];
|
||||
}
|
||||
}
|
||||
if (nAbs < 1000) {
|
||||
|
@ -5,8 +5,6 @@ import { RunningScript } from "../../../src/Script/RunningScript";
|
||||
import { Script } from "../../../src/Script/Script";
|
||||
import { WorkerScript } from "../../../src/Netscript/WorkerScript";
|
||||
|
||||
|
||||
|
||||
describe("Netscript Dynamic RAM Calculation/Generation Tests", function () {
|
||||
const ScriptBaseCost = RamCostConstants.ScriptBaseRamCost;
|
||||
// Creates a mock RunningScript object
|
||||
@ -85,10 +83,9 @@ describe("Netscript Dynamic RAM Calculation/Generation Tests", function () {
|
||||
// Run the function through the workerscript's args
|
||||
const scope = workerScript.env.vars;
|
||||
let curr = fnDesc.reduce((prev, curr) => {
|
||||
try{
|
||||
try {
|
||||
return prev[curr];
|
||||
}
|
||||
catch{
|
||||
} catch {
|
||||
throw new Error(`Invalid function: [${fnDesc}]`);
|
||||
}
|
||||
}, scope as any);
|
||||
@ -143,14 +140,13 @@ describe("Netscript Dynamic RAM Calculation/Generation Tests", function () {
|
||||
scriptRef: runningScript,
|
||||
};
|
||||
workerScript.env.vars = NetscriptFunctions(workerScript as unknown as WorkerScript);
|
||||
|
||||
|
||||
// Run the function through the workerscript's args
|
||||
const scope = workerScript.env.vars;
|
||||
let curr = fnDesc.reduce((prev, curr) => {
|
||||
try{
|
||||
try {
|
||||
return prev[curr];
|
||||
}
|
||||
catch{
|
||||
} catch {
|
||||
throw new Error(`Invalid function: [${fnDesc}]`);
|
||||
}
|
||||
}, scope as any);
|
||||
|
@ -283,8 +283,8 @@ describe("Terminal Directory Tests", function () {
|
||||
});
|
||||
|
||||
it("should return false for invalid inputs (inputs that aren't filepaths)", function () {
|
||||
expect(isInRootDirectory(null as unknown as string)).toEqual(false);
|
||||
expect(isInRootDirectory(undefined as unknown as string)).toEqual(false);
|
||||
expect(isInRootDirectory(null as unknown as string)).toEqual(false);
|
||||
expect(isInRootDirectory(undefined as unknown as string)).toEqual(false);
|
||||
expect(isInRootDirectory("")).toEqual(false);
|
||||
expect(isInRootDirectory(" ")).toEqual(false);
|
||||
expect(isInRootDirectory("a")).toEqual(false);
|
||||
|
@ -241,6 +241,8 @@ describe("Finding the number furthest away from 0", () => {
|
||||
expect(numeralWrapper.largestAbsoluteNumber(789123, -123456, -456789)).toEqual(789123);
|
||||
});
|
||||
test("Should return 0 for invalid input", () => {
|
||||
expect(numeralWrapper.largestAbsoluteNumber("abc" as unknown as number, undefined, null as unknown as number)).toEqual(0);
|
||||
expect(
|
||||
numeralWrapper.largestAbsoluteNumber("abc" as unknown as number, undefined, null as unknown as number),
|
||||
).toEqual(0);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user