@@ -20,23 +20,23 @@ const postcodes = require('../mockdata/postcodes').data;
20
20
const registrationUtils = require ( '../utils/registration' ) ;
21
21
const serviceUtils = require ( '../utils/services' ) ;
22
22
23
- describe ( "Registrations" , async ( ) => {
23
+ describe ( "Registrations" , ( ) => {
24
24
let cqcServices = null ;
25
25
let nonCqcServices = null ;
26
26
beforeAll ( async ( ) => {
27
27
// clean the database
28
28
if ( process . env . CLEAN_DB ) {
29
29
await apiEndpoint . post ( '/test/clean' )
30
- . send ( { } )
31
- . expect ( 200 ) ;
30
+ . send ( { } )
31
+ . expect ( 200 ) ;
32
32
}
33
33
34
34
// fetch the current set of CQC and non CQC services (to set main service)
35
35
const cqcServicesResults = await apiEndpoint . get ( '/services/byCategory?cqc=true' )
36
36
. expect ( 'Content-Type' , / j s o n / )
37
37
. expect ( 200 ) ;
38
38
cqcServices = cqcServicesResults . body ;
39
-
39
+
40
40
const nonCqcServicesResults = await apiEndpoint . get ( '/services/byCategory?cqc=false' )
41
41
. expect ( 'Content-Type' , / j s o n / )
42
42
. expect ( 200 ) ;
@@ -46,61 +46,61 @@ describe ("Registrations", async () => {
46
46
beforeEach ( async ( ) => {
47
47
} ) ;
48
48
49
- it ( "should fail for non-CQC site trying to register with CQC service" , async ( ) => {
50
- const registeredEstablishment = await apiEndpoint . post ( '/registration' )
51
- . send ( [ {
52
- locationName : "Warren Care non-CQC" ,
53
- addressLine1 : "Line 1" ,
54
- addressLine2 : "Line 2 Part 1, Line 2 Part 2" ,
55
- townCity : "My Town" ,
56
- county : "My County" ,
57
- postalCode : "DY10 3RR" ,
58
- mainService : "Nurses agency" , // this is a CQC service
59
- isRegulated : false ,
60
- user : {
61
- fullname : "Warren Ayling" ,
62
- jobTitle : "Backend Nurse" ,
63
- emailAddress :
"[email protected] " ,
64
- contactNumber : "01111 111111" ,
65
- username : "aylingw" ,
66
- password : "Password00" ,
67
- securityQuestion : "What is dinner?" ,
68
- securityAnswer : "All Day"
69
- }
70
- } ] )
71
- . expect ( 'Content-Type' , / j s o n / )
72
- . expect ( 400 ) ;
73
- expect ( registeredEstablishment . body . status ) . toEqual ( - 300 ) ;
74
- expect ( registeredEstablishment . body . message ) . toEqual ( 'Unexpected main service id ' ) ;
75
- } ) ;
76
- it ( "should fail for CQC site trying to register with unknown service" , async ( ) => {
77
- const registeredEstablishment = await apiEndpoint . post ( '/registration' )
78
- . send ( [ {
79
- locationId : "1-110055065" ,
80
- locationName : "Warren Care non-CQC" ,
81
- addressLine1 : "Line 1" ,
82
- addressLine2 : "Line 2 Part 1, Line 2 Part 2" ,
83
- townCity : "My Town" ,
84
- county : "My County" ,
85
- postalCode : "DY10 3RR" ,
86
- mainService : "WOZiTech Nurses" ,
87
- isRegulated : true ,
88
- user : {
89
- fullname : "Warren Ayling" ,
90
- jobTitle : "Backend Nurse" ,
91
- emailAddress :
"[email protected] " ,
92
- contactNumber : "01111 111111" ,
93
- username : "aylingw" ,
94
- password : "Password00" ,
95
- securityQuestion : "What is dinner?" ,
96
- securityAnswer : "All Day"
97
- }
98
- } ] )
99
- . expect ( 'Content-Type' , / j s o n / )
100
- . expect ( 400 ) ;
101
- expect ( registeredEstablishment . body . status ) . toEqual ( - 300 ) ;
102
- expect ( registeredEstablishment . body . message ) . toEqual ( 'Unexpected main service id ' ) ;
103
- } ) ;
49
+ // it("should fail for non-CQC site trying to register with CQC service", async () => {
50
+ // const registeredEstablishment = await apiEndpoint.post('/registration')
51
+ // .send([{
52
+ // locationName: "Warren Care non-CQC",
53
+ // addressLine1: "Line 1",
54
+ // addressLine2: "Line 2 Part 1, Line 2 Part 2",
55
+ // townCity: "My Town",
56
+ // county: "My County",
57
+ // postalCode: "DY10 3RR",
58
+ // mainService: "Nurses agency", // this is a CQC service
59
+ // isRegulated: false,
60
+ // user: {
61
+ // fullname: "Warren Ayling",
62
+ // jobTitle: "Backend Nurse",
63
+ // emailAddress: "[email protected] ",
64
+ // contactNumber: "01111 111111",
65
+ // username: "aylingw",
66
+ // password: "Password00",
67
+ // securityQuestion: "What is dinner?",
68
+ // securityAnswer: "All Day"
69
+ // }
70
+ // }])
71
+ // .expect('Content-Type', /json/)
72
+ // .expect(400);
73
+ // expect(registeredEstablishment.body.status).toEqual(-300);
74
+ // expect(registeredEstablishment.body.message).toEqual('Unexpected main service');
75
+ // });
76
+ // it("should fail for CQC site trying to register with unknown service", async () => {
77
+ // const registeredEstablishment = await apiEndpoint.post('/registration')
78
+ // .send([{
79
+ // locationId: "1-110055065",
80
+ // locationName: "Warren Care non-CQC",
81
+ // addressLine1: "Line 1",
82
+ // addressLine2: "Line 2 Part 1, Line 2 Part 2",
83
+ // townCity: "My Town",
84
+ // county: "My County",
85
+ // postalCode: "DY10 3RR",
86
+ // mainService: "WOZiTech Nurses",
87
+ // isRegulated: true,
88
+ // user: {
89
+ // fullname: "Warren Ayling",
90
+ // jobTitle: "Backend Nurse",
91
+ // emailAddress: "[email protected] ",
92
+ // contactNumber: "01111 111111",
93
+ // username: "aylingw",
94
+ // password: "Password00",
95
+ // securityQuestion: "What is dinner?",
96
+ // securityAnswer: "All Day"
97
+ // }
98
+ // }])
99
+ // .expect('Content-Type', /json/)
100
+ // .expect(400);
101
+ // expect(registeredEstablishment.body.status).toEqual(-300);
102
+ // expect(registeredEstablishment.body.message).toEqual('Unexpected main service');
103
+ // });
104
104
105
105
let nonCQCSite = null ;
106
106
let cqcSite = null ;
@@ -115,15 +115,15 @@ describe ("Registrations", async () => {
115
115
expect ( Number . isInteger ( registeredEstablishment . body . establishmentId ) ) . toEqual ( true ) ;
116
116
} ) ;
117
117
118
-
118
+
119
119
it ( "should create a CQC registation of known location id" , async ( ) => {
120
120
cqcSite = registrationUtils . newCqcSite ( locations [ 0 ] , cqcServices ) ;
121
121
const registeredEstablishment = await apiEndpoint . post ( '/registration' )
122
122
. send ( [ cqcSite ] )
123
123
. expect ( 'Content-Type' , / j s o n / )
124
124
. expect ( 200 ) ;
125
125
expect ( registeredEstablishment . body . status ) . toEqual ( 1 ) ;
126
- expect ( Number . isInteger ( registeredEstablishment . body . establishmentId ) ) . toEqual ( true ) ;
126
+ expect ( Number . isInteger ( registeredEstablishment . body . establishmentId ) ) . toEqual ( true ) ;
127
127
} ) ;
128
128
129
129
it ( "should create a second CQC registation of different known location id but same postcode and name" , async ( ) => {
@@ -135,7 +135,7 @@ describe ("Registrations", async () => {
135
135
. expect ( 'Content-Type' , / j s o n / )
136
136
. expect ( 200 ) ;
137
137
expect ( registeredEstablishment . body . status ) . toEqual ( 1 ) ;
138
- expect ( Number . isInteger ( registeredEstablishment . body . establishmentId ) ) . toEqual ( true ) ;
138
+ expect ( Number . isInteger ( registeredEstablishment . body . establishmentId ) ) . toEqual ( true ) ;
139
139
} ) ;
140
140
141
141
it ( "should fail on CQC if site with location id, postcode and name already existing" , async ( ) => {
@@ -167,15 +167,6 @@ describe ("Registrations", async () => {
167
167
expect ( registeredEstablishment . body . message ) . toEqual ( 'Duplicate Username' ) ;
168
168
} ) ;
169
169
170
- it ( "should fail if location id unknown" , async ( ) => {
171
- cqcSite . locationId = '1-110055066' ;
172
- const registeredEstablishment = await apiEndpoint . post ( '/registration' )
173
- . send ( [ cqcSite ] )
174
- . expect ( 'Content-Type' , / j s o n / )
175
- . expect ( 400 ) ;
176
- expect ( registeredEstablishment . body . status ) . toEqual ( - 400 ) ;
177
- expect ( registeredEstablishment . body . message ) . toEqual ( 'Unknown location' ) ;
178
- } ) ;
179
170
180
171
it ( "should lookup a known service with success" , async ( ) => {
181
172
const knownService = serviceUtils . lookupRandomService ( cqcServices ) ;
@@ -186,7 +177,7 @@ describe ("Registrations", async () => {
186
177
expect ( registeredEstablishment . body . message ) . toEqual ( `Service name '${ knownService . name } ' found` ) ;
187
178
} ) ;
188
179
it ( "should lookup an unknown service with success" , async ( ) => {
189
- const registeredEstablishment = await apiEndpoint . get ( '/registration/service/' + encodeURIComponent ( 'unKNown serViCE' ) )
180
+ const registeredEstablishment = await apiEndpoint . get ( '/registration/service/' + encodeURIComponent ( 'unKNown serViCE' ) )
190
181
. expect ( 'Content-Type' , / j s o n / )
191
182
. expect ( 200 ) ;
192
183
expect ( registeredEstablishment . body . status ) . toEqual ( "0" ) ;
@@ -209,7 +200,7 @@ describe ("Registrations", async () => {
209
200
expect ( registeredEstablishment . body . message ) . toEqual ( `Username '${ 'unKNown UsEr' . toLowerCase ( ) } ' not found` ) ;
210
201
} ) ;
211
202
212
-
203
+
213
204
it ( "should lookup a known username via usernameOrPasswword with success" , async ( ) => {
214
205
const knownUsername = nonCQCSite . user . username ;
215
206
await apiEndpoint . get ( '/registration/usernameOrEmail/' + encodeURIComponent ( knownUsername ) )
0 commit comments