Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Geczy committed Aug 31, 2023
1 parent f8dedc1 commit c4aa511
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
4 changes: 4 additions & 0 deletions packages/dota/src/__tests__/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { jest } from '@jest/globals'
import axios from 'axios'

import { chatClient } from '../twitch/chatClient'

export const apiClient = axios.create({
baseURL: 'http://localhost:5120',
})
export const twitchChatSpy = jest.spyOn(chatClient, 'say')
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { faker } from '@faker-js/faker'
import { beforeAll, describe, it, jest } from '@jest/globals'
import { beforeAll, describe, it } from '@jest/globals'

import { apiClient } from '../../../../__tests__/utils.js'
import { prisma } from '../../../../db/prisma'
import { chatClient } from '../../../../twitch/chatClient.js'
import { apiClient, twitchChatSpy } from '../../../../__tests__/utils.js'
import { prisma } from '../../../../db/prisma.js'
import { DotaEventTypes } from '../../../../types.js'

describe('aegis denied', () => {
const twitchChatSpy = jest.spyOn(chatClient, 'say')

// might be less than 100 if some users are offline
let USER_COUNT = 70

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import { faker } from '@faker-js/faker'
import { beforeAll, describe, it, jest } from '@jest/globals'
import { beforeAll, describe, it } from '@jest/globals'

import { apiClient } from '../../../../__tests__/utils.js'
import { apiClient, twitchChatSpy } from '../../../../__tests__/utils.js'
import { prisma } from '../../../../db/prisma.js'
import { chatClient } from '../../../../twitch/chatClient.js'
import { DotaEventTypes } from '../../../../types.js'

describe('aegis picked up', () => {
const twitchChatSpy = jest.spyOn(chatClient, 'say')

// might be less than 100 if some users are offline
let USER_COUNT = 70
let USER_COUNT = 200

const promises: Promise<any>[] = []

Expand All @@ -30,6 +27,7 @@ describe('aegis picked up', () => {
})
.then((users) => {
USER_COUNT = users.length
console.log({ USER_COUNT })
for (const user of users) {
promises.push(
apiClient
Expand All @@ -56,7 +54,7 @@ describe('aegis picked up', () => {
done(e)
})

Promise.all(promises)
Promise.allSettled(promises)
.then(() => {
done()
})
Expand Down

0 comments on commit c4aa511

Please sign in to comment.