[Jamsin Testing]: Database reset client side

How can I reset the database for the client side ith the Velocity Jasmine Testing framework?

I noticed that for testing a new database is created: jasmine-client-integration

But it seems that it keeps state between different rounds of tests.

Is there a simple method to clean out all the entries in that database before each test?

1 Like

Hi Aranir,

I am having exactly the same problem. I am calling Accounts.createUser(… in jasmine one set of client integration tests. Other tests expect the user to not exist and everything is ok on the first pass (following meteor reset) but the user is still there on subsequent runs.

I was just about to post to the ‘help’ section when I saw your question. Did you find a clean solution to the problem?

Thanks
Rob

Have you tried doing a beforeEach or beforeAll call in your tests? It works for me in my jasmine-server-integration tests (I know you’re asking about client tests, but this is all I got).

In mine, right after the describe block I have:

  beforeAll(function(){
    Meteor.users.remove({});
  })

Hi @aranir et al.

Running into the same issue here as well. I believe if you add the test helpers as Meteor.methods in your main app, you can call them from your client-integration test and they will do what you need. Perhaps the obvious, inelegant solution.

I tried adding a test-helpers.js file outside of jasmine’s server and client folders, but it didn’t seem to work, which might suggest that only the server and client folders are being recognized by jasmine/velocity. New at this too, so let me know if you’ve arrived at better solution.

Cheers.
-Ben

Take a look at this: https://github.com/Sanjo/meteor-jasmine/wiki/Database-Fixtures-for-Integration-Tests