format and lint

This commit is contained in:
Snarling 2022-10-01 15:15:36 -04:00
parent 9774235404
commit 3addda7173
6 changed files with 15 additions and 15 deletions

@ -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
@ -87,8 +85,7 @@ describe("Netscript Dynamic RAM Calculation/Generation Tests", function () {
let curr = fnDesc.reduce((prev, curr) => {
try {
return prev[curr];
}
catch{
} catch {
throw new Error(`Invalid function: [${fnDesc}]`);
}
}, scope as any);
@ -149,8 +146,7 @@ describe("Netscript Dynamic RAM Calculation/Generation Tests", function () {
let curr = fnDesc.reduce((prev, curr) => {
try {
return prev[curr];
}
catch{
} catch {
throw new Error(`Invalid function: [${fnDesc}]`);
}
}, scope as any);

@ -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);
});
});