Commit Graph

136 Commits

Author SHA1 Message Date
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
50f14b4f58 Commit1 2022-10-03 12:12:16 -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
Shiiyu
2682bda9dd
fix: fix StringHelperFunctions test 2022-09-23 18:13:33 -04:00
Glenn Eggleton
19ad9be8aa add raw-loader to jest config 2022-09-14 13:05:55 -04:00
hydroflame
d6f4b3c8a5
Merge branch 'dev' into hotfix/test-fixes 2022-08-23 12:31:28 -03:00
mihilt
f8252a30e2 fix: fix some errors
- fix RAM size correctly
- fix terminal username correctly
2022-08-08 21:17:34 +09: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
Olivier Gagnon
76ccb0ba36 lint 2022-05-25 11:43:43 -04:00
phyzical
bc5377ba74
fix tests
bugfix/fix-tests

File List:
src/Terminal/determineAllPossibilitiesForTabCompletion.ts
test/jest/Terminal/Directory.test.js
2022-05-25 19:03:58 +08:00
hydroflame
4c33ad444b
Merge pull request #3644 from taralx/patch-1
MISC: fix typing conflict between jest and cypress
2022-05-19 02:13:11 -04:00
Dane Horn
28dad4dd30 expand Directory tests 2022-05-15 09:43:40 +02:00
Dane Horn
1a9d3ee998 clean up regex and adjust tests to new criteria 2022-05-15 09:43:40 +02:00
Dane Horn
0988ec8226 adjust regex for directory name
new regex allows for more flexible folder names, while still disallowing '.' and '..'
2022-05-15 09:43:40 +02: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
Olivier Gagnon
de05245e2a lint 2022-04-22 17:31:46 -04:00
TheMas3212
68ddf1d588
Fix test/jest/Netscript/DynamicRamCalculation.test.js 2022-04-15 01:12:05 +10:00
Olivier Gagnon
8958046421 fix test 2022-04-12 14:06:24 -04: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
8ae23937fb fix a few test 2022-04-06 19:58:06 -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
Heinous Tugboat
9b0422f9ee Removes extra asterisk in template 2022-03-30 10:18:07 -04:00
Olivier Gagnon
fb7c65957d Added dark web functions to ns api 2022-03-20 22:49:46 -04:00
hydroflame
a980cb495f
Merge pull request #3150 from Master-Guy/issues/3080
Fixed number formatting and added tests
2022-03-20 14:23:16 -04:00
Master-Guy
bcb44c6a02
Removed un-used imports from tests 2022-03-19 16:23:10 +01:00
phyzical
44ea479043 update constants
* added OperationNames
* added faction names
* used citynames where appropriate
2022-03-19 16:09:59 +08:00
Master-Guy
1d07bf049f Changed the furthestFrom0() function + added tests 2022-03-18 09:30:25 +01:00
Master-Guy
90fd496a24 Fixed number formatting and added tests 2022-03-17 12:47:27 +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
Martin Fournier
aae3851d59 Add webpack file-loader to handle images
It lets us bundle static files such as images.

Allows us to `imports img from "./img.png"` to retrieve an image's path.
Note that we'll have to add other entries in the global.d.ts file if we
want to handle other extensions than .png.

