xolvio / meteor-rtd-example-project

A template project to use for creating a meteor app with unit and webdriver testing
91 stars 27 forks source link

Question: Are RTD Unit tests capable of evaluating collection modifications? #31

Closed jrgrafton closed 10 years ago

jrgrafton commented 10 years ago

Take the below for example:

/tests/model/url.js:

        it("can add to and read from Meteor collections", function () {
            expect(Meteor.instantiationCounts.url).toBe(1);

            Url.insert({test : 'abc'});
            console.log(Url.find({}).fetch());
        });

    });

/app/models/url:

Url = new Meteor.Collection("url");

I'm sure I'm missing something obvious here but that console.log is outputting undefined.

Is there any way that RTD can be used to test Collection CRUD functionality?

Note When I console.log Url I get an empty object. I'm guessing something within Core Meteor may not be available from within an RTD unit testing context?