@zendesk/laika
TypeScript icon, indicating that this package has built-in type declarations

1.4.1 • Public • Published

Laika logo

Try Laika on CodeSandbox

Test, mock, intercept and modify Apollo Client's operations — in both browser and unit tests!

Read the Medium article about Laika: Mock GraphQL Subscriptions with Laika — the only Apollo Client mocking tool you’ll need

Example recording output

Features

  • mock responses in either unit tests or browser tests (think Puppeteer or Cypress)
    • simulate error state
    • simulate loading state
    • simulate subscriptions (pushing data to the client at any given point)
  • it can work in production code without affecting the size of the bundle (laika is lazily loaded)
  • captures the variables that were called for a given operation for assertions
  • log all the data passing through from the network (or whatever Links are after this one)
  • record your user story
  • generate fixtures and working mock code for use in your tests
  • modify backend responses before they reach your components (e.g. to fuzz-test unexpected behavior)

Usage

Alternatives

  • MockedProvider - the official Apollo mocking tool designed for unit tests; offers no subscription mocking or recording functionality

Contribution

Thanks for your interest in our tool! Community involvement helps make our design system fresh and tasty for everyone.

Got issues with what you find here? Please feel free to create an issue.

If you'd like to take a crack at making some changes, please follow our contributing documentation for details needed to submit a PR.

Community behavior is benevolently ruled by a code of conduct. Please participate accordingly.

License

Copyright 2021 Zendesk

Licensed under the Apache License, Version 2.0

Package Sidebar

Install

npm i @zendesk/laika

Weekly Downloads

21,008

Version

1.4.1

License

Apache-2.0

Unpacked Size

401 kB

Total Files

128

Last publish

Collaborators

  • luis-almeida
  • rscheibinger-zendesk
  • zd-svc-npmjs
  • frederickzh
  • zdbpeterson
  • zdrsim
  • billjh
  • rvignesh89
  • anushkafka
  • token-cjg
  • hkjorgensen
  • svizzari
  • sunesimonsen
  • avecerek
  • sarmadsangi