Adds mocks to Jest tests so that we don't fail tests when loading static
assets.
2022-01-20 18:41:48 -05:00
Jeffrey A. Robinson
c9391130f4 Add Test 2022-01-14 19:32:44 -08:00
Martin Fournier
4b06bdd89c Add detailed ram cost to mem command 2022-01-05 16:41:48 -05:00
Woody Lam
f4080ee615
Fix #2344 tests failing due to SF4 2022-01-05 13:45:20 +00:00
Olivier Gagnon
c59a267437 change sf4 2022-01-04 19:09:34 -05:00
Martin Fournier
99f1e67224 Fix tests by passing args to dynamic function test
Function purchaseServer would throw with null arguments
2021-12-20 17:37:56 -05:00
Martin Fournier
2bbb767575 Fix remaining unit test issues 2021-12-19 15:42:40 -05:00
Martin Fournier
92e8b42d18 Fix renamed functions from 1.0 release in tests 2021-12-19 12:37:42 -05:00
Martin Fournier
d1696148c4 Fix tests syntax for jest
Most tests could not run with jest because of syntax difference between
the old test runner.
2021-12-19 12:37:42 -05:00
Olivier Gagnon
3112dc60c0 few more bugfixes 2021-11-11 23:28:08 -05:00
Olivier Gagnon
aa07ea981a saving timebomb 2021-11-11 20:42:19 -05:00
Olivier Gagnon
e245c2d3a7 fixed a few things 2021-10-14 02:07:05 -04:00
Olivier Gagnon
06f716c0fa moved a bunch of files 2021-09-25 14:42:57 -04:00
Olivier Gagnon
1883bea906 one big container ready 2021-09-17 02:31:19 -04:00
hydroflame
7e8e9e03fc
Revert "Jest cypress types" 2021-09-10 00:13:03 -04:00
David Edmondson
3473fc2ea6 Revert "fix tests"
This reverts commit 82c3362adca6c5b9499654586566ccfadf943e6a.
2021-09-08 22:13:46 -07:00
David Edmondson
0c0adf29d5 Separate src, test, cypress 2021-09-08 22:12:23 -07:00
Olivier Gagnon
2a13db39c7 fix sleeve memory bug 2021-09-08 23:47:34 -04:00
vmesecher
6979082be7 Adds getAugmentationPrice() and getAugmentationReqRep() Netscript Singularity functions. Deprecates getAugmentationCost() Netscript singularity function. 2021-09-07 20:33:34 -07:00
Olivier Gagnon
82c3362adc fix tests 2021-09-07 14:31:47 -04:00
Olivier Gagnon
a18bdd6afc prettify, sorry for the big ass commit 2021-09-04 19:09:30 -04:00
David Edmondson
ed035a2e89 Add tests for autocomplete 2021-08-30 17:58:01 -07:00
David Edmondson
ab4863e7df Swap out mocha/chai for jest 2021-08-26 16:43:11 -07:00
David Edmondson
1a8bcf66cc Fix existing tests, update to jest 2021-08-26 16:43:03 -07:00
Olivier Gagnon
4d9439a007 Added getServerMaxRam and getServerUsedRam, deprecated getServerRam 2021-05-03 01:07:46 -04:00
Olivier Gagnon
5a45e3584d Formatted time in netscript hgw display in human time, milliFormat now displays milli sometimes 2021-05-02 01:04:49 -04:00
Olivier Gagnon
d745150c45 all the lints 2021-05-01 03:17:31 -04:00
Olivier Gagnon
3fad505096 run auto fix lint 2021-04-29 23:52:56 -04:00
hydroflame
52a80ad236
v0.51.6 (#905)
* Make command `cd` without arguments an alias for `cd /` (#853)

In most shells `cd` without arguments takes you to the home directory
of the current user. I keep trying to do this due to muscle memory
from working in terminals, so I figured I'd make it do something useful.

There is no home directory in the game, but going to / is the closest
thing we have, since that is the starting point for the user in the
game.

* Add new `backdoor` terminal command (#852)

* Add the backdoor command to the terminal

This command will perform a manual hack without rewarding money. It will be used for the story, mainly for faction hacking tests

* Add tab completion for backdoor command

* Add help text for backdoor command

* Change condition syntax to be more consistent with others

* Extract reused code block so it is always called after actions

* Update documentation for new backdoor command

Modified references to manual hack as it isn't for factions anymore

* Remove extra parenthesis

* Rename manuallyHacked to backdoorInstalled

* Fix typo

* Change faction test messages to use backdoor instad of hack

* Rename more instances of manuallyHacked

* fixed typo in helptext of darkweb buy (#858)

* Fix typos and unify descriptions of augmentations (#859)

Made an attempt to...
- give all "+rep% company/faction" the same text
- make all augmentations with a single effect use a single line to describe the effect
- make all effects end with a period

* Made Cashroot starter kit display its tooltip with the money formatted properly and in gold

* fix typo in docs (#860)

* Initial code for Casino Card Deck implementation

* Casino Blackjack Implementation

* Update some tools (eslint, typescript)

* Blackjack code cleanup

* Update README_contribution

* Update ScriptHelpers.js (#861)

expand error message

* More augmentation typo fixes (#862)

* Add Netscript function getCurrentScript (#856)

Add netscript function that returns the current script.

* Added milestones menu to guide new players. (#865)

Milestone menu

* fix typos in milestones (#866)

Co-authored-by: sschmidTU <s.schmid@phonicscore.com>

* Corrupt location title when backdoor is installed (#864)

* Add corruptableText component

* Corrupt location title if backdoor is installed

* Formatting

* Add helper to check value of backdoorInstalled

Helper could be oneline but it would make it less readable

* Fix some formatting

* Add settings option to disable text effects

* Import useState

* getRunningScript (#867)

* Replaced getCurrentScript with getRunningScript

* Bunch of smaller fixes (#904)

Fix #884
Fix #879
Fix #878
Fix #876
Fix #874
Fix #873
Fix #887
Fix #891
Fix #895

* rework the early servers to be more noob friendly (#903)

* v0.51.6

Co-authored-by: Andreas Eriksson <2691182+AndreasTPC@users.noreply.github.com>
Co-authored-by: Jack <jackdewinter1@gmail.com>
Co-authored-by: Teun Pronk <5228255+Crownie88@users.noreply.github.com>
Co-authored-by: Pimvgd <Pimvgd@gmail.com>
Co-authored-by: Daniel Xie <daniel.xie@flockfreight.com>
Co-authored-by: Simon <33069673+sschmidTU@users.noreply.github.com>
Co-authored-by: sschmidTU <s.schmid@phonicscore.com>
2021-04-28 20:07:26 -04:00
danielyxie
c0432359c3 Implemented 'kill by PID' functionality 2019-07-15 21:40:43 -07:00
danielyxie
931de230ae Minor rebalancing to stock market. Updated documentation and tests for recent changes 2019-06-11 00:18:14 -07:00
danielyxie
7301946236 Added and Updated Stock Market tests for the new changes 2019-06-09 21:23:48 -07:00
danielyxie
a15041da75 More rebalancing for stock market changes. Transactions now affect second-order forecast (very slightly) 2019-06-09 15:12:33 -07:00
danielyxie
35f8a5115a Finished implementing player influencing on stock 2nd-order forecasts. Balanced recent stock market changes 2019-06-03 22:21:36 -07:00
danielyxie
8398fd47f0 Changed the way stock market cycles occur. Stock second-order forecast now changes normally like before 2019-06-02 23:29:56 -07:00
danielyxie
c485fdfa87 Removed stock market price movement. Now only forecast is influenced by big transactions 2019-05-22 19:12:06 -07:00
danielyxie
d7f3ab9177 Tempered the affect that stock market txs have on stock forecasts 2019-05-20 14:44:51 -07:00
danielyxie
94175877d7 Changed stock market price movements so that upward and downward movements use different trackers. Forecast can no longer be inverted due to price movements. Updated stock market unit tests 2019-05-16 23:55:21 -07:00
danielyxie
fef7aaba8f Adding more directory-related unit tests. Several more bug fixes and QoL improvements 2019-05-14 01:35:37 -07:00
danielyxie
9dd68947f1 Added Dynamic RAM calculation unit tests 2019-05-10 02:24:50 -07:00
danielyxie
db5fdb1fcb Last fixes to unit test build configuration 2019-05-09 19:51:56 -07:00
danielyxie
74e72854d8 Configured unit test webpack build to work 2019-05-09 19:36:04 -07:00
danielyxie
ece246b391 Converted mocha unit tests to run using mocha-webpack (mochapack) package 2019-05-09 19:03:13 -07:00
danielyxie
cdb5dfec62 Resolved more circular dependencies. Installed acorn-walk and imported it in RamCalculations using ES6 modules. Fixed bugs in stock market rework 2019-05-06 18:01:06 -07:00