Skip to content

Commit 6f5cde5

Browse files
committed
complete actions test
1 parent 205ccf0 commit 6f5cde5

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { CALL_API } from 'redux-api-middleware';
2+
import expect from 'expect.js';
3+
4+
import * as types from 'constants/action-types';
5+
import { fetchUngitConfig } from 'actions/ungit-config';
6+
7+
describe('ungit-config.js action', () => {
8+
describe('fetchUngitConfig', () => {
9+
it('returns CALL_API action object', function(){
10+
const action = fetchUngitConfig();
11+
12+
expect(action[CALL_API]).to.be.an('object');
13+
expect(action[CALL_API].endpoint).to.eql('http://localhost:8448/ungit/config');
14+
expect(action[CALL_API].method).to.eql('GET');
15+
expect(action[CALL_API].types).to.be.an('array');
16+
expect(action[CALL_API].types[0]).to.eql(types.FETCH_UNGIT_CONFIG_REQUEST);
17+
expect(action[CALL_API].types[1]).to.be.an('object');
18+
expect(action[CALL_API].types[1].type).to.eql(types.FETCH_UNGIT_CONFIG_SUCCESS);
19+
expect(action[CALL_API].types[2]).to.eql(types.FETCH_UNGIT_CONFIG_FAILURE);
20+
});
21+
});
22+
});
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { CALL_API } from 'redux-api-middleware';
2+
import expect from 'expect.js';
3+
4+
import * as types from 'constants/action-types';
5+
import { fetchUserConfig } from 'actions/user-config';
6+
7+
describe('user-config.js action', () => {
8+
describe('fetchUserConfig', () => {
9+
it('returns CALL_API action object', function(){
10+
const action = fetchUserConfig();
11+
12+
expect(action[CALL_API]).to.be.an('object');
13+
expect(action[CALL_API].endpoint).to.eql('http://localhost:8448/api/userconfig');
14+
expect(action[CALL_API].method).to.eql('GET');
15+
expect(action[CALL_API].types).to.be.an('array');
16+
expect(action[CALL_API].types[0]).to.eql(types.FETCH_USER_CONFIG_REQUEST);
17+
expect(action[CALL_API].types[1]).to.eql(types.FETCH_USER_CONFIG_SUCCESS);
18+
expect(action[CALL_API].types[2]).to.eql(types.FETCH_USER_CONFIG_FAILURE);
19+
});
20+
});
21+
});
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { CALL_API } from 'redux-api-middleware';
2+
import expect from 'expect.js';
3+
4+
import * as types from 'constants/action-types';
5+
import { fetchLatestVersion, fetchGitVersion } from 'actions/version';
6+
7+
describe('version.js action', () => {
8+
describe('fetchLatestVersion', () => {
9+
it('returns CALL_API action object', function(){
10+
const action = fetchLatestVersion();
11+
12+
expect(action[CALL_API]).to.be.an('object');
13+
expect(action[CALL_API].endpoint).to.eql('http://localhost:8448/api/latestversion');
14+
expect(action[CALL_API].method).to.eql('GET');
15+
expect(action[CALL_API].types).to.be.an('array');
16+
expect(action[CALL_API].types[0]).to.eql(types.FETCH_LATEST_VERSION_REQUEST);
17+
expect(action[CALL_API].types[1]).to.eql(types.FETCH_LATEST_VERSION_SUCCESS);
18+
expect(action[CALL_API].types[2]).to.eql(types.FETCH_LATEST_VERSION_FAILURE);
19+
});
20+
});
21+
22+
describe('fetchGitVersion', () => {
23+
it('returns CALL_API action object', function(){
24+
const action = fetchGitVersion();
25+
26+
expect(action[CALL_API]).to.be.an('object');
27+
expect(action[CALL_API].endpoint).to.eql('http://localhost:8448/api/gitversion');
28+
expect(action[CALL_API].method).to.eql('GET');
29+
expect(action[CALL_API].types).to.be.an('array');
30+
expect(action[CALL_API].types[0]).to.eql(types.FETCH_GIT_VERSION_REQUEST);
31+
expect(action[CALL_API].types[1]).to.eql(types.FETCH_GIT_VERSION_SUCCESS);
32+
expect(action[CALL_API].types[2]).to.eql(types.FETCH_GIT_VERSION_FAILURE);
33+
});
34+
});
35+
});

0 commit comments

Comments
 (0)