-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathoutput.test.ts
44 lines (40 loc) · 1.42 KB
/
output.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import chai from "chai";
import Vue from "vue/dist/vue.min";
import VueLogger from "../src/index";
import {LogLevels} from "../src/enum/log-levels";
import {ILoggerOptions} from "../src/interfaces/logger-options";
const expect = chai.expect;
describe("output", () => {
test("Should instantiate log functions and be reachable from external functions.", (done) => {
const options = {
isEnabled: true,
logLevel: LogLevels.DEBUG,
stringifyArguments: false,
showLogLevel: false,
showMethodName: true,
separator: "|",
showConsoleColors: false,
} as ILoggerOptions;
Vue.use(VueLogger, options);
const App = new Vue({
created() {
this.foo();
done();
},
methods: {
foo() {
expect(Vue.$log.fatal("test")).to.exist;
expect(Vue.$log.error("error")).to.exist;
expect(Vue.$log.warn("warn")).to.exist;
expect(Vue.$log.info("info")).to.exist;
expect(Vue.$log.debug("debug")).to.exist;
externalFunction();
},
},
});
function externalFunction(): void {
expect(Vue.$log.fatal("test")).to.exist;
expect(Vue.$log.fatal("test")).to.contains("externalFunction");
}
});
});