Commit Graph

35 Commits

Author SHA1 Message Date
David Walker
ed9e6d5ea3
NETSCRIPT: Compiled modules will be even more shared (#468) 2023-04-07 21:08:39 -04:00
David Walker
8c4b992d59
TEST: Add a NS2 test (finally) (#458) 2023-04-01 07:45:23 -04:00
Snarling
759f86d6e5
NETSCRIPT: Rework script ram updates (#408) 2023-03-05 22:39:42 -05:00
David Walker
4eef9eec03
NETSCRIPT: More ns Proxy changes (#297) 2023-01-05 20:41:24 -05:00
Snarling
31bf0c43d1 v2.2.1 (#293)
* handle enums differently
* Enums are frozen and fed directly to the proxy
* Enums are not included in the NSFull definition, allowing samekeys for RamCostTree<API>, InternalAPI<API>, and ExternalAPI<API>
* Rewrote a lot of the ramcalc test, with better typing thanks to the samekeys above
* Fix ns1 for proxy (args, pid, and enums after above changes were not being added to ns1 scripts.)
* Fixed an overview issue where the bars could display inaccurately.
Update changelog and bump version to 2.2.1
2023-01-04 09:45:17 -05:00
David Walker
5f18b87323
New ns implementation using Proxy (#292) 2023-01-04 08:56:29 -05:00
omuretsu
dfa691784c Fix test for removedFunction in singularity 2023-01-02 13:47:04 -05:00
Snarling
fb1f95c26e
VARIOUS: Various changes prior to release 2.2 (#271)
See PR #271 description
2022-12-29 20:28:53 -05:00
David Walker
ce1879fb62
Add a test for basic Netscript functionality. (#235) 2022-11-29 07:32:08 -05:00
Snarling
6af36e3b29
NETSCRIPT: Faster API wrapping on script launch. (#229)
* ns API is wrapped once
* when a new workerscript is created, each layer of ns is stamped with a private workerscript field that allows the functions to work.
* Test has been refactored to account for new method of wrapping
* BREAKING: ns functions need access to `this` value of their parent ns layer (or any ns layer)
* Enums are passed directly to player (no cloning) but are frozen.
2022-11-28 09:11:55 -05:00
Snarling
b275f88053
NETSCRIPT: Expose more enums for player use (#198)
* Add support for enums at other ns layers
* APIWrapper: simplified wrapping algorithm and modified to just use cloneDeep to copy enums instead of recursively wrapping enums as if they were new API layers
* Improve APIWrapper typing
* Changed some typings at RamCostGenerator to allow for enums at different levels without enums needing a ram cost
* Added enums to ns.corporation, removed getter functions that were being used instead.
* Add FactionWorkType for player use
* Add ClassType and CompanyWorkPos enums
* Change netscriptDefinitions to expect members of these new enums where appropriate.
2022-11-09 13:46:21 -05:00
Snarling
0310a98237 Lint+format fix? 2022-10-05 15:29:56 -04:00
Snarling
a78a84c5b5 Make ram checks more robust
* Instead of hardcoded categories, automatically walk through all layers of ns, check for their associated costs, and check that ingame static and dynamic costs match the expected assigned costs.
2022-10-05 13:14:24 -04:00
Snarling
8bb88a5080 Better RamCost testing (see desc)
* RamCostGenerator will have an error if ramcosts are defined for nonexistent functions, in addition to error if not all functions have ram costs defined
* Removed a few random blank comment lines in NetscriptDefinitions.d.ts
* RamCalculation.test.ts checks exact expected static and dynamic ram usage from (almost) every function, based on defined RamCosts in RamCostGenerator.
2022-10-05 10:42:07 -04:00
Snarling
e71e5988cb unify static and dynamic ram tests 2022-10-04 11:56:36 -04:00
Snarling
94a8c7ca64 attempt2
For some reason only 3/9 tests running locally
2022-10-01 15:28:48 -04:00
Snarling
3addda7173 format and lint 2022-10-01 15:15:36 -04:00
Snarling
9774235404 initial test fix attempt 2022-10-01 15:03:47 -04:00
phyzical
9b6b9a795b
remove redundant tests
hotfix/test-fixes

File List:
test/jest/Netscript/DynamicRamCalculation.test.js
test/jest/Netscript/StaticRamCalculation.test.js
2022-08-01 16:44:49 +08:00
Olivier Gagnon
43b8cfec5c fix test suite 2022-07-21 02:13:47 -04:00
Olivier Gagnon
c1650e332b lint fixes 2022-05-25 15:08:48 -04:00
JP Sugarbroad
01529a8347 fix typing conflict between jest and cypress
Cypress and Jest both define "expect", but they come from different
libraries (Cypress uses Chai, Jest uses its own thing). So we can't
include both of them in the tsconfig.json. Conveniently, however, we
don't need any of the test code to be part of the main project, so
it suffices to give these things their own tsconfig.json files.

That being done, adding "jest" to the global types lets us remove all
those imports.
2022-05-10 22:26:54 -07:00
hydroflame
c5bc47abf0
Revert "MISC: fix typing conflict between jest and cypress" 2022-05-04 12:14:31 -04:00
JP Sugarbroad
6b7be9f87b fix typing conflict between jest and cypress
Cypress and Jest both define "expect", but they come from different
libraries (Cypress uses Chai, Jest uses its own thing). So we can't
include both of them in the tsconfig.json. Conveniently, however, we
don't need any of the test code to be part of the main project, so
it suffices to give cypress its own tsconfig.json file.

That being done, adding "jest" to the global types lets us remove all
those imports.
2022-04-25 22:10:27 -07:00
TheMas3212
68ddf1d588
Fix test/jest/Netscript/DynamicRamCalculation.test.js 2022-04-15 01:12:05 +10:00
Olivier Gagnon
7d4bf90b40 fmtlinttest 2022-04-06 20:18:25 -04:00
hydroflame
b6d68f7353
Merge branch 'dev' into bugfix/fix-tests 2022-04-06 20:16:51 -04:00
Olivier Gagnon
48f80f25d6 fmt and lint 2022-04-06 19:30:08 -04:00
phyzical
18af3f8413 moved updateRam to first call to avoid lack of mocks for tests
* added wrapper funcs to simplify updateRam
* added static parser tests and skiped what isnt worker still for next person to try and fix
2022-03-31 21:41:19 +08:00
Stephen Reindl
805480693c remove unnecessary space 2022-03-31 12:46:48 +02:00
Stephen Reindl
689059ea83 Fix expected ram calculation for ns.goToLocation() 2022-03-31 12:37:33 +02:00
Olivier Gagnon
fb7c65957d Added dark web functions to ns api 2022-03-20 22:49:46 -04:00
Master-Guy
bcb44c6a02
Removed un-used imports from tests 2022-03-19 16:23:10 +01:00
BB
7212cc2f1c Removed unnecessary eslint-disable lines 2022-03-01 17:33:27 +01:00
Martin Fournier
8e119b2b5b Move cypress & netscript tests to ./test subfolder 2022-01-26 05:35:21 -05:00