storage-upload/test/helper.server.mjs

42 lines
715 B
JavaScript

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
export function createClient() {
return new Client()
}
export function resetLog() {
serv.log.log.reset()
serv.log.info.reset()
serv.log.warn.reset()
serv.log.error.reset()
}
export function createContext(opts) {
return defaults(opts, {
query: new Map(),
req: { },
res: { },
log: {
log: stub(),
warn: stub(),
info: stub(),
error: stub(),
},
})
}