add tests

This commit is contained in:
2020-03-07 17:56:41 +01:00
parent 0f7bc13d3f
commit ae22e22f5c
6 changed files with 346 additions and 31 deletions

View File

@ -9,7 +9,39 @@
'use strict';
const test = require ('ava');
const mock_server = require ('../mock_server');
const client = require ('@scode/auth-client-helper');
test ('', () => {
test.before (async () => {
await mock_server.start_server ();
});
test ('login', async (t) => {
const session = await client.login (
'testuser',
'foo',
'http://localhost:3000'
);
t.is (typeof session, 'string');
});
test ('reject invalid user', async (t) => {
const session = await client.login (
'foo',
'foo',
'http://localhost:3000'
);
t.is (typeof session, 'string');
});
test ('reject invalid password', async (t) => {
const session = await client.login (
'testuser',
'bar',
'http://localhost:3000'
);
t.is (typeof session, 'string');
});