-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Bug fixes, refinements, and lots of tests! (#131)
* Add tests for 100% coverage on synchronize.tsx * Add tests for 100% coverage on courierSync.ts * Add tests for 100% coverage in connectionStatus.ts * Add tests for 100% coverate in settings.ts * Lint * Add test for 100% coverage in message.ts * Expand onboarding to fill the window * lint * Hide menubar on About and Libraires windows Only effects windows and linux. * Handle close codes from the courier sync websocket, Fixes #129 Anything other 1000 is an error. * Fix tsc import error * Provide icons for packaging Hopefully this fix the app icon on Windows. Co-authored-by: Gus Narea <[email protected]>
- Loading branch information
Showing
21 changed files
with
180 additions
and
23 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,48 @@ | ||
import { render } from "@testing-library/react"; | ||
import React from 'react'; | ||
import { CourierSyncError, CourierSyncStatus, synchronizeWithCourier } from '../../ipc/courierSync'; | ||
import Synchronize from './synchronize'; | ||
|
||
jest.mock('../../ipc/courierSync'); | ||
|
||
describe('Synchronize', () => { | ||
test('renders', async () => { | ||
(synchronizeWithCourier as jest.Mock).mockReturnValue({ | ||
promise: (async function* (): AsyncIterable<CourierSyncStatus> { | ||
yield CourierSyncStatus.COLLECTING_CARGO; | ||
})() | ||
}) | ||
|
||
const onComplete = jest.fn(); | ||
const onReset = jest.fn(); | ||
const el = render(<Synchronize token={"TOKEN"} onComplete={onComplete} onReset={onReset}/>); | ||
expect(el.container.firstChild).toBeTruthy(); | ||
}); | ||
test('renders on an error', async () => { | ||
(synchronizeWithCourier as jest.Mock).mockReturnValue({ | ||
promise: (async function* fakeSource(): AsyncIterable<CourierSyncStatus> { | ||
throw new CourierSyncError('error'); | ||
})() | ||
}) | ||
|
||
const onComplete = jest.fn(); | ||
const onReset = jest.fn(); | ||
const el = render(<Synchronize token={"TOKEN"} onComplete={onComplete} onReset={onReset}/>); | ||
expect(el.container.firstChild).toBeTruthy(); | ||
}); | ||
test('aborts on unmount', async () => { | ||
const abort = jest.fn(); | ||
(synchronizeWithCourier as jest.Mock).mockReturnValue({ | ||
abort, | ||
promise: (async function* fakeSource(): AsyncIterable<CourierSyncStatus> { | ||
return; | ||
})(), | ||
}) | ||
|
||
const onComplete = jest.fn(); | ||
const onReset = jest.fn(); | ||
const el = render(<Synchronize token={"TOKEN"} onComplete={onComplete} onReset={onReset}/>); | ||
el.unmount(); | ||
expect(abort).toHaveBeenCalledTimes(1); | ||
}); | ||
}); |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { ServerMessage, ServerMessageType } from '../ipc/message'; | ||
|
||
describe('ServerMessage', () => { | ||
test('is defined', async () => { | ||
function handler(message: ServerMessage): ServerMessage { | ||
return message; | ||
} | ||
const serverMessage = handler({ | ||
type: ServerMessageType.TOKEN_MESSAGE, | ||
value: 'authtoken', | ||
}); | ||
expect(serverMessage.value).toEqual('authtoken'); | ||
}); | ||
}); |
This file contains 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
This file contains 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