mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
78e453c1b0
no issue - Updated member settings css property in tests - Added mock for label API
28 lines
710 B
JavaScript
28 lines
710 B
JavaScript
import {paginatedResponse} from '../utils';
|
|
|
|
export default function mockLabels(server) {
|
|
server.post('/labels/', function ({labels}) {
|
|
let attrs = this.normalizedRequestAttrs();
|
|
|
|
return labels.create(Object.assign({}, attrs, {id: 99}));
|
|
});
|
|
|
|
server.get('/labels/', paginatedResponse('labels'));
|
|
|
|
server.get('/labels/:id/', function ({labels}, {params}) {
|
|
let {id} = params;
|
|
let label = labels.find(id);
|
|
|
|
return label || new Response(404, {}, {
|
|
errors: [{
|
|
type: 'NotFoundError',
|
|
message: 'Label not found.'
|
|
}]
|
|
});
|
|
});
|
|
|
|
server.put('/labels/:id/');
|
|
|
|
server.del('/labels/:id/');
|
|
}
|