storage-upload/test/helper.server.mjs

44 lines
747 B
JavaScript
Raw Normal View History

import { stub } from 'eltro'
import Client from './helper.client.mjs'
import defaults from '../api/defaults.mjs'
import serv from '../api/server.mjs'
serv.log = {
log: stub(),
warn: stub(),
info: stub(),
error: stub(),
child: stub(),
}
serv.log.child.returns(serv.log)
export const server = serv
2017-12-09 21:51:18 +00:00
export function createClient() {
return new Client()
}
2017-12-10 09:45:38 +00:00
export function resetLog() {
serv.log.log.reset()
serv.log.info.reset()
serv.log.warn.reset()
serv.log.error.reset()
}
2017-12-10 09:45:38 +00:00
export function createContext(opts) {
return defaults(opts, {
query: new Map(),
params: { },
2017-12-10 09:45:38 +00:00
req: { },
res: { },
state: {},
log: {
log: stub(),
warn: stub(),
info: stub(),
error: stub(),
},
2017-12-10 09:45:38 +00:00
})
}