thunderhub/server/tests/testMocks.ts
Anthony Potdevin a78b6e96d5
test: 🚨 more server unit tests (#70)
* chore: 🔧 add tests

* fix: 🐛 network info resolver

* feat:  init tests

* chore: 🔧 improve test

* chore: 🔧 more tests

* chore: 🔧 bitcoin resolvers

* chore: 🔧 more tests
2020-06-13 11:46:20 +02:00

75 lines
1.3 KiB
TypeScript

import { ServerResponse } from 'http';
import { ContextType } from 'server/types/apiTypes';
export const AuthMock = {
auth: {
type: 'test',
},
};
export const ContextMock: ContextType = {
ip: '1.2.3.4',
secret: '123456789',
ssoVerified: true,
account: {
id: 'accountID',
password: 'password',
},
sso: {
macaroon: 'macaroon',
cert: 'cert',
host: 'host',
},
accounts: [
{
name: 'account',
id: 'accountID',
host: 'host',
macaroon: 'macaroon',
cert: 'cert',
},
],
res: {} as ServerResponse,
};
export const ContextMockNoAccounts: ContextType = {
ip: '1.2.3.4',
secret: '123456789',
ssoVerified: true,
account: {
id: 'accountID',
password: 'password',
},
sso: {
macaroon: 'macaroon',
cert: 'cert',
host: 'host',
},
accounts: [],
res: {} as ServerResponse,
};
export const ContextMockNoSSO: ContextType = {
ip: '1.2.3.4',
secret: '123456789',
ssoVerified: true,
account: {
id: 'accountID',
password: 'password',
},
sso: {
macaroon: null,
cert: null,
host: null,
},
accounts: [
{
name: 'account',
id: 'accountID',
host: 'host',
macaroon: 'macaroon',
cert: 'cert',
},
],
res: {} as ServerResponse,
};