UNPKG

my-test123

Version:
80 lines 2.87 kB
/* * This class contains mock generator code for labels */ var LabelMockGenerator = /** @class */ (function () { function LabelMockGenerator() { this.labels = [ { color: '#fbdebf', border: '#f39d3c' }, { color: '#f7bd7f', border: '#f39d3c' }, { color: '#fbeabc', border: '#f39d3c' }, { color: '#9ecf99', border: '#6ec664' }, { color: '#d1d1d1', border: '#bbbbbb' } ]; } /* * Creates the label structure. */ LabelMockGenerator.prototype.getAllLabels = function () { if (this.allLabels) return this.allLabels; else { return this.allLabels = this.labels.map(function (i, index) { return { attributes: { name: 'Example Label ' + index, "text-color": "#000000", "background-color": i.color, "border-color": i.border }, links: { self: 'http://mock.service/api/spaces/space-id0/labels/label' + index }, relationships: { 'space': { 'data': { 'id': 'space-id0', 'type': 'spaces' }, 'links': { 'self': 'http://mock.service/api/spaces/space-id0' } }, }, id: 'label' + index, type: 'labels' }; }); } }; LabelMockGenerator.prototype.createLabel = function (body) { body = body.data; this.allLabels.push({ attributes: { name: body.attributes.name, "text-color": "#000000", "background-color": body.attributes["background-color"], "border-color": body.attributes["border-color"] }, links: { self: 'http://mock.service/api/spaces/space-id0/labels/label' + this.labels.length }, relationships: { 'space': { 'data': { 'id': 'space-id0', 'type': 'spaces' }, 'links': { 'self': 'http://mock.service/api/spaces/space-id0' } }, }, id: 'label' + this.allLabels.length, type: 'labels' }); return this.allLabels[this.allLabels.length - 1]; }; return LabelMockGenerator; }()); export { LabelMockGenerator }; //# sourceMappingURL=label-mock-generator.js.map