Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spy a function from a required module #7

Closed
bsr203 opened this issue Jul 12, 2015 · 1 comment
Closed

spy a function from a required module #7

bsr203 opened this issue Jul 12, 2015 · 1 comment

Comments

@bsr203
Copy link

bsr203 commented Jul 12, 2015

Hi @andreypopp

I cloned this repo and worked fine the jasmin test through Karma. but, it failed with webtest

# starting
TAP version 13
ok 1 - Dependency : foo method works:
not ok 2 - Main : calls dependency's foo:
  Expected spy foo to have been called with [ 'bar' ] but it was never called.
  === STACK TRACE ===
    at ./src/client/__tests__/main-test.js:16
  === END STACK TRACE ===

below is the failed test. This is the experience with my tests too. I couldn't spy or stub any method on a required module. In my case it was action creator in a flux implementation. It would be great if you can give some pointers as it is a blocker.

'use strict';

var dependency = require('../ttt/dependency');

import {run} from '../ttt/main';

describe('Main', function() {
  beforeEach(function() {
    spyOn(dependency, 'foo');
  });

  it('calls dependency\'s foo:', function() {
    run();
    expect(dependency.foo).toHaveBeenCalledWith('bar');
  });
});

@bsr203
Copy link
Author

bsr203 commented Jul 22, 2015

closes as the issue is not with webtest. see speedskater/babel-plugin-rewire#19

@bsr203 bsr203 closed this as completed Jul 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant