summaryrefslogtreecommitdiff
path: root/spec/javascripts/badges/dummy_badge.js
blob: a0dee89736e0e6a38eba9d0f2dceb7cf275009fd (plain)
1
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
import { uniqueId } from 'lodash';
import { DUMMY_IMAGE_URL, TEST_HOST } from 'spec/test_constants';
import { PROJECT_BADGE } from '~/badges/constants';

export const createDummyBadge = () => {
  const id = uniqueId();
  return {
    id,
    name: 'TestBadge',
    imageUrl: `${TEST_HOST}/badges/${id}/image/url`,
    isDeleting: false,
    linkUrl: `${TEST_HOST}/badges/${id}/link/url`,
    kind: PROJECT_BADGE,
    renderedImageUrl: `${DUMMY_IMAGE_URL}?id=${id}`,
    renderedLinkUrl: `${TEST_HOST}/badges/${id}/rendered/link/url`,
  };
};

export const createDummyBadgeResponse = () => ({
  name: 'TestBadge',
  image_url: `${TEST_HOST}/badge/image/url`,
  link_url: `${TEST_HOST}/badge/link/url`,
  kind: PROJECT_BADGE,
  rendered_image_url: DUMMY_IMAGE_URL,
  rendered_link_url: `${TEST_HOST}/rendered/badge/link/url`,
});