Created
June 2, 2023 08:50
-
-
Save crashmax-dev/475dca44f846a43e91974a6a6f677378 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'reflect-metadata' | |
import { databaseTokens } from './database/index.js' | |
import { ApiService } from './twitch/api.service.js' | |
import { AuthService } from './twitch/auth.service.js' | |
const authService = new AuthService(databaseTokens) | |
await authService.init() | |
const apiService = new ApiService(authService) | |
const cases: { query: string; result: string }[] = [ | |
{ | |
query: 'dota', | |
result: 'Dota 2' | |
}, | |
{ | |
query: 'terrar', | |
result: 'Terraria' | |
}, | |
{ | |
query: 'warzone', // реально нужно создавать алиасы, я ебал рот | |
result: 'Call of Duty: Warzone' | |
}, | |
{ | |
query: 'call of duty worzone', | |
result: 'Call of Duty: Warzone' | |
}, | |
{ | |
query: 'far cry', | |
result: 'Far Cry' | |
} | |
] | |
for (const { query, result } of cases) { | |
const response = await apiService.apiClient.search.searchCategories(query, { | |
limit: 5 | |
}) | |
const category = response.data[0]?.name | |
console.assert( | |
category === result, | |
JSON.stringify({ query, category, result }, null, 2) | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment