all repos — caroster @ c1a6f1a4eafac48d7b5a72429fa5c450805f3825

[Octree] Group carpool to your event https://caroster.io

backend/tests/helpers/context.js (view raw)

 1const getContext = (context = {}) => ({
 2  state: {
 3    user: {
 4      id: 1,
 5    },
 6  },
 7  request: {},
 8  params: {},
 9  query: {},
10  send: jest.fn(),
11  badRequest: jest.fn(),
12
13  ...context,
14
15  setBody(body) {
16    this.request.body = body;
17  },
18  setParams(params) {
19    this.params = params;
20  },
21  setQuery(query) {
22    this.query = query;
23  },
24  setUserId(userId) {
25    this.state.user = {
26      id: userId,
27    };
28  },
29});
30
31module.exports = getContext;