forked from ucfopen/Materia-Server-Client-Assets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testSetup.js
40 lines (32 loc) · 889 Bytes
/
testSetup.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
require('angular/angular.js');
require('angular-mocks/angular-mocks.js');
global.testResetAngular = () => {
jest.resetModules()
angular.mock.module('materia')
angular.module('materia', [])
}
global.resetNamespace = () => {
if(window["Materia"]){
window["Materia"] = null
}
}
global.testGetFilter = (filterName, load = true) => {
if(load){
require(`./src/js/filters/filter-${filterName}`)
}
let filter
inject(function($filter) {
filter = $filter(filterName)
})
return filter
}
global.API_LINK = '/api/'
global.BASE_URL = 'https://test_base_url.com/'
global.WIDGET_URL = 'widget_url/'
global.STATIC_CROSSDOMAIN = 'https://crossdomain.com/'
global.MEDIA_URL = 'https://mediaurl.com/'
global.getMockApiData = (type) => {
return require(`./__test__/mockapi/${type}.json`)
}
// global.$ = require('jquery');
beforeEach(() => { testResetAngular(); resetNamespace(); });