File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -76,4 +76,31 @@ describe("[POST] /api/auth/register", () => {
7676 expect ( res . body ) . toMatchObject ( { username : "george" } ) ;
7777 } )
7878
79+ test ( '[5] new user is in db' , async ( ) => {
80+ let res = await request ( server )
81+ . post ( "/api/auth/register" )
82+ . send ( { username : "george" , password : "pass" } ) ;
83+
84+ let id = res . body . id ;
85+
86+ expect ( res . body ) . toMatchObject ( await db ( "users" ) . where ( { id} ) . first ( ) ) ;
87+
88+ res = await request ( server )
89+ . post ( "/api/auth/register" )
90+ . send ( { username : "billy" , password : "pass" } ) ;
91+
92+ id = res . body . id ;
93+
94+ expect ( res . body ) . toMatchObject ( await db ( "users" ) . where ( { id} ) . first ( ) ) ;
95+
96+ res = await request ( server )
97+ . post ( "/api/auth/register" )
98+ . send ( { username : "matthew" , password : "pass" } ) ;
99+
100+ id = res . body . id ;
101+
102+ expect ( res . body ) . toMatchObject ( await db ( "users" ) . where ( { id} ) . first ( ) ) ;
103+
104+ } )
105+
79106} )
You can’t perform that action at this time.
0 commit comments