forked from primeroIMS/primero
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in r2-2829-release-2.10.1.1-main (pull request #6724)
R2-2829: release-2.10.1.1 to main
- Loading branch information
Showing
11 changed files
with
785 additions
and
836 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
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 |
---|---|---|
|
@@ -10,6 +10,9 @@ import Account from "./container"; | |
describe("<Account />", () => { | ||
let component; | ||
|
||
const getVisibleFields = allFields => | ||
allFields.filter(field => Object.is(field.visible, null) || field.visible).map(field => field.toJS()); | ||
|
||
beforeEach(() => { | ||
const initialState = fromJS({ | ||
user: { | ||
|
@@ -45,4 +48,62 @@ describe("<Account />", () => { | |
it("renders ChangePassword component", () => { | ||
expect(component.find(ChangePassword)).to.have.length(1); | ||
}); | ||
|
||
describe("when WEBPUSH is enabled", () => { | ||
const state = fromJS({ | ||
user: { | ||
loading: false, | ||
errors: false, | ||
serverErrors: [], | ||
locale: "en", | ||
id: 1, | ||
full_name: "Test user", | ||
disabled: false, | ||
email: "[email protected]", | ||
time_zone: "UTC", | ||
user_name: "primero" | ||
}, | ||
application: { | ||
agencies: [{ id: 1, unique_id: "agency-unicef", name: "UNICEF" }], | ||
webpush: { | ||
enabled: true | ||
} | ||
} | ||
}); | ||
|
||
const { component: newComponent } = setupMountedComponent(Account, { mode: "'edit'" }, state, ["/account"]); | ||
|
||
it("renders 25 fields", () => { | ||
expect(getVisibleFields(newComponent.find("FormSection").props().formSection.fields)).to.have.lengthOf(25); | ||
}); | ||
}); | ||
|
||
describe("when WEBPUSH is disabled", () => { | ||
const state = fromJS({ | ||
user: { | ||
loading: false, | ||
errors: false, | ||
serverErrors: [], | ||
locale: "en", | ||
id: 1, | ||
full_name: "Test user", | ||
disabled: false, | ||
email: "[email protected]", | ||
time_zone: "UTC", | ||
user_name: "primero" | ||
}, | ||
application: { | ||
agencies: [{ id: 1, unique_id: "agency-unicef", name: "UNICEF" }], | ||
webpush: { | ||
enabled: false | ||
} | ||
} | ||
}); | ||
|
||
const { component: newComponent } = setupMountedComponent(Account, { mode: "'edit'" }, state, ["/account"]); | ||
|
||
it("renders 20 fields", () => { | ||
expect(getVisibleFields(newComponent.find("FormSection").props().formSection.fields)).to.have.lengthOf(20); | ||
}); | ||
}); | ||
}); |
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.