salix/front/jest-setup.js

47 lines
1.5 KiB
JavaScript

import 'angular';
import 'angular-mocks';
import core from './core/module.js';
import './salix/components/app/app.js';
import '../modules/zone/front/module.js';
import '../modules/claim/front/module.js';
import '../modules/client/front/module.js';
import '../modules/invoiceOut/front/module.js';
import '../modules/invoiceIn/front/module.js';
import '../modules/item/front/module.js';
import '../modules/order/front/module.js';
import '../modules/route/front/module.js';
import '../modules/ticket/front/module.js';
import '../modules/travel/front/module.js';
import '../modules/worker/front/module.js';
import '../modules/shelving/front/module.js';
import 'vn-loopback/server/boot/date';
// Set NODE_ENV
process.env.NODE_ENV = 'development';
core.run(vnInterceptor => {
vnInterceptor.setApiPath(null);
});
window.ngModule = function(moduleName, ...args) {
let fns = [moduleName, function($provide, $translateProvider) {
// Avoid unexpected request warnings caused by angular translate
// https://angular-translate.github.io/docs/#/guide/22_unit-testing-with-angular-translate
$provide.factory('customLocaleLoader', function($q) {
return function() {
let deferred = $q.defer();
deferred.resolve({});
return deferred.promise;
};
});
$translateProvider.useLoader('customLocaleLoader');
}];
if (args.length)
fns = fns.concat(args);
return angular.mock.module(...fns);
};