question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setup tests in jest with mobx-rest

See original GitHub issue

how to setup tests in jest with mobx-rest ? i get adapter is not Defined in errors after setting up adapter in setupTest file i get Error : Cannot Read Property of Object.Prototype of undefined i will appericiate if you give me example of testing a component

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
andresgutgoncommented, Dec 12, 2017

If you just want data on your collection you can do it in this way:

// Jest spec
let myCollection
beforeEach(() => {
   myMobexRestCollection.add([
     {id: 'my-fake-id-1, name: 'Fake model 1' },
     {id: 'my-fake-id-2, name: 'Fake model 2' }
  ])
})

it ('foo bar', () => {
  // do something with that collection
})
0reactions
andresgutgoncommented, Dec 12, 2017

Welcome 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setup and Teardown - Jest
If you have some work you need to do repeatedly for many tests, you can use beforeEach and afterEach hooks. For example, let's...
Read more >
How to Test React and MobX with Jest - Semaphore CI
Learn how to get started with unit testing for a React and MobX application using Enzyme and Jest, including continuous testing.
Read more >
How To Test a React App with Jest and React Testing Library
Because Jest is pre-packaged with Create React App, you do not need to install it separately. Step 1 — Setting up the Project....
Read more >
Setup - Testing Library
In these docs we'll demonstrate configuring Jest, but you should be able to do similar things with any testing framework (React Testing ......
Read more >
Jest Testing Tutorial: 5 Easy Steps - Testim Blog
As a result of those properties, unit tests are usually: very fast to execute; relatively easy to setup, not requiring any elaborate ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found