diff options
Diffstat (limited to 'example/todo/app/test/src/TodoTest.scala')
-rw-r--r-- | example/todo/app/test/src/TodoTest.scala | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/example/todo/app/test/src/TodoTest.scala b/example/todo/app/test/src/TodoTest.scala new file mode 100644 index 0000000..8f38612 --- /dev/null +++ b/example/todo/app/test/src/TodoTest.scala @@ -0,0 +1,22 @@ +package app +import utest._ +object TodoTests extends TestSuite{ + def test[T](example: cask.main.BaseMain)(f: String => T): T = { + val server = io.undertow.Undertow.builder + .addHttpListener(8080, "localhost") + .setHandler(example.defaultHandler) + .build + server.start() + val res = + try f("http://localhost:8080") + finally server.stop() + res + } + val tests = Tests{ + 'TodoServer - test(TodoServer){ host => + val page = requests.get(host).text() + assert(page.contains("What needs to be done?")) + } + } + +}
\ No newline at end of file |