-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests for API and utils on FIMS history
- Loading branch information
Showing
3 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
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,28 @@ | ||
import * as fimsClient from "../../../../../../definitions/fims/client"; | ||
import * as fetchUtils from "../../../../../utils/fetch"; | ||
import { createFimsClient } from "../client"; | ||
|
||
describe("createFimsClient", () => { | ||
it("should invoke `createClient` with the input 'baseUrl' and the result of `defaultRetryingFetch`", () => { | ||
const mockFetch = jest.fn(); | ||
const spyDefaultRetryingFetch = jest | ||
.spyOn(fetchUtils, "defaultRetryingFetch") | ||
.mockImplementation((_timeout, _maxRetries) => mockFetch); | ||
const mockCreateClient = jest.fn(); | ||
jest | ||
.spyOn(fimsClient, "createClient") | ||
.mockImplementation(input => mockCreateClient(input)); | ||
|
||
const baseUrl = "https://localhost:3000"; | ||
createFimsClient(baseUrl); | ||
|
||
expect(mockCreateClient.mock.calls.length).toBe(1); | ||
expect(mockCreateClient.mock.calls[0].length).toBe(1); | ||
expect(mockCreateClient.mock.calls[0][0]).toEqual({ | ||
baseUrl, | ||
fetchApi: mockFetch | ||
}); | ||
expect(spyDefaultRetryingFetch.mock.calls.length).toBe(1); | ||
expect(spyDefaultRetryingFetch.mock.calls[0].length).toBe(0); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
ts/features/fims/history/utils/__tests__/__snapshots__/styles.test.ts.snap
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,10 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`FimsHistorySharedStyles should match snapshot 1`] = ` | ||
{ | ||
"fixedHeightListItem": { | ||
"height": 117, | ||
"justifyContent": "center", | ||
}, | ||
} | ||
`; |
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,7 @@ | ||
import { FimsHistorySharedStyles } from "../styles"; | ||
|
||
describe("FimsHistorySharedStyles", () => { | ||
it("should match snapshot", () => { | ||
expect(FimsHistorySharedStyles).toMatchSnapshot(); | ||
}); | ||
}); |