@@ -16,7 +16,7 @@ describe("Middleware | Validators | Subscription", function () {
1616
1717 it ( "should call next function when a valid request body is passed" , async function ( ) {
1818 req . body = {
19- phoneNumber : "+911234567890" ,
19+ phone : "+911234567890" ,
20202121 } ;
2222
@@ -27,7 +27,7 @@ describe("Middleware | Validators | Subscription", function () {
2727 expect ( res . json . called ) . to . be . equal ( false ) ;
2828 } ) ;
2929
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 ( ) {
3131 req . body = {
32323333 } ;
@@ -40,7 +40,7 @@ describe("Middleware | Validators | Subscription", function () {
4040
4141 it ( "should return a 400 error when email is missing" , async function ( ) {
4242 req . body = {
43- phoneNumber : "+911234567890" ,
43+ phone : "+911234567890" ,
4444 } ;
4545
4646 validateSubscribe ( req , res , nextSpy ) ;
@@ -51,7 +51,7 @@ describe("Middleware | Validators | Subscription", function () {
5151 expect ( res . json . firstCall . args [ 0 ] ) . to . have . property ( "error" ) . that . includes ( '"email" is required' ) ;
5252 } ) ;
5353
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 ( ) {
5555 req . body = { } ;
5656
5757 validateSubscribe ( req , res , nextSpy ) ;
@@ -63,7 +63,7 @@ describe("Middleware | Validators | Subscription", function () {
6363
6464 it ( "should return a 400 error when email is not in correct format" , async function ( ) {
6565 req . body = {
66- phoneNumber : "+911234567890" ,
66+ phone : "+911234567890" ,
6767 email : "invalid-email" ,
6868 } ;
6969
@@ -77,9 +77,9 @@ describe("Middleware | Validators | Subscription", function () {
7777 . that . includes ( '"email" with value "invalid-email" fails to match the required pattern' ) ;
7878 } ) ;
7979
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 ( ) {
8181 req . body = {
82- phoneNumber : "+911234567890" ,
82+ phone : "+911234567890" ,
83838484 } ;
8585
@@ -89,9 +89,9 @@ describe("Middleware | Validators | Subscription", function () {
8989 expect ( res . json . called ) . to . be . equal ( false ) ;
9090 } ) ;
9191
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 ( ) {
9393 req . body = {
94- phoneNumber : " +911234567890 " ,
94+ phone : " +911234567890 " ,
95959696 } ;
9797
@@ -100,12 +100,12 @@ describe("Middleware | Validators | Subscription", function () {
100100 expect ( nextSpy . calledOnce ) . to . be . equal ( true ) ;
101101 expect ( res . status . called ) . to . be . equal ( false ) ;
102102 expect ( res . json . called ) . to . be . equal ( false ) ;
103- expect ( req . body . phoneNumber ) . to . equal ( "+911234567890" ) ;
103+ expect ( req . body . phone ) . to . equal ( "+911234567890" ) ;
104104 } ) ;
105105
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 ( ) {
107107 req . body = {
108- phoneNumber : "invalid-number" ,
108+ phone : "invalid-number" ,
109109110110 } ;
111111
@@ -116,6 +116,6 @@ describe("Middleware | Validators | Subscription", function () {
116116 expect ( res . json . calledOnce ) . to . be . equal ( true ) ;
117117 expect ( res . json . firstCall . args [ 0 ] )
118118 . 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' ) ;
120120 } ) ;
121121} ) ;
0 commit comments