@@ -1678,15 +1678,6 @@ describe("ussd_clinic app", function() {
1678
1678
state_clinic_code : "123456" ,
1679
1679
preferred_channel : "SMS" ,
1680
1680
state_language : "eng" ,
1681
- status_id : "status-id-uuid" ,
1682
- } )
1683
- . setup ( function ( api ) {
1684
- api . http . fixtures . add (
1685
- fixtures_hub . get_whatsapp_template_status (
1686
- "status-id-uuid" ,
1687
- "SMS"
1688
- )
1689
- ) ;
1690
1681
} )
1691
1682
. setup ( function ( api ) {
1692
1683
api . http . fixtures . add (
@@ -1704,7 +1695,6 @@ describe("ussd_clinic app", function() {
1704
1695
dob : "1990-01-02T00:00:00Z" ,
1705
1696
swt : "1" ,
1706
1697
preferred_channel : "SMS" ,
1707
- status_id : "status-id-uuid" ,
1708
1698
}
1709
1699
)
1710
1700
) ;
@@ -1721,17 +1711,16 @@ describe("ussd_clinic app", function() {
1721
1711
} )
1722
1712
. check . reply . ends_session ( )
1723
1713
. check ( function ( api ) {
1724
- assert . equal ( api . http . requests . length , 2 ) ;
1714
+ assert . equal ( api . http . requests . length , 1 ) ;
1725
1715
var urls = _ . map ( api . http . requests , "url" ) ;
1726
1716
assert . deepEqual ( urls , [
1727
- "http://hub/api/v2/whatsapptemplatesendstatus/status-id-uuid/" ,
1728
1717
"https://rapidpro/api/v2/flow_starts.json"
1729
1718
] ) ;
1730
1719
assert . equal ( api . log . error . length , 0 ) ;
1731
1720
} )
1732
1721
. run ( ) ;
1733
1722
} ) ;
1734
- it ( "should make a request to the RapidPro APIs for prebirth if message type is skipped" , function ( ) {
1723
+ it ( "should make a request to the RapidPro APIs for prebirth if message type is skipped for WA " , function ( ) {
1735
1724
return tester
1736
1725
. setup . user . state ( "state_accept_popi_2" )
1737
1726
. setup . user . answers ( {
@@ -1742,7 +1731,7 @@ describe("ussd_clinic app", function() {
1742
1731
state_edd_month : "201502" ,
1743
1732
state_edd_day : "13" ,
1744
1733
state_clinic_code : "123456" ,
1745
- preferred_channel : "SMS " ,
1734
+ preferred_channel : "WhatApp " ,
1746
1735
state_language : "eng" ,
1747
1736
status_id : "status-id-uuid" ,
1748
1737
@@ -1751,7 +1740,7 @@ describe("ussd_clinic app", function() {
1751
1740
api . http . fixtures . add (
1752
1741
fixtures_hub . get_whatsapp_template_status (
1753
1742
"status-id-uuid" ,
1754
- "SMS "
1743
+ "WhatsApp "
1755
1744
)
1756
1745
) ;
1757
1746
} )
@@ -1769,8 +1758,8 @@ describe("ussd_clinic app", function() {
1769
1758
clinic_code : "123456" ,
1770
1759
sa_id_number : "9001020005087" ,
1771
1760
dob : "1990-01-02T00:00:00Z" ,
1772
- swt : "1 " ,
1773
- preferred_channel : "SMS " ,
1761
+ swt : "7 " ,
1762
+ preferred_channel : "WhatsApp " ,
1774
1763
status_id : "status-id-uuid" ,
1775
1764
}
1776
1765
)
@@ -1783,7 +1772,7 @@ describe("ussd_clinic app", function() {
1783
1772
"You're done!" ,
1784
1773
"" ,
1785
1774
"This number 0820001001 will start getting messages from " +
1786
- "MomConnect on SMS ."
1775
+ "MomConnect on WhatsApp ."
1787
1776
] . join ( "\n" )
1788
1777
} )
1789
1778
. check . reply . ends_session ( )
@@ -1798,31 +1787,78 @@ describe("ussd_clinic app", function() {
1798
1787
} )
1799
1788
. run ( ) ;
1800
1789
} ) ;
1801
- it ( "should make a request to the RapidPro APIs for prebirth underage registree mom with sa_id on accept selection " , function ( ) {
1790
+ it ( "should make a request to the RapidPro APIs for prebirth if message type is skipped for USSD " , function ( ) {
1802
1791
return tester
1803
1792
. setup . user . state ( "state_accept_popi_2" )
1804
1793
. setup . user . answers ( {
1805
- state_message_type : "state_edd_month" ,
1806
1794
state_research_consent : "no" ,
1807
1795
state_enter_msisdn : "0820001001" ,
1808
1796
state_id_type : "state_sa_id_no" ,
1809
- state_sa_id_no : "1301020005087 " ,
1797
+ state_sa_id_no : "9001020005087 " ,
1810
1798
state_edd_month : "201502" ,
1811
1799
state_edd_day : "13" ,
1812
1800
state_clinic_code : "123456" ,
1813
- state_underage_registree : "Yes" ,
1814
1801
preferred_channel : "SMS" ,
1815
1802
state_language : "eng" ,
1816
- status_id : "status-id-uuid" ,
1803
+
1817
1804
} )
1818
1805
. setup ( function ( api ) {
1819
1806
api . http . fixtures . add (
1820
- fixtures_hub . get_whatsapp_template_status (
1821
- "status-id-uuid" ,
1822
- "SMS"
1807
+ fixtures_rapidpro . start_flow (
1808
+ "prebirth-flow-uuid" , null , "whatsapp:27820001001" , {
1809
+ research_consent : "TRUE" ,
1810
+ registered_by : "+27123456789" ,
1811
+ language : "eng" ,
1812
+ timestamp : "2014-04-04T07:07:07Z" ,
1813
+ source : "Clinic USSD" ,
1814
+ id_type : "sa_id" ,
1815
+ edd : "2015-02-13T00:00:00Z" ,
1816
+ clinic_code : "123456" ,
1817
+ sa_id_number : "9001020005087" ,
1818
+ dob : "1990-01-02T00:00:00Z" ,
1819
+ swt : "1" ,
1820
+ preferred_channel : "SMS" ,
1821
+ }
1823
1822
)
1824
1823
) ;
1825
1824
} )
1825
+ . input ( "1" )
1826
+ . check . interaction ( {
1827
+ state : "state_registration_complete" ,
1828
+ reply : [
1829
+ "You're done!" ,
1830
+ "" ,
1831
+ "This number 0820001001 will start getting messages from " +
1832
+ "MomConnect on SMS."
1833
+ ] . join ( "\n" )
1834
+ } )
1835
+ . check . reply . ends_session ( )
1836
+ . check ( function ( api ) {
1837
+ assert . equal ( api . http . requests . length , 1 ) ;
1838
+ var urls = _ . map ( api . http . requests , "url" ) ;
1839
+ assert . deepEqual ( urls , [
1840
+ "https://rapidpro/api/v2/flow_starts.json"
1841
+ ] ) ;
1842
+ assert . equal ( api . log . error . length , 0 ) ;
1843
+ } )
1844
+ . run ( ) ;
1845
+ } ) ;
1846
+ it ( "should make a request to the RapidPro APIs for prebirth underage registree mom with sa_id on accept selection" , function ( ) {
1847
+ return tester
1848
+ . setup . user . state ( "state_accept_popi_2" )
1849
+ . setup . user . answers ( {
1850
+ state_message_type : "state_edd_month" ,
1851
+ state_research_consent : "no" ,
1852
+ state_enter_msisdn : "0820001001" ,
1853
+ state_id_type : "state_sa_id_no" ,
1854
+ state_sa_id_no : "1301020005087" ,
1855
+ state_edd_month : "201502" ,
1856
+ state_edd_day : "13" ,
1857
+ state_clinic_code : "123456" ,
1858
+ state_underage_registree : "Yes" ,
1859
+ preferred_channel : "SMS" ,
1860
+ state_language : "eng" ,
1861
+ } )
1826
1862
. setup ( function ( api ) {
1827
1863
api . http . fixtures . add (
1828
1864
fixtures_rapidpro . start_flow (
@@ -1840,7 +1876,6 @@ describe("ussd_clinic app", function() {
1840
1876
dob : "2013-01-02T00:00:00Z" ,
1841
1877
swt : "1" ,
1842
1878
preferred_channel : "SMS" ,
1843
- status_id : "status-id-uuid" ,
1844
1879
}
1845
1880
)
1846
1881
) ;
@@ -1857,10 +1892,9 @@ describe("ussd_clinic app", function() {
1857
1892
} )
1858
1893
. check . reply . ends_session ( )
1859
1894
. check ( function ( api ) {
1860
- assert . equal ( api . http . requests . length , 2 ) ;
1895
+ assert . equal ( api . http . requests . length , 1 ) ;
1861
1896
var urls = _ . map ( api . http . requests , "url" ) ;
1862
1897
assert . deepEqual ( urls , [
1863
- "http://hub/api/v2/whatsapptemplatesendstatus/status-id-uuid/" ,
1864
1898
"https://rapidpro/api/v2/flow_starts.json"
1865
1899
] ) ;
1866
1900
assert . equal ( api . log . error . length , 0 ) ;
@@ -1884,15 +1918,6 @@ describe("ussd_clinic app", function() {
1884
1918
state_underage_registree : "Yes" ,
1885
1919
preferred_channel : "SMS" ,
1886
1920
state_language : "eng" ,
1887
- status_id : "status-id-uuid" ,
1888
- } )
1889
- . setup ( function ( api ) {
1890
- api . http . fixtures . add (
1891
- fixtures_hub . get_whatsapp_template_status (
1892
- "status-id-uuid" ,
1893
- "SMS"
1894
- )
1895
- ) ;
1896
1921
} )
1897
1922
. setup ( function ( api ) {
1898
1923
api . http . fixtures . add (
@@ -1912,7 +1937,6 @@ describe("ussd_clinic app", function() {
1912
1937
swt : "1" ,
1913
1938
age : "16" ,
1914
1939
preferred_channel : "SMS" ,
1915
- status_id : "status-id-uuid" ,
1916
1940
}
1917
1941
)
1918
1942
) ;
@@ -1929,10 +1953,9 @@ describe("ussd_clinic app", function() {
1929
1953
} )
1930
1954
. check . reply . ends_session ( )
1931
1955
. check ( function ( api ) {
1932
- assert . equal ( api . http . requests . length , 2 ) ;
1956
+ assert . equal ( api . http . requests . length , 1 ) ;
1933
1957
var urls = _ . map ( api . http . requests , "url" ) ;
1934
1958
assert . deepEqual ( urls , [
1935
- "http://hub/api/v2/whatsapptemplatesendstatus/status-id-uuid/" ,
1936
1959
"https://rapidpro/api/v2/flow_starts.json"
1937
1960
] ) ;
1938
1961
assert . equal ( api . log . error . length , 0 ) ;
@@ -1956,15 +1979,6 @@ describe("ussd_clinic app", function() {
1956
1979
state_underage_registree : "Yes" ,
1957
1980
preferred_channel : "SMS" ,
1958
1981
state_language : "eng" ,
1959
- status_id : "status-id-uuid" ,
1960
- } )
1961
- . setup ( function ( api ) {
1962
- api . http . fixtures . add (
1963
- fixtures_hub . get_whatsapp_template_status (
1964
- "status-id-uuid" ,
1965
- "SMS"
1966
- )
1967
- ) ;
1968
1982
} )
1969
1983
. setup ( function ( api ) {
1970
1984
api . http . fixtures . add (
@@ -1982,7 +1996,6 @@ describe("ussd_clinic app", function() {
1982
1996
swt : "1" ,
1983
1997
dob : "2014-10-25T00:00:00Z" ,
1984
1998
preferred_channel : "SMS" ,
1985
- status_id : "status-id-uuid" ,
1986
1999
}
1987
2000
)
1988
2001
) ;
@@ -1999,10 +2012,9 @@ describe("ussd_clinic app", function() {
1999
2012
} )
2000
2013
. check . reply . ends_session ( )
2001
2014
. check ( function ( api ) {
2002
- assert . equal ( api . http . requests . length , 2 ) ;
2015
+ assert . equal ( api . http . requests . length , 1 ) ;
2003
2016
var urls = _ . map ( api . http . requests , "url" ) ;
2004
2017
assert . deepEqual ( urls , [
2005
- "http://hub/api/v2/whatsapptemplatesendstatus/status-id-uuid/" ,
2006
2018
"https://rapidpro/api/v2/flow_starts.json"
2007
2019
] ) ;
2008
2020
assert . equal ( api . log . error . length , 0 ) ;
0 commit comments