Pup

v2.x

TestingFixtures

To aid in the writing and running of tests, Pup ships with a set of fixture data for all of the collections in Pup: Meteor.users, Documents, and Comments. This data is designed to act as dummy data in tests so that you don't have to corrupt your local database.

This is helpful when testing code that needs to manipulate data. Because this fixture data is static, you can trust that it will always be the same making your tests more resilient and less difficult to maintain.

Must be maintained manually

If you make changes to the data in your application, you will need to keep these fixtures up to date so your tests actually reflect the data your application is expecting.

/tests/fixtures/documents.js
module.exports = {
  documents: [
    {
      _id: 'document123',
      isPublic: true,
      userId: 'abc123', // NOTE: Matches userId of admin@admin.com user in /tests/fixtures/users.js fixture.
      title: 'Document Title #1',
      body: 'This is my document. There are many like it, but this one is mine.',
      createdAt: '2018-11-05T20:34:54.225Z',
      updatedAt: '2018-11-05T20:34:54.225Z',
    },
    {
      _id: 'document456',
      isPublic: false,
      userId: 'def123', // NOTE: Matches userId of user+1@test.com user in /tests/fixtures/users.js fixture.
      title: 'Document Title #2',
      body: 'This is my document. There are many like it, but this one is mine.',
      createdAt: '2018-11-05T20:34:54.225Z',
      updatedAt: '2018-11-05T20:34:54.225Z',
    },
  ],
};