- fix for unittest

This commit is contained in:
ezolenko 2023-06-22 22:16:12 -06:00
parent 2cb2660e5c
commit bb783639a9

View File

@ -1,7 +1,7 @@
import { jest, test, expect } from "@jest/globals";
import { makeContext } from "./fixtures/context";
import { RollupContext } from "../src/context";
import { RollupContext, VerbosityLevel } from "../src/context";
(global as any).console = {
warn: jest.fn(),
@ -11,7 +11,7 @@ import { RollupContext } from "../src/context";
test("RollupContext", () => {
const innerContext = makeContext();
const context = new RollupContext(5, false, innerContext);
const context = new RollupContext(5 as VerbosityLevel, false, innerContext);
context.warn("test");
expect(innerContext.warn).toHaveBeenLastCalledWith("test");
@ -40,7 +40,7 @@ test("RollupContext", () => {
test("RollupContext with 0 verbosity", () => {
const innerContext = makeContext();
const context = new RollupContext(0, false, innerContext);
const context = new RollupContext(VerbosityLevel.Error, false, innerContext);
context.debug("verbosity is too low here");
expect(innerContext.debug).not.toBeCalled();
@ -52,7 +52,7 @@ test("RollupContext with 0 verbosity", () => {
test("RollupContext.error + debug negative verbosity", () => {
const innerContext = makeContext();
const context = new RollupContext(-100, true, innerContext);
const context = new RollupContext(-100 as VerbosityLevel, true, innerContext);
context.error("verbosity is too low here");
expect(innerContext.error).not.toBeCalled();
@ -62,7 +62,7 @@ test("RollupContext.error + debug negative verbosity", () => {
test("RollupContext.error with bail", () => {
const innerContext = makeContext();
const context = new RollupContext(5, true, innerContext);
const context = new RollupContext(5 as VerbosityLevel, true, innerContext);
context.error("bail");
expect(innerContext.error).toHaveBeenLastCalledWith("bail");