mirror of
https://github.com/ansible/awx.git
synced 2026-01-18 21:21:21 -03:30
add base model unit test
This commit is contained in:
parent
78b975b2a9
commit
c40feb52b7
@ -1,2 +1,2 @@
|
||||
import './components';
|
||||
|
||||
import './models';
|
||||
|
||||
25
awx/ui/test/unit/models/base.unit.js
Normal file
25
awx/ui/test/unit/models/base.unit.js
Normal file
@ -0,0 +1,25 @@
|
||||
describe('Models | BaseModel', () => {
|
||||
let baseModel;
|
||||
|
||||
beforeEach(() => {
|
||||
angular.mock.module('at.lib.services');
|
||||
angular.mock.module('at.lib.models');
|
||||
});
|
||||
|
||||
beforeEach(angular.mock.inject(($injector) => {
|
||||
baseModel = new ($injector.get('BaseModel'))('test');
|
||||
}));
|
||||
|
||||
describe('parseRequestConfig', () => {
|
||||
it('always returns the expected configuration', () => {
|
||||
const { parseRequestConfig } = baseModel;
|
||||
const data = { name: 'foo' };
|
||||
|
||||
expect(parseRequestConfig('get')).toEqual({ method: 'get', resource: undefined });
|
||||
expect(parseRequestConfig('get', 1)).toEqual({ method: 'get', resource: 1 });
|
||||
expect(parseRequestConfig('post', { data })).toEqual({ method: 'post', data });
|
||||
expect(parseRequestConfig(['get', 'post'], [1, 2], { data }))
|
||||
.toEqual({ resource: [1, 2], method: ['get', 'post'] });
|
||||
});
|
||||
});
|
||||
});
|
||||
5
awx/ui/test/unit/models/index.js
Normal file
5
awx/ui/test/unit/models/index.js
Normal file
@ -0,0 +1,5 @@
|
||||
// Import angular and angular-mocks to the global scope
|
||||
import 'angular-mocks';
|
||||
|
||||
// Import tests
|
||||
import './base.unit';
|
||||
Loading…
x
Reference in New Issue
Block a user