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

test failed Error: done() called multiple times #40

Open
cer opened this issue Mar 1, 2017 · 2 comments
Open

test failed Error: done() called multiple times #40

cer opened this issue Mar 1, 2017 · 2 comments
Assignees

Comments

@cer
Copy link
Collaborator

cer commented Mar 1, 2017

This happened just once. I ran the tests repeatedly without a problem.

64 passing (10s)
1 failing

1) EventuateSubscriptionManager should subscribe two subscribers and receive events:
   Error: done() called multiple times
    at Suite.<anonymous> (test/AggregateRepository-spec.js:138:3)
    at Object.<anonymous> (test/AggregateRepository-spec.js:134:1)
    at require (internal/module.js:12:17)
    at Array.forEach (native)
    at node.js:974:3
@cer
Copy link
Collaborator Author

cer commented Mar 1, 2017

I had a quick look at the code
Presumably, this code is expecting to receive events published earlier.

The problem with the code is that it is not looking for those specific events (event ids).
Just any MyEntityWasCreatedEvent and MyEntityWasUpdatedEvent.
So if there are some unprocessed events of those types lying around they will be consumed and cause this error.

Also, it is not actually testing a MyEntityWasCreatedEvent was received. Only that a MyEntityWasUpdatedEvent was received.

describe('EventuateSubscriptionManager', function () {

  this.timeout(timeout);

  it('should subscribe two subscribers and receive events', done => {

    const handleMyEntityWasCreatedEvent = helpers.createEventHandler((event) => {
      console.log('handleMyEntityWasCreatedEvent()');
      expect(event.eventType).to.equal(MyEntityWasCreatedEvent);
    });

    const handleMyEntityWasUpdatedEvent = helpers.createEventHandler((event) => {
      console.log('handleMyEntityWasUpdatedEvent()');
      expect(event.eventType).to.equal(MyEntityWasUpdatedEvent);
      done();
    });

@dartvandru
Copy link
Collaborator

Resolved with: #41

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants