This repository has been archived by the owner on Oct 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release of Version 1.0
- Loading branch information
Showing
82 changed files
with
518 additions
and
265 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,3 @@ def index | |
end | ||
end | ||
# rubocop:enable Metrics/AbcSize | ||
# rubocop:enable Metrics/PerceivedComplexity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,9 @@ class OmniauthCallbacksControllerTest < ActionDispatch::IntegrationTest | |
OmniAuth.config.test_mode = true | ||
OmniAuth.config.mock_auth[:openid_connect] = OmniAuth::AuthHash.new(provider: 'openid_connect', | ||
uid: '12345', | ||
info: { email: '[email protected]' }) | ||
info: { email: '[email protected]', | ||
given_name: 'Mike', | ||
family_name: 'Smith' }) | ||
|
||
@admin = User.find_by(email: '[email protected]') | ||
@user_count = User.count | ||
|
@@ -27,6 +29,8 @@ class OmniauthCallbacksControllerTest < ActionDispatch::IntegrationTest | |
user = User.first | ||
assert_equal 1, user.authentications.count, 'expected the new user to be associated with a single authentication' | ||
assert_equal '[email protected]', user.email | ||
assert_equal 'Mike', user.first_name | ||
assert_equal 'Smith', user.last_name | ||
assert_authentication(user.authentications[0], 'openid_connect', '12345') | ||
assert_response :redirect | ||
assert_redirected_to root_url | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { expect } from '../../test_helper'; | ||
import React from 'react'; | ||
import SettingsModal from '../../../../webpack/components/accounts/SettingsModal'; | ||
import chai from 'chai'; | ||
import spies from 'chai-spies'; | ||
import { mount } from 'enzyme'; | ||
chai.use(spies); | ||
describe('SettingsModal', () => { | ||
|
||
|
||
|
||
|
||
it('should display the user update fields for email, first and last names', () => { | ||
let props = { update: function(){}, | ||
disableUserUpdate: "false", | ||
show: true, | ||
closer: function(){}, | ||
currentUser:{email: "[email protected]", firstName: "Testy", lastName: "Testington",id: 1}, | ||
surveillanceSystems: [], | ||
surveillancePrograms: [], | ||
}; | ||
|
||
let wrapper = mount( | ||
<SettingsModal {...props}/> | ||
); | ||
// Get the component instance | ||
let instance = wrapper.instance(); | ||
instance.renderUserInfo = chai.spy(instance.renderUserInfo); | ||
instance.render(); | ||
expect(instance.renderUserInfo).to.have.been.called(); | ||
}); | ||
|
||
it('should not display the user update fields for email, first and last names when disableUserUpdate is true', () => { | ||
let props = { update: function(){}, | ||
disableUserUpdate: "true", | ||
show: true, | ||
closer: function(){}, | ||
currentUser:{email: "[email protected]", firstName: "Testy", lastName: "Testington",id: 1}, | ||
surveillanceSystems: [], | ||
surveillancePrograms: [], | ||
}; | ||
let wrapper = mount( | ||
<SettingsModal {...props}/> | ||
); | ||
// Get the component instance | ||
let instance = wrapper.instance(); | ||
instance.renderUserInfo = chai.spy(instance.renderUserInfo); | ||
instance.render(); | ||
expect(instance.renderUserInfo).to.not.have.been.called(); | ||
|
||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import { expect } from '../test_helper'; | ||
import surveys from '../../../webpack/reducers/surveys_reducer'; | ||
import _ from 'lodash'; | ||
import { | ||
FETCH_SURVEY_FULFILLED, | ||
FETCH_SURVEYS_FULFILLED, | ||
DELETE_SURVEY_FULFILLED, | ||
ADD_FORM, | ||
REMOVE_FORM | ||
} from '../../../webpack/actions/types'; | ||
|
@@ -13,12 +12,12 @@ describe('surveys reducer', () => { | |
const twoSurveys = [ | ||
{id: 1, name: "Red Survey", userId: "[email protected]", forms:[]}, | ||
{id: 3, name: "Blue Survey", userId: "[email protected]", forms: twoForms} | ||
]; | ||
]; | ||
|
||
it('should fetch surveys', () => { | ||
const payloadData = {data: twoSurveys}; | ||
const action = {type: FETCH_SURVEYS_FULFILLED, payload: payloadData}; | ||
const startState = {} | ||
const startState = {}; | ||
const nextState = surveys(startState, action); | ||
expect(Object.keys(nextState).length).to.equal(2); | ||
}); | ||
|
@@ -33,7 +32,7 @@ describe('surveys reducer', () => { | |
}); | ||
|
||
it('should add a form', () => { | ||
const survey = {id: 1, name: "Red Survey", userId: "[email protected]", surveyForms:[]} | ||
const survey = {id: 1, name: "Red Survey", userId: "[email protected]", surveyForms:[]}; | ||
const form = {id: 1, content: "Is this a form?", formType: ""}; | ||
const action = {type: ADD_FORM, payload: {survey, form} }; | ||
const startState = {}; | ||
|
@@ -42,7 +41,7 @@ describe('surveys reducer', () => { | |
}); | ||
|
||
it('should not add the same form twice', () => { | ||
const survey = {id: 1, name: "Red Survey", userId: "[email protected]", surveyForms:[]} | ||
const survey = {id: 1, name: "Red Survey", userId: "[email protected]", surveyForms:[]}; | ||
const form = {id: 1, content: "Is this a form?", formType: ""}; | ||
const action = {type: ADD_FORM, payload: {survey, form} }; | ||
const nextState = surveys({}, action); | ||
|
@@ -58,4 +57,13 @@ describe('surveys reducer', () => { | |
const nextState = surveys(startState, action); | ||
expect(nextState["1"].surveyForms.length).to.equal(0); | ||
}); | ||
|
||
it('should delete a survey', () => { | ||
const action = {type: DELETE_SURVEY_FULFILLED, payload: {data: {id: 1}}}; | ||
const startState = {1: {id: 1, name: "Red Survey", userId: "[email protected]"}, | ||
2: {id: 2, name: "Blue Survey", userId: "[email protected]"}}; | ||
const nextState = surveys(startState, action); | ||
expect(nextState["1"]).to.be.undefined; | ||
expect(nextState["2"].name).to.equal("Blue Survey"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.