Skip to content

Commit

Permalink
Merge pull request #603 from praekeltfoundation/TBH-711-bug-copy-mism…
Browse files Browse the repository at this point in the history
…atch-after-completing-screening

Tbh 711 bug copy mismatch after completing screening
  • Loading branch information
Buhle79 authored Oct 10, 2023
2 parents 3930daf + 1bb7d96 commit 9e135e7
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 20 deletions.
13 changes: 4 additions & 9 deletions go-app-ussd_tb_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ go.app = function () {
var next_state = "state_tracing";
var activation = self.im.user.answers.activation;

if (activation === "tb_study_b" || activation === "tb_study_c"){
if (activation === "tb_study_a" || activation === "tb_study_b" || activation === "tb_study_c"){
next_state = "state_study_tracing";
}

Expand All @@ -886,11 +886,6 @@ go.app = function () {

self.add("state_tracing", function (name) {
var next_state = "state_opt_in";
var activation = self.im.user.answers.activation;

if (activation === "tb_study_b" || activation === "tb_study_c"){
next_state = "state_submit_data";
}

var question = $(
"Now, please agree that the info you shared is correct and that you give " +
Expand Down Expand Up @@ -921,7 +916,7 @@ go.app = function () {
var next_state = "state_opt_in";
var activation = self.im.user.answers.activation;

if (activation === "tb_study_b" || activation === "tb_study_c"){
if (activation === "tb_study_a" || activation === "tb_study_b" || activation === "tb_study_c"){
next_state = "state_submit_data";
}

Expand Down Expand Up @@ -976,7 +971,7 @@ go.app = function () {
var msisdn = utils.normalize_msisdn(self.im.user.addr, "ZA");
var activation = self.get_activation();

if (activation === "tb_study_b" || activation === "tb_study_c"){
if (activation === "tb_study_a" || activation === "tb_study_b" || activation === "tb_study_c"){
self.im.user.answers.state_tracing = answers.state_study_tracing;
}

Expand All @@ -985,7 +980,7 @@ go.app = function () {
msisdn: msisdn,
source: "USSD",
language: answers.state_language,
province: answers.state_province,
province: answers.state_province ? answers.state_province : "",
city: answers.state_city ? answers.state_city : "<not collected>",
age: answers.state_age,
gender: answers.state_gender,
Expand Down
13 changes: 4 additions & 9 deletions src/ussd_tb_check.js
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ go.app = function () {
var next_state = "state_tracing";
var activation = self.im.user.answers.activation;

if (activation === "tb_study_b" || activation === "tb_study_c"){
if (activation === "tb_study_a" || activation === "tb_study_b" || activation === "tb_study_c"){
next_state = "state_study_tracing";
}

Expand All @@ -769,11 +769,6 @@ go.app = function () {

self.add("state_tracing", function (name) {
var next_state = "state_opt_in";
var activation = self.im.user.answers.activation;

if (activation === "tb_study_b" || activation === "tb_study_c"){
next_state = "state_submit_data";
}

var question = $(
"Now, please agree that the info you shared is correct and that you give " +
Expand Down Expand Up @@ -804,7 +799,7 @@ go.app = function () {
var next_state = "state_opt_in";
var activation = self.im.user.answers.activation;

if (activation === "tb_study_b" || activation === "tb_study_c"){
if (activation === "tb_study_a" || activation === "tb_study_b" || activation === "tb_study_c"){
next_state = "state_submit_data";
}

Expand Down Expand Up @@ -859,7 +854,7 @@ go.app = function () {
var msisdn = utils.normalize_msisdn(self.im.user.addr, "ZA");
var activation = self.get_activation();

if (activation === "tb_study_b" || activation === "tb_study_c"){
if (activation === "tb_study_a" || activation === "tb_study_b" || activation === "tb_study_c"){
self.im.user.answers.state_tracing = answers.state_study_tracing;
}

Expand All @@ -868,7 +863,7 @@ go.app = function () {
msisdn: msisdn,
source: "USSD",
language: answers.state_language,
province: answers.state_province,
province: answers.state_province ? answers.state_province : "",
city: answers.state_city ? answers.state_city : "<not collected>",
age: answers.state_age,
gender: answers.state_gender,
Expand Down
65 changes: 63 additions & 2 deletions test/ussd_tb_check.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ describe("ussd_tb_check app", function () {
.state("state_exposure")
.setup.user.answer("activation", "tb_study_a")
.input("1")
.check.user.state("state_tracing")
.check.user.state("state_study_tracing")
.run();
});
it("should go to state_study_tracing for tb_study_b ", function () {
Expand Down 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 blank 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: "",
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();
});
});
});

0 comments on commit 9e135e7

Please sign in to comment.