2022-05-25 13:02:59 +03:00
|
|
|
/* eslint-disable ghost/ember/no-test-import-export */
|
|
|
|
import {applyEmberDataSerializers, discoverEmberDataModels} from 'ember-cli-mirage';
|
|
|
|
import {createServer} from 'miragejs';
|
|
|
|
import {isTesting, macroCondition} from '@embroider/macros';
|
|
|
|
|
|
|
|
import devRoutes from './routes-dev';
|
|
|
|
import testRoutes from './routes-test';
|
|
|
|
|
|
|
|
export default function (config) {
|
|
|
|
let finalConfig = {
|
|
|
|
...config,
|
|
|
|
models: {...discoverEmberDataModels(), ...config.models},
|
|
|
|
serializers: applyEmberDataSerializers(config.serializers),
|
|
|
|
routes
|
|
|
|
};
|
|
|
|
|
|
|
|
return createServer(finalConfig);
|
2016-04-13 12:44:09 +03:00
|
|
|
}
|
|
|
|
|
2022-05-25 13:02:59 +03:00
|
|
|
function routes() {
|
|
|
|
if (macroCondition(isTesting())) {
|
|
|
|
testRoutes.call(this);
|
|
|
|
} else {
|
|
|
|
devRoutes.call(this);
|
|
|
|
}
|
2015-10-13 16:52:41 +03:00
|
|
|
}
|