Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const createMockServer = () => {
const server = new Server(createMockServerOptions());
return server;
};
server[method]('*', () => {
return new Response(404);
});
});
export const createMockServerOptions = () => ({
models: {
project: Model,
branch: Model,
mergeRequest: Model,
mergeRequestChange: Model,
mergeRequestVersion: Model,
file: Model,
userPermission: Model,
},
serializers: {
application: RestSerializer.extend({
root: false,
}),
},
seeds(schema) {
schema.db.loadData({
files: getRepositoryFiles().map((path) => ({ path })),
projects: [getProject(), getEmptyProject()],
branches: [getBranch()],
mergeRequests: getMergeRequests(),
mergeRequestChanges: [getMergeRequestWithChanges()],
mergeRequestVersions: getMergeRequestVersions(),
filesRaw: [
{
raw: getBlobReadme(),
path: 'README.md',
},
export function startMirage() {
return new Server({
trackRequests: true,
environment: 'test',
namespace: 'plate_picks',
models: {
plate: Model,
batch: Model,
},
routes() {
this.get('plates/:barcode', (schema, request) => {
return schema.plates.findBy({ barcode: request.params.barcode })
})
this.resource('batches')
},
})
}