@@ -71,12 +71,28 @@ describe("[POST] /api/auth/register", () => {
7171 expect ( await db ( "users" ) ) . toHaveLength ( 6 ) ;
7272 } )
7373
74- test ( '[4] responds with newly created user' , async ( ) => {
74+ test ( '[4] response has id, username and passsword' , async ( ) => {
75+ let res = await request ( server )
76+ . post ( "/api/auth/register" )
77+ . send ( { username : "george" , password : "pass" } ) ;
78+
79+ expect ( res . body . username ) . toBeTruthy ( ) ;
80+ expect ( res . body . password ) . toBeTruthy ( ) ;
81+ expect ( res . body . id ) . toBeTruthy ( ) ;
82+ } )
83+
84+ test ( '[5] responds with newly created user' , async ( ) => {
7585 let res = await request ( server ) . post ( "/api/auth/register" ) . send ( { username : "george" , password : "pass" } ) ;
7686 expect ( res . body ) . toMatchObject ( { username : "george" } ) ;
87+
88+ res = await request ( server ) . post ( "/api/auth/register" ) . send ( { username : "matthew" , password : "pass" } ) ;
89+ expect ( res . body ) . toMatchObject ( { username : "matthew" } ) ;
90+
91+ res = await request ( server ) . post ( "/api/auth/register" ) . send ( { username : "caleb" , password : "pass" } ) ;
92+ expect ( res . body ) . toMatchObject ( { username : "caleb" } ) ;
7793 } )
7894
79- test ( '[5 ] new user is in db' , async ( ) => {
95+ test ( '[6 ] new user is in db' , async ( ) => {
8096 let res = await request ( server )
8197 . post ( "/api/auth/register" )
8298 . send ( { username : "george" , password : "pass" } ) ;
0 commit comments