debian-mirror-gitlab/spec/frontend/badges/dummy_badge.js

27 lines
828 B
JavaScript
Raw Normal View History

2020-03-13 15:44:24 +05:30
import { uniqueId } from 'lodash';
2018-05-09 12:01:36 +05:30
import { DUMMY_IMAGE_URL, TEST_HOST } from 'spec/test_constants';
2020-01-01 13:55:28 +05:30
import { PROJECT_BADGE } from '~/badges/constants';
2018-05-09 12:01:36 +05:30
export const createDummyBadge = () => {
2020-03-13 15:44:24 +05:30
const id = uniqueId();
2018-05-09 12:01:36 +05:30
return {
id,
2020-01-01 13:55:28 +05:30
name: 'TestBadge',
2018-05-09 12:01:36 +05:30
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 = () => ({
2020-01-01 13:55:28 +05:30
name: 'TestBadge',
2018-05-09 12:01:36 +05:30
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`,
});