v2 / vlib / x / async / tests / veb / veb_integration_test.v
18 lines · 17 sloc · 439 bytes · 15fb60b77ea6073658aa8355b247f2e1ae03b714
Raw
1import context
2import time
3import veb
4import x.async as xasync
5
6fn test_veb_context_response_inside_timeout() {
7 xasync.with_timeout(1 * time.second, fn (mut ctx context.Context) ! {
8 _ = ctx
9 mut web_ctx := veb.Context{}
10 _ := web_ctx.text('hello from veb')
11 if web_ctx.res.status_code != 200 {
12 return error('unexpected veb status')
13 }
14 if web_ctx.res.body != 'hello from veb' {
15 return error('unexpected veb body')
16 }
17 })!
18}
19