Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
__coverage__
.build-info
.sass-cache
dist
#dist
node_modules
_auto_doc_
.vscode
Expand Down
7 changes: 7 additions & 0 deletions __tests__/__snapshots__/index.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ Object {
"getLookerDone": [Function],
},
"lookup": Object {
"getCountriesDone": [Function],
"getCountriesInit": [Function],
"getSkillTagsDone": [Function],
"getSkillTagsInit": [Function],
},
Expand Down Expand Up @@ -127,6 +129,8 @@ Object {
"updateProfileInit": [Function],
"uploadPhotoDone": [Function],
"uploadPhotoInit": [Function],
"verifyMemberNewEmailDone": [Function],
"verifyMemberNewEmailInit": [Function],
},
"reviewOpportunity": Object {
"cancelApplicationsDone": [Function],
Expand Down Expand Up @@ -201,14 +205,17 @@ Object {
"countReset": [Function],
"debug": [Function],
"dir": [Function],
"dirxml": [Function],
"error": [Function],
"group": [Function],
"groupCollapsed": [Function],
"groupEnd": [Function],
"info": [Function],
"log": [Function],
"table": [Function],
"time": [Function],
"timeEnd": [Function],
"timeLog": [Function],
"trace": [Function],
"warn": [Function],
},
Expand Down
20 changes: 20 additions & 0 deletions __tests__/actions/__snapshots__/lookup.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,32 @@
exports[`Module exports 1`] = `
Object {
"lookup": Object {
"getCountriesDone": [Function],
"getCountriesInit": [Function],
"getSkillTagsDone": [Function],
"getSkillTagsInit": [Function],
},
}
`;

exports[`lookup.getCountriesDone 1`] = `
Object {
"payload": Array [
Object {
"country": "Afghanistan",
"countryCode": "AFG",
},
],
"type": "LOOKUP/GET_COUNTRIES_DONE",
}
`;

exports[`lookup.getCountriesInit 1`] = `
Object {
"type": "LOOKUP/GET_COUNTRIES_INIT",
}
`;

exports[`lookup.getSkillTagsDone 1`] = `
Object {
"payload": Array [
Expand Down
2 changes: 2 additions & 0 deletions __tests__/actions/__snapshots__/profile.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ Object {
"updateProfileInit": [Function],
"uploadPhotoDone": [Function],
"uploadPhotoInit": [Function],
"verifyMemberNewEmailDone": [Function],
"verifyMemberNewEmailInit": [Function],
},
}
`;
Expand Down
17 changes: 17 additions & 0 deletions __tests__/actions/lookup.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ const tag = {
status: 'APPROVED',
};

const country = {
country: 'Afghanistan',
countryCode: 'AFG',
};

// Mock services
const mockLookupService = {
getTags: jest.fn().mockReturnValue(Promise.resolve([tag])),
getCountries: jest.fn().mockReturnValue(Promise.resolve([country])),
};
LookupService.getService = jest.fn().mockReturnValue(mockLookupService);

Expand All @@ -28,3 +34,14 @@ test('lookup.getSkillTagsDone', async () => {
expect(actionResult).toMatchSnapshot();
expect(mockLookupService.getTags).toBeCalled();
});

test('lookup.getCountriesInit', async () => {
const actionResult = actions.lookup.getCountriesInit();
expect(actionResult).toMatchSnapshot();
});

test('lookup.getCountriesDone', async () => {
const actionResult = await redux.resolveAction(actions.lookup.getCountriesDone());
expect(actionResult).toMatchSnapshot();
expect(mockLookupService.getCountries).toBeCalled();
});
90 changes: 90 additions & 0 deletions __tests__/reducers/__snapshots__/lookup.js.snap
Original file line number Diff line number Diff line change
@@ -1,7 +1,50 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Default reducer Get countries 1`] = `
Object {
"countries": Array [
Object {
"country": "Afghanistan",
"countryCode": "AFG",
},
],
"loadingCountriesError": false,
"loadingSkillTagsError": true,
"skillTags": Array [
Object {
"domain": "SKILLS",
"id": 251,
"name": "Jekyll",
"status": "APPROVED",
},
],
}
`;

exports[`Default reducer Get countries error 1`] = `
Object {
"countries": Array [
Object {
"country": "Afghanistan",
"countryCode": "AFG",
},
],
"loadingCountriesError": true,
"loadingSkillTagsError": true,
"skillTags": Array [
Object {
"domain": "SKILLS",
"id": 251,
"name": "Jekyll",
"status": "APPROVED",
},
],
}
`;

exports[`Default reducer Get skill tags 1`] = `
Object {
"countries": Array [],
"loadingSkillTagsError": false,
"skillTags": Array [
Object {
Expand All @@ -16,6 +59,7 @@ Object {

exports[`Default reducer Get skill tags error 1`] = `
Object {
"countries": Array [],
"loadingSkillTagsError": true,
"skillTags": Array [
Object {
Expand All @@ -30,12 +74,56 @@ Object {

exports[`Default reducer Initial state 1`] = `
Object {
"countries": Array [],
"skillTags": Array [],
}
`;

exports[`Factory without server side rendering Get countries 1`] = `
Object {
"countries": Array [
Object {
"country": "Afghanistan",
"countryCode": "AFG",
},
],
"loadingCountriesError": false,
"loadingSkillTagsError": true,
"skillTags": Array [
Object {
"domain": "SKILLS",
"id": 251,
"name": "Jekyll",
"status": "APPROVED",
},
],
}
`;

exports[`Factory without server side rendering Get countries error 1`] = `
Object {
"countries": Array [
Object {
"country": "Afghanistan",
"countryCode": "AFG",
},
],
"loadingCountriesError": true,
"loadingSkillTagsError": true,
"skillTags": Array [
Object {
"domain": "SKILLS",
"id": 251,
"name": "Jekyll",
"status": "APPROVED",
},
],
}
`;

exports[`Factory without server side rendering Get skill tags 1`] = `
Object {
"countries": Array [],
"loadingSkillTagsError": false,
"skillTags": Array [
Object {
Expand All @@ -50,6 +138,7 @@ Object {

exports[`Factory without server side rendering Get skill tags error 1`] = `
Object {
"countries": Array [],
"loadingSkillTagsError": true,
"skillTags": Array [
Object {
Expand All @@ -64,6 +153,7 @@ Object {

exports[`Factory without server side rendering Initial state 1`] = `
Object {
"countries": Array [],
"skillTags": Array [],
}
`;
Loading