I am checking for a test document in Meteor.startup and creating it if it doesn't exist. I have the following mocha test and testPage is undefined so and I keep getting Unspecified AssertionError
and timeout of 2000ms exceeded
when running the test. What am I doing wrong?
// File app/server/bootstrap.js
Meteor.startup(function () {
/* create a test page */
if (Pages.find().count() === 0) {
Pages.insert({
display: false,
order: 0,
nav: 'Test Page',
content: '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris magna orci, semper eget arcu a, porta vehicula massa. Mauris ut interdum dui. Suspendisse potenti. Phasellus vel purus ac lectus faucibus tincidunt vel id neque. Donec blandit eros non odio dapibus, ut venenatis dui um lectus quis neque porta, in viverra quam tincidunt. Aliquam nec pharetra ipsum. Proin et pretium mi, vel aliquet arcu.</p>'
});
}
});
// File app/tests/mocha/sampleServerTest.js
if (typeof MochaWeb !== 'undefined') {
MochaWeb.testOnly(function(){
describe("Data initialization", function() {
it ("should have a test document", function() {
var testPage = Pages.findOne({display: false});
console.log('testPage', testPage);
chai.assert(testPage);
});
});
});
}
Aucun commentaire:
Enregistrer un commentaire