add tests
This commit is contained in:
@ -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');
|
||||
});
|
||||
|
Reference in New Issue
Block a user