From 4b78c2fbdfcdd9dcc794e4b0c17cfb6d88a1006b Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Sat, 1 May 2021 19:04:52 -0500 Subject: Show minions that haven't been unlocked in response (#20) * add minions that haven't been unlocked yet to response, and slightly optimize constants * remove most console.logs with console.debugs * mock constants --- test-data-generator/index.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test-data-generator') 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 -- cgit