29 lines
No EOL
570 B
JavaScript
29 lines
No EOL
570 B
JavaScript
import { stub } from 'eltro'
|
|
import lowdb from '../core/db.mjs'
|
|
import Util from '../core/util.mjs'
|
|
|
|
export function createFakeLog() {
|
|
return {
|
|
info: stub(),
|
|
warn: stub(),
|
|
error: stub(),
|
|
event: {
|
|
info: stub(),
|
|
warn: stub(),
|
|
error: stub(),
|
|
}
|
|
}
|
|
}
|
|
|
|
export function createFakeContext(config = { }, util = new Util(import.meta.url), filename = null) {
|
|
const log = createFakeLog()
|
|
|
|
return lowdb(config, log, filename).then(function(res) {
|
|
return {
|
|
db: res,
|
|
util: util,
|
|
log: log,
|
|
core: { },
|
|
}
|
|
})
|
|
} |