File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ local lu = require (' luaunit' )
2+ local libjwt = require (' ../lib/resty/libjwt' )
3+
4+ function TestShouldReturnErrorWhenNotFindingTheToken ()
5+ local headers = {
6+ [" header_token" ] = " token 123" ,
7+ }
8+ local result , err = libjwt .get_token (headers , " header89" )
9+ lu .assertEquals (err , " token not found" )
10+ lu .assertEquals (result , nil )
11+
12+ local headers = {
13+ [" header_token" ] = " token123" ,
14+ }
15+ local result , err = libjwt .get_token (headers , " header_token" )
16+ lu .assertEquals (err , " token not found" )
17+ lu .assertEquals (result , nil )
18+ end
19+
20+ function TestShouldNotReturnErrorWhenCorrectParameters ()
21+ local headers = {
22+ [" token" ] = " token 123" ,
23+ }
24+ local result , err = libjwt .get_token (headers , " token" )
25+ lu .assertEquals (err , " " )
26+ lu .assertEquals (result , " 123" )
27+ end
28+
29+
30+ os.exit ( lu .LuaUnit .run () )
You can’t perform that action at this time.
0 commit comments