aboutsummaryrefslogtreecommitdiff
path: root/test-data-generator/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test-data-generator/index.ts')
-rw-r--r--test-data-generator/index.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/test-data-generator/index.ts b/test-data-generator/index.ts
index c2b1361..45a5991 100644
--- a/test-data-generator/index.ts
+++ b/test-data-generator/index.ts
@@ -2,11 +2,15 @@
* Automatically generate Hypixel API responses for the unit tests
*/
+globalThis.isTest = true
+
import * as hypixelApi from '../src/hypixelApi'
+import * as constants from '../src/constants'
import * as mojang from '../src/mojang'
import fs from 'fs/promises'
import path from 'path'
+
const playerUuids = [
'6536bfed869548fd83a1ecd24cf2a0fd',
'4133cab5a7534f3f9bb636fc06a1f0fd',
@@ -29,6 +33,15 @@ async function addResponse(requestPath: string, args: { [ key: string ]: string
await writeTestData(requestPath, name, response)
}
+
+async function addConstants() {
+ const constantNames = ['collections', 'minions', 'skills', 'slayers', 'stats', 'zones']
+ for (const constantName of constantNames) {
+ const constantData = await constants.fetchJSONConstant(constantName + '.json')
+ await writeTestData('constants', constantName, constantData)
+ }
+}
+
async function main() {
const uuidsToUsername = {}
for (const playerUuid of playerUuids) {
@@ -39,6 +52,7 @@ async function main() {
}
await writeTestData('', 'mojang', uuidsToUsername)
+ await addConstants()
}
main() \ No newline at end of file