Skip to content

Commit 919eed6

Browse files
author
Esben Sparre Andreasen
committed
JS: add koa tests
1 parent 00c8387 commit 919eed6

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

javascript/ql/test/library-tests/frameworks/koa/src/koa.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,14 @@ app2.use(async ctx => {
4343
ctx.redirect(url);
4444
ctx.response.redirect(url);
4545
});
46+
47+
app2.use(async ctx => {
48+
var cookies = ctx.cookies;
49+
cookies.get();
50+
51+
var query = ctx.query;
52+
query.foo;
53+
54+
var headers = ctx.headers;
55+
headers.foo;
56+
});

javascript/ql/test/library-tests/frameworks/koa/tests.expected

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ test_RouteSetup
22
| src/koa.js:8:1:8:18 | app2.use(handler1) |
33
| src/koa.js:10:1:28:2 | app2.us ... z');\\n}) |
44
| src/koa.js:30:1:45:2 | app2.us ... rl);\\n}) |
5+
| src/koa.js:47:1:56:2 | app2.us ... foo;\\n}) |
56
test_RequestInputAccess
67
| src/koa.js:19:3:19:18 | ctx.request.body | body | src/koa.js:10:10:28:1 | functio ... az');\\n} |
78
| src/koa.js:20:3:20:23 | ctx.req ... ery.foo | parameter | src/koa.js:10:10:28:1 | functio ... az');\\n} |
@@ -68,6 +69,9 @@ test_RouteHandler_getAContextExpr
6869
| src/koa.js:30:10:45:1 | async c ... url);\\n} | src/koa.js:42:12:42:14 | ctx |
6970
| src/koa.js:30:10:45:1 | async c ... url);\\n} | src/koa.js:43:2:43:4 | ctx |
7071
| src/koa.js:30:10:45:1 | async c ... url);\\n} | src/koa.js:44:2:44:4 | ctx |
72+
| src/koa.js:47:10:56:1 | async c ... .foo;\\n} | src/koa.js:48:16:48:18 | ctx |
73+
| src/koa.js:47:10:56:1 | async c ... .foo;\\n} | src/koa.js:51:14:51:16 | ctx |
74+
| src/koa.js:47:10:56:1 | async c ... .foo;\\n} | src/koa.js:54:16:54:18 | ctx |
7175
test_HeaderDefinition
7276
| src/koa.js:11:3:11:25 | this.se ... 1', '') | src/koa.js:10:10:28:1 | functio ... az');\\n} |
7377
| src/koa.js:12:3:12:37 | this.re ... 2', '') | src/koa.js:10:10:28:1 | functio ... az');\\n} |
@@ -79,6 +83,7 @@ test_RouteSetup_getServer
7983
| src/koa.js:8:1:8:18 | app2.use(handler1) | src/koa.js:5:12:5:20 | new Koa() |
8084
| src/koa.js:10:1:28:2 | app2.us ... z');\\n}) | src/koa.js:5:12:5:20 | new Koa() |
8185
| src/koa.js:30:1:45:2 | app2.us ... rl);\\n}) | src/koa.js:5:12:5:20 | new Koa() |
86+
| src/koa.js:47:1:56:2 | app2.us ... foo;\\n}) | src/koa.js:5:12:5:20 | new Koa() |
8287
test_HeaderDefinition_getAHeaderName
8388
| src/koa.js:11:3:11:25 | this.se ... 1', '') | header1 |
8489
| src/koa.js:12:3:12:37 | this.re ... 2', '') | header2 |
@@ -106,13 +111,15 @@ test_RouteSetup_getARouteHandler
106111
| src/koa.js:8:1:8:18 | app2.use(handler1) | src/koa.js:7:1:7:22 | functio ... r1() {} |
107112
| src/koa.js:10:1:28:2 | app2.us ... z');\\n}) | src/koa.js:10:10:28:1 | functio ... az');\\n} |
108113
| src/koa.js:30:1:45:2 | app2.us ... rl);\\n}) | src/koa.js:30:10:45:1 | async c ... url);\\n} |
114+
| src/koa.js:47:1:56:2 | app2.us ... foo;\\n}) | src/koa.js:47:10:56:1 | async c ... .foo;\\n} |
109115
test_AppDefinition
110116
| src/koa.js:2:12:2:33 | new (re ... oa'))() |
111117
| src/koa.js:5:12:5:20 | new Koa() |
112118
test_RouteHandler
113119
| src/koa.js:7:1:7:22 | functio ... r1() {} | src/koa.js:5:12:5:20 | new Koa() |
114120
| src/koa.js:10:10:28:1 | functio ... az');\\n} | src/koa.js:5:12:5:20 | new Koa() |
115121
| src/koa.js:30:10:45:1 | async c ... url);\\n} | src/koa.js:5:12:5:20 | new Koa() |
122+
| src/koa.js:47:10:56:1 | async c ... .foo;\\n} | src/koa.js:5:12:5:20 | new Koa() |
116123
test_RequestExpr
117124
| src/koa.js:19:3:19:13 | ctx.request | src/koa.js:10:10:28:1 | functio ... az');\\n} |
118125
| src/koa.js:20:3:20:13 | ctx.request | src/koa.js:10:10:28:1 | functio ... az');\\n} |
@@ -160,6 +167,9 @@ test_ContextExpr
160167
| src/koa.js:42:12:42:14 | ctx | src/koa.js:30:10:45:1 | async c ... url);\\n} |
161168
| src/koa.js:43:2:43:4 | ctx | src/koa.js:30:10:45:1 | async c ... url);\\n} |
162169
| src/koa.js:44:2:44:4 | ctx | src/koa.js:30:10:45:1 | async c ... url);\\n} |
170+
| src/koa.js:48:16:48:18 | ctx | src/koa.js:47:10:56:1 | async c ... .foo;\\n} |
171+
| src/koa.js:51:14:51:16 | ctx | src/koa.js:47:10:56:1 | async c ... .foo;\\n} |
172+
| src/koa.js:54:16:54:18 | ctx | src/koa.js:47:10:56:1 | async c ... .foo;\\n} |
163173
test_RedirectInvocation
164174
| src/koa.js:43:2:43:18 | ctx.redirect(url) | src/koa.js:43:15:43:17 | url | src/koa.js:30:10:45:1 | async c ... url);\\n} |
165175
| src/koa.js:44:2:44:27 | ctx.res ... ct(url) | src/koa.js:44:24:44:26 | url | src/koa.js:30:10:45:1 | async c ... url);\\n} |

0 commit comments

Comments
 (0)