mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-21 23:23:51 +01:00
06553d9700
If the game takes long enough to load, certain counters can become eligible to run as soon as Engine.start() runs. When this happens, eventually Router.page() is called, which throws an Error since Router isn't initialized yet. (Dropping a breakpoint before Engine.start() and waiting at least 30 seconds is enough to reliably repro, but I have seen this both live and in tests.) This fixes it so that Router.page() is valid immediately, returning a value of Page.LoadingScreen. It also removes the isInitialized field, since this is now redundant. Trying to switch pages is still an error, but that doesn't happen without user input, whereas checking the current page is quite common. This also consolidates a check for "should we show toasts" behind a function in Router, making the logic central and equal for a few usecases. This means (for instance) that the "autosave is disabled" logic won't run during infiltration. (The toast should have already been suppressed.) |
||
---|---|---|
.. | ||
__snapshots__ | ||
Alias | ||
Go | ||
Imports | ||
Messages | ||
Netscript | ||
Script | ||
Terminal | ||
ui | ||
Corporation.test.ts | ||
FullSave.test.ts | ||
Grow.test.ts | ||
README.md | ||
Save.test.ts | ||
StockMarket.test.ts | ||
StringHelperFunctions.test.ts |
Unit Tests
This directory contains unit tests for Bitburner.
Unit tests use jest.
Running
Run tests with: npm run test
To watch for changes: npm run test:watch