1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-08 13:06:15 +02:00
joplin/packages/server/src/routes/index/home.test.ts
2021-01-14 22:36:46 +00:00

35 lines
754 B
TypeScript

import routeHandler from '../../middleware/routeHandler';
import { beforeAllDb, afterAllTests, beforeEachDb, koaAppContext, createUserAndSession } from '../../utils/testing/testUtils';
describe('index_home', function() {
beforeAll(async () => {
await beforeAllDb('index_home');
});
afterAll(async () => {
await afterAllTests();
});
beforeEach(async () => {
await beforeEachDb();
});
test('should show the home page', async function() {
const { user, session } = await createUserAndSession();
const context = await koaAppContext({
sessionId: session.id,
request: {
method: 'GET',
url: '/home',
},
});
await routeHandler(context);
expect(context.response.body.indexOf(user.email) >= 0).toBe(true);
});
});