Skip to content

Commit

Permalink
test(libretranslate-provider): prevent logging after test completion
Browse files Browse the repository at this point in the history
  • Loading branch information
layaxx committed Nov 28, 2024
1 parent 6162049 commit dd03122
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions providers/libretranslate/lib/__tests__/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,20 @@ describe('libretranslate client', () => {
server.use(http.get(`${VALID_URL}/languages`, languagesHandler))
})

it('sets LocaleInformation default values', () => {
it('sets LocaleInformation default values', async () => {
server.use(
http.get(`${INVALID_URL}/languages`, async () => {
await new Promise((r) => setTimeout(r, 500))
await new Promise((r) => setTimeout(r, 200))

return new HttpResponse(null, { status: 500 })
})
)
const client = new Client(INVALID_URL)
expect(client.localeInformation).toBeDefined()
expect(client.localeInformation.length).toBe(30)

// wait until sever response is resolved, prevents logging after test completion
await new Promise((r) => setTimeout(r, 200))
})

it('sets LocaleInformation according to server response', async () => {
Expand Down

0 comments on commit dd03122

Please sign in to comment.