@@ -16,7 +16,7 @@ describe("Middleware | Validators | Subscription", function () {
16
16
17
17
it ( "should call next function when a valid request body is passed" , async function ( ) {
18
18
req . body = {
19
- phoneNumber : "+911234567890" ,
19
+ phone : "+911234567890" ,
20
20
21
21
} ;
22
22
@@ -27,7 +27,7 @@ describe("Middleware | Validators | Subscription", function () {
27
27
expect ( res . json . called ) . to . be . equal ( false ) ;
28
28
} ) ;
29
29
30
- it ( "should not return an error when phoneNumber is missing" , async function ( ) {
30
+ it ( "should not return an error when phone is missing" , async function ( ) {
31
31
req . body = {
32
32
33
33
} ;
@@ -40,7 +40,7 @@ describe("Middleware | Validators | Subscription", function () {
40
40
41
41
it ( "should return a 400 error when email is missing" , async function ( ) {
42
42
req . body = {
43
- phoneNumber : "+911234567890" ,
43
+ phone : "+911234567890" ,
44
44
} ;
45
45
46
46
validateSubscribe ( req , res , nextSpy ) ;
@@ -51,7 +51,7 @@ describe("Middleware | Validators | Subscription", function () {
51
51
expect ( res . json . firstCall . args [ 0 ] ) . to . have . property ( "error" ) . that . includes ( '"email" is required' ) ;
52
52
} ) ;
53
53
54
- it ( "should return a 400 error when both phoneNumber and email are missing" , async function ( ) {
54
+ it ( "should return a 400 error when both phone and email are missing" , async function ( ) {
55
55
req . body = { } ;
56
56
57
57
validateSubscribe ( req , res , nextSpy ) ;
@@ -63,7 +63,7 @@ describe("Middleware | Validators | Subscription", function () {
63
63
64
64
it ( "should return a 400 error when email is not in correct format" , async function ( ) {
65
65
req . body = {
66
- phoneNumber : "+911234567890" ,
66
+ phone : "+911234567890" ,
67
67
email : "invalid-email" ,
68
68
} ;
69
69
@@ -77,9 +77,9 @@ describe("Middleware | Validators | Subscription", function () {
77
77
. that . includes ( '"email" with value "invalid-email" fails to match the required pattern' ) ;
78
78
} ) ;
79
79
80
- it ( "should not return an error when phoneNumber is in correct format" , async function ( ) {
80
+ it ( "should not return an error when phone is in correct format" , async function ( ) {
81
81
req . body = {
82
- phoneNumber : "+911234567890" ,
82
+ phone : "+911234567890" ,
83
83
84
84
} ;
85
85
@@ -89,9 +89,9 @@ describe("Middleware | Validators | Subscription", function () {
89
89
expect ( res . json . called ) . to . be . equal ( false ) ;
90
90
} ) ;
91
91
92
- it ( "should trim and validate phoneNumber if it contains leading or trailing spaces" , async function ( ) {
92
+ it ( "should trim and validate phone if it contains leading or trailing spaces" , async function ( ) {
93
93
req . body = {
94
- phoneNumber : " +911234567890 " ,
94
+ phone : " +911234567890 " ,
95
95
96
96
} ;
97
97
@@ -100,12 +100,12 @@ describe("Middleware | Validators | Subscription", function () {
100
100
expect ( nextSpy . calledOnce ) . to . be . equal ( true ) ;
101
101
expect ( res . status . called ) . to . be . equal ( false ) ;
102
102
expect ( res . json . called ) . to . be . equal ( false ) ;
103
- expect ( req . body . phoneNumber ) . to . equal ( "+911234567890" ) ;
103
+ expect ( req . body . phone ) . to . equal ( "+911234567890" ) ;
104
104
} ) ;
105
105
106
- it ( "should return a 400 error when phoneNumber is in incorrect format" , async function ( ) {
106
+ it ( "should return a 400 error when phone is in incorrect format" , async function ( ) {
107
107
req . body = {
108
- phoneNumber : "invalid-number" ,
108
+ phone : "invalid-number" ,
109
109
110
110
} ;
111
111
@@ -116,6 +116,6 @@ describe("Middleware | Validators | Subscription", function () {
116
116
expect ( res . json . calledOnce ) . to . be . equal ( true ) ;
117
117
expect ( res . json . firstCall . args [ 0 ] )
118
118
. to . have . property ( "error" )
119
- . that . includes ( '"phoneNumber " with value "invalid-number" fails to match the required pattern' ) ;
119
+ . that . includes ( '"phone " with value "invalid-number" fails to match the required pattern' ) ;
120
120
} ) ;
121
121
} ) ;
0 commit comments