mock_data.js.es6 1013 Bytes
Newer Older
1
/* eslint-disable */
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
const listObj = {
  id: 1,
  position: 0,
  title: 'Test',
  list_type: 'label',
  label: {
    id: 1,
    title: 'Testing',
    color: 'red',
    description: 'testing;'
  }
};

const listObjDuplicate = {
  id: 2,
  position: 1,
  title: 'Test',
  list_type: 'label',
  label: {
    id: 2,
    title: 'Testing',
    color: 'red',
    description: 'testing;'
  }
};

const BoardsMockData = {
  'GET': {
Phil Hughes's avatar
Phil Hughes committed
30
    '/test/issue-boards/board/1/lists{/id}/issues': {
31 32 33 34 35 36 37 38
      issues: [{
        title: 'Testing',
        iid: 1,
        confidential: false,
        labels: []
      }],
      size: 1
    }
39 40
  },
  'POST': {
Phil Hughes's avatar
Phil Hughes committed
41
    '/test/issue-boards/board/1/lists{/id}': listObj
42 43
  },
  'PUT': {
Phil Hughes's avatar
Phil Hughes committed
44
    '/test/issue-boards/board/1/lists{/id}': {}
45 46
  },
  'DELETE': {
Phil Hughes's avatar
Phil Hughes committed
47
    '/test/issue-boards/board/1/lists{/id}': {}
48 49 50
  }
};

51
const boardsMockInterceptor = (request, next) => {
52 53 54 55 56
  const body = BoardsMockData[request.method][request.url];

  next(request.respondWith(JSON.stringify(body), {
    status: 200
  }));
57
};