How to use the mockingoose.FeedRecord function in mockingoose

To help you get started, we’ve selected a few mockingoose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rolling-scopes / rsschool-app / app / routes / user / feed.spec.ts View on Github external
xit('returns data', async () => {
        const ctx = createTestContext();
        const feedRecords = [
            {
                _id: '5b19146f65bbc725d2069082',
                actionType: FeedActions.ENROLL,
                courseId: 'course-id',
                data: {},
                dateTime: 0,
                entityType: FeedEntities.User,
                userId: 'apalchys',
            },
        ] as IFeedRecordModel[];

        mockingoose.User.toReturn({}, 'findOne');
        mockingoose.FeedRecord.toReturn(feedRecords, 'find');

        await getFeedRoute(ctx);
        expect(ctx.status).toBe(200);
        expect(ctx.body).toMatchSnapshot();
    });

mockingoose

A Jest package for mocking mongoose models

Unlicense
Latest version published 2 years ago

Package Health Score

58 / 100
Full package analysis