dimanche 3 juin 2018

Importing a function creates the whole object

I'm trying to unit test a generator function from Saga, like this:

import { foo } from '../mySaga'

describe('bla', () => {
  it('bla bla', () => {
    expect(foo('bar')).toEqual('baz');
  })
})

But when I run it, it goes to the default function of mySaga as if the whole object is created, this causes errors of course.

And it happens even if I just import the Saga file without using it in the test.

PS: Eventually, I'll test the iterator itself but even a basic call to a saga function fails

Aucun commentaire:

Enregistrer un commentaire