Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Stores as typescript and with interfaces. (#902)
Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
- Loading branch information
Showing
381 changed files
with
7,435 additions
and
5,098 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 |
---|---|---|
|
@@ -8,3 +8,4 @@ website/translated_docs | |
website/core | ||
website/pages | ||
websitev2 | ||
setupJest.js |
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,2 @@ | ||
// adds the 'fetchMock' global variable and rewires 'fetch' global to call 'fetchMock' instead of the real implementation | ||
require('jest-fetch-mock').enableMocks(); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 was deleted.
Oops, something went wrong.
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,40 @@ | ||
import fetchMock from 'jest-fetch-mock'; | ||
import noLogger from '../../test/fixtures/no-logger'; | ||
|
||
import SlackAddon from './slack'; | ||
|
||
beforeEach(() => { | ||
fetchMock.resetMocks(); | ||
}); | ||
|
||
test('Retries if fetch throws', async () => { | ||
const url = 'https://test.some.com'; | ||
jest.useFakeTimers('modern'); | ||
const addon = new SlackAddon({ | ||
getLogger: noLogger, | ||
unleashUrl: url, | ||
}); | ||
fetchMock.mockIf('https://test.some.com', 'OK', { | ||
status: 201, | ||
statusText: 'ACCEPTED', | ||
}); | ||
await addon.fetchRetry(url); | ||
jest.advanceTimersByTime(1000); | ||
jest.useRealTimers(); | ||
}); | ||
|
||
test('does not crash even if fetch throws', async () => { | ||
const url = 'https://test.some.com'; | ||
jest.useFakeTimers('modern'); | ||
const addon = new SlackAddon({ | ||
getLogger: noLogger, | ||
unleashUrl: url, | ||
}); | ||
fetchMock.mockResponse(() => { | ||
throw new Error('Network error'); | ||
}); | ||
await addon.fetchRetry(url); | ||
jest.advanceTimersByTime(1000); | ||
expect(fetchMock.mock.calls).toHaveLength(2); | ||
jest.useRealTimers(); | ||
}); |
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
Oops, something went wrong.