Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default province to WC #602

Closed
wants to merge 1 commit into from
Closed
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 go-app-ussd_tb_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ go.app = function () {
msisdn: msisdn,
source: "USSD",
language: answers.state_language,
province: answers.state_province,
province: answers.state_province ? answers.state_province : "ZA-WC",
city: answers.state_city ? answers.state_city : "<not collected>",
age: answers.state_age,
gender: answers.state_gender,
Expand Down
2 changes: 1 addition & 1 deletion src/ussd_tb_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ go.app = function () {
msisdn: msisdn,
source: "USSD",
language: answers.state_language,
province: answers.state_province,
province: answers.state_province ? answers.state_province : "ZA-WC",
city: answers.state_city ? answers.state_city : "<not collected>",
age: answers.state_age,
gender: answers.state_gender,
Expand Down
63 changes: 62 additions & 1 deletion test/ussd_tb_check.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2191,7 +2191,7 @@ describe("ussd_tb_check app", function () {
})
.run();
});
describe("state_start_and _city", function () {
describe("state_start_and_city", function () {
it("should set city to not collected for null city", function() {
return tester
.setup(function (api) {
Expand Down Expand Up @@ -2521,4 +2521,65 @@ describe("ussd_tb_check app", function () {
.run();
});
});
describe("state_no_province", function () {
it("go to state_complete for valid answer and assign to ZA-WC for null province", function () {
return tester.setup.user
.state("state_opt_in")
.setup.user.answers({
state_province: null,
state_city: "JHB",
state_age: "<18",
state_gender: "male",
state_cough: "no",
state_fever: false,
state_sweat: false,
state_weight: false,
state_tracing: true,
state_exposure: "no",
state_language: "eng",
})
.setup(function (api) {
api.http.fixtures.add({
request: {
url: "http://healthcheck/v2/tbcheck/",
method: "POST",
data: {
msisdn: "+27123456789",
source: "USSD",
language: "eng",
province: "ZA-WC",
city: "JHB",
age: "<18",
gender: "male",
cough: "no",
fever: false,
sweat: false,
weight: false,
exposure: "no",
tracing: true,
follow_up_optin: true,
risk: "low",
activation: null,
data: {
tb_privacy_policy_accepted: "yes"
}
},
},
response: {
code: 201,
data: {
id: 20,
profile: {
accepted: true,
tbconnect_group_arm: "control",
},
},
},
});
})
.input("1")
.check.user.state("state_complete")
.run();
});
});
});