Skip to content

Commit

Permalink
fix(dx): fix failing tests (#5739)
Browse files Browse the repository at this point in the history
  • Loading branch information
allardy committed Dec 3, 2021
1 parent c31345d commit 84a0bf5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
7 changes: 6 additions & 1 deletion modules/google-speech/src/backend/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { closest } from './utils'

const randomNumber = (max = 100) => Math.floor(Math.random() * max)
const randomNumber = (max = 100) => {
const value = Math.floor(Math.random() * max)
// Prevents returning 0 because it makes tests fail randomly
return value > 1 ? value : randomNumber(max)
}

const arrayGenerator = (size = 10): number[] => {
return Array.from({ length: size }, () => randomNumber())
}
Expand Down
2 changes: 0 additions & 2 deletions packages/bp/e2e/studio/flows.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ describe('Studio - Flows', () => {
})

it('Open node properties', async () => {
const element = await expectMatchElement('.srd-node--selected', { text: /node-[0-9]*/ })
await clickOn('div', {}, element)
await page.waitForSelector('#btn-add-element')
await clickOn('#btn-add-element')
await clickOn('.bp3-dialog-close-button')
Expand Down
5 changes: 3 additions & 2 deletions packages/bp/src/core/events/middleware-chain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,9 @@ describe('Middleware', () => {
await Promise.delay(extraTime)
})

it('if should let mw set a custom timeout value', async () => {
const extraTime = 10
it('should let mw set a custom timeout value', async () => {
// Avoid a small number, bluebird overhead sometimes makes the test fail
const extraTime = 50
const mock = jest.fn(async (_event: IO.Event) => {
await Promise.delay(defaultTimeout + extraTime)
})
Expand Down

0 comments on commit 84a0bf5

Please sign in to comment.