Skip to content

Commit

Permalink
test: fix test error logs
Browse files Browse the repository at this point in the history
  • Loading branch information
will-stone committed Dec 16, 2023
1 parent a8f4b74 commit 3d2cbb7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 30 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"style-loader": "^3.3.3",
"tailwindcss": "^3.3.6",
"tidy-url": "^1.10.1",
"tings": "^8.1.4",
"tings": "^9.1.0",
"ts-jest": "^29.1.1",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
Expand Down
46 changes: 23 additions & 23 deletions src/renderers/picker/components/organisms/apps.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ beforeAll(() => {
})
})

test('kitchen sink', () => {
test('kitchen sink', async () => {
render(<Wrapper />)
const win = new electron.BrowserWindow()
win.webContents.send(
await win.webContents.send(
Channel.MAIN,
retrievedInstalledApps(['Firefox', 'Safari', 'Brave Browser']),
)
Expand All @@ -48,7 +48,7 @@ test('kitchen sink', () => {

expect(screen.getAllByRole('button', { name: /[A-z]+ App/u })).toHaveLength(3)

win.webContents.send(
await win.webContents.send(
Channel.MAIN,
receivedRendererStartupSignal({
data: {
Expand Down Expand Up @@ -104,7 +104,7 @@ test('kitchen sink', () => {

// Correct info sent to main when app clicked
const url = 'http://example.com'
win.webContents.send(Channel.MAIN, openedUrl(url))
await win.webContents.send(Channel.MAIN, openedUrl(url))
fireEvent.click(screen.getByRole('button', { name: 'Brave Browser App' }), {
altKey: true,
})
Expand All @@ -121,10 +121,10 @@ test('kitchen sink', () => {
)
})

test('should show spinner when no installed apps are found', () => {
test('should show spinner when no installed apps are found', async () => {
render(<Wrapper />)
const win = new electron.BrowserWindow()
win.webContents.send(
await win.webContents.send(
Channel.MAIN,
receivedRendererStartupSignal({
data: defaultData,
Expand All @@ -145,11 +145,11 @@ test('should show spinner when no installed apps are found', () => {
expect(screen.getByRole('alert', { name: 'Loading browsers' })).toBeVisible()
})

test('should use hotkey', () => {
test('should use hotkey', async () => {
render(<Wrapper />)
const win = new electron.BrowserWindow()
win.webContents.send(Channel.MAIN, retrievedInstalledApps(['Safari']))
win.webContents.send(
await win.webContents.send(Channel.MAIN, retrievedInstalledApps(['Safari']))
await win.webContents.send(
Channel.MAIN,
receivedRendererStartupSignal({
data: defaultData,
Expand All @@ -169,7 +169,7 @@ test('should use hotkey', () => {
)

const url = 'http://example.com'
win.webContents.send(Channel.MAIN, openedUrl(url))
await win.webContents.send(Channel.MAIN, openedUrl(url))
fireEvent.keyDown(document, { code: 'KeyS', key: 'S', keyCode: 83 })
expect(electron.ipcRenderer.send).toHaveBeenCalledWith(
Channel.PICKER,
Expand All @@ -186,12 +186,12 @@ test('should use hotkey', () => {
)
})

test('should use hotkey with alt', () => {
test('should use hotkey with alt', async () => {
render(<Wrapper />)
const win = new electron.BrowserWindow()
win.webContents.send(Channel.MAIN, retrievedInstalledApps(['Safari']))
await win.webContents.send(Channel.MAIN, retrievedInstalledApps(['Safari']))

win.webContents.send(
await win.webContents.send(
Channel.MAIN,
receivedRendererStartupSignal({
data: defaultData,
Expand All @@ -211,7 +211,7 @@ test('should use hotkey with alt', () => {
)

const url = 'http://example.com'
win.webContents.send(Channel.MAIN, openedUrl(url))
await win.webContents.send(Channel.MAIN, openedUrl(url))
fireEvent.keyDown(document, {
altKey: true,
code: 'KeyS',
Expand All @@ -233,11 +233,11 @@ test('should use hotkey with alt', () => {
)
})

test('should hold shift', () => {
test('should hold shift', async () => {
render(<Wrapper />)
const win = new electron.BrowserWindow()
win.webContents.send(Channel.MAIN, retrievedInstalledApps(['Firefox']))
win.webContents.send(Channel.MAIN, openedUrl('http://example.com'))
await win.webContents.send(Channel.MAIN, retrievedInstalledApps(['Firefox']))
await win.webContents.send(Channel.MAIN, openedUrl('http://example.com'))
fireEvent.click(screen.getByRole('button', { name: 'Firefox App' }), {
shiftKey: true,
})
Expand All @@ -254,12 +254,12 @@ test('should hold shift', () => {
)
})

test('should order tiles', () => {
test('should order tiles', async () => {
render(<Wrapper />)

const win = new electron.BrowserWindow()

win.webContents.send(
await win.webContents.send(
Channel.MAIN,
receivedRendererStartupSignal({
data: defaultData,
Expand All @@ -272,7 +272,7 @@ test('should order tiles', () => {
}),
)

win.webContents.send(
await win.webContents.send(
Channel.MAIN,
retrievedInstalledApps([
'Firefox',
Expand All @@ -287,21 +287,21 @@ test('should order tiles', () => {

expect(apps).toHaveLength(5)

win.webContents.send(
await win.webContents.send(
Channel.MAIN,
reorderedApp({
destinationName: 'Firefox',
sourceName: 'Safari',
}),
)
win.webContents.send(
await win.webContents.send(
Channel.MAIN,
reorderedApp({
destinationName: 'Firefox',
sourceName: 'Opera',
}),
)
win.webContents.send(
await win.webContents.send(
Channel.MAIN,
reorderedApp({
destinationName: 'Firefox',
Expand Down
4 changes: 2 additions & 2 deletions src/renderers/picker/components/organisms/url-bar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ beforeAll(() => {
})
})

test('url bar', () => {
test('url bar', async () => {
render(<Wrapper />)
const win = new electron.BrowserWindow()
const protocol = 'http://'
const host = 'example.com'
const port = ':8000'
const rest = '/foo?bar=moo'
const url = `${protocol}${host}${port}${rest}`
win.webContents.send(Channel.MAIN, openedUrl(url))
await win.webContents.send(Channel.MAIN, openedUrl(url))
expect(screen.queryByText(protocol)).not.toBeInTheDocument()
expect(screen.getByText(host + port)).toBeVisible()
expect(screen.queryByText(rest)).not.toBeInTheDocument()
Expand Down

0 comments on commit 3d2cbb7

Please sign in to comment.