@@ -3,8 +3,9 @@ var request = require('supertest')(app);
33var should = require ( "should" ) ;
44
55describe ( 'api/auth/test.js' , function ( ) {
6- var account = 'lisong2010@gmail .com' ;
6+ var account = '522539441@qq .com' ;
77 var password = '123456' ;
8+
89 describe ( 'sign in' , function ( done ) {
910 it ( 'should not sign in successful when account is empty' , function ( done ) {
1011 request . post ( '/auth/login' )
@@ -14,7 +15,7 @@ describe('api/auth/test.js', function() {
1415 } )
1516 . end ( function ( err , res ) {
1617 should . not . exist ( err ) ;
17- res . text . should . equal ( `{" status" :"ERROR"," errorMessage" :"请您输入邮箱地址"}` ) ;
18+ JSON . parse ( res . text ) . should . containEql ( { status :"ERROR" , errorMessage :"请您输入邮箱地址" } ) ;
1819 done ( ) ;
1920 } ) ;
2021 } ) ;
@@ -26,7 +27,7 @@ describe('api/auth/test.js', function() {
2627 } )
2728 . end ( function ( err , res ) {
2829 should . not . exist ( err ) ;
29- res . text . should . equal ( `{" status" :"ERROR"," errorMessage" :"您输入的邮箱或密码有误"}` ) ;
30+ JSON . parse ( res . text ) . should . containEql ( { status :"ERROR" , errorMessage :"您输入的邮箱或密码有误" } ) ;
3031 done ( ) ;
3132 } ) ;
3233 } ) ;
@@ -38,7 +39,7 @@ describe('api/auth/test.js', function() {
3839 } )
3940 . end ( function ( err , res ) {
4041 should . not . exist ( err ) ;
41- res . text . should . equal ( `{" status" :"ERROR"," errorMessage" :"您输入的邮箱或密码有误"}` ) ;
42+ JSON . parse ( res . text ) . should . containEql ( { status :"ERROR" , errorMessage :"您输入的邮箱或密码有误" } ) ;
4243 done ( ) ;
4344 } ) ;
4445 } ) ;
@@ -50,7 +51,7 @@ describe('api/auth/test.js', function() {
5051 } )
5152 . end ( function ( err , res ) {
5253 should . not . exist ( err ) ;
53- JSON . parse ( res . text ) . status . should . equal ( 'OK' )
54+ JSON . parse ( res . text ) . should . containEql ( { status : "OK" } )
5455 done ( ) ;
5556 } ) ;
5657 } ) ;
0 commit comments