48 lines
1003 B
JavaScript
48 lines
1003 B
JavaScript
/*
|
|
* Copyright (C) Sapphirecode - All Rights Reserved
|
|
* This file is part of auth-server-helper which is released under MIT.
|
|
* See file 'LICENSE' for full license details.
|
|
* Created by Timo Hocker <timo@scode.ovh>, March 2020
|
|
*/
|
|
|
|
// @ts-nocheck
|
|
'use strict';
|
|
|
|
const test = require ('ava');
|
|
const mock_server = require ('../mock_server');
|
|
const client = require ('@scode/auth-client-helper');
|
|
|
|
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');
|
|
});
|