Mock namespaces in mirage
This commit is contained in:
parent
ef55cb910f
commit
bf8d9f05b1
|
@ -9,13 +9,13 @@ export function findLeader(schema) {
|
|||
}
|
||||
|
||||
export default function() {
|
||||
this.timing = 200; // delay for each request, automatically set to 0 during testing
|
||||
this.timing = 0; // delay for each request, automatically set to 0 during testing
|
||||
|
||||
this.namespace = 'v1';
|
||||
|
||||
this.get('/jobs', function({ jobs }) {
|
||||
const json = this.serialize(jobs.all());
|
||||
return json.map(job => filterKeys(job, 'TaskGroups'));
|
||||
return json.map(job => filterKeys(job, 'TaskGroups', 'NamespaceID'));
|
||||
});
|
||||
|
||||
this.get('/job/:id');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { Factory, faker } from 'ember-cli-mirage';
|
||||
import { provide, provider } from '../utils';
|
||||
import { provide, provider, pickOne } from '../utils';
|
||||
import { DATACENTERS } from '../common';
|
||||
|
||||
const JOB_PREFIXES = provide(5, faker.hacker.abbreviation);
|
||||
|
@ -50,6 +50,7 @@ export default Factory.extend({
|
|||
job.update({
|
||||
taskGroupIds: groups.mapBy('id'),
|
||||
task_group_ids: groups.mapBy('id'),
|
||||
namespaceId: server.db.namespaces.length && pickOne(server.db.namespaces).id,
|
||||
});
|
||||
|
||||
const jobSummary = server.create('job-summary', {
|
||||
|
|
Loading…
Reference in a new issue