Skip to content

Instantly share code, notes, and snippets.

@niieani
Last active November 11, 2021 00:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niieani/06543bd889b6d4203eea7979a726b278 to your computer and use it in GitHub Desktop.
Save niieani/06543bd889b6d4203eea7979a726b278 to your computer and use it in GitHub Desktop.
Laika intercepts are similar to mock functions
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