Last active
November 11, 2021 00:37
-
-
Save niieani/06543bd889b6d4203eea7979a726b278 to your computer and use it in GitHub Desktop.
Laika intercepts are similar to mock functions
This file contains hidden or 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
it('mocks the rocket launches once', () => { | |
// the `laika` variable below can come either from the global instance, when running in the browser | |
// or in case of unit tests, it might be a link we've set up in a `beforeAll` of this test suite | |
const interceptor = laika.intercept({ operationName: 'ListMissions' }) | |
interceptor.mockResultOnce({ | |
result: { | |
data: { | |
launchesPast: [ | |
{ mission_name: 'Sputnik 2', launch_site: { site_name_long: 'Baikonur 1/5' } }, | |
{ mission_name: 'Mock mission', launch_site: { site_name_long: 'Mock launch site' } }, | |
], | |
}, | |
}, | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment