Porting tests over to vitest
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { expect } from "chai";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { appendContentType } from "./content-types-manager";
|
||||
|
||||
describe("content-types-manager", () => {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import * as chai from "chai";
|
||||
import * as sinon from "sinon";
|
||||
import JSZip from "jszip";
|
||||
@ -8,7 +9,6 @@ import { ExternalHyperlink, ImageRun, Paragraph, TextRun } from "@file/paragraph
|
||||
import { patchDocument, PatchType } from "./from-docx";
|
||||
|
||||
chai.use(chaiAsPromised);
|
||||
const { expect } = chai;
|
||||
|
||||
const MOCK_XML = `
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
@ -220,7 +220,7 @@ describe("from-docx", () => {
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
(JSZip.loadAsync as unknown as sinon.SinonStub).restore();
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it("should patch the document", async () => {
|
||||
@ -306,7 +306,7 @@ describe("from-docx", () => {
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
(JSZip.loadAsync as unknown as sinon.SinonStub).restore();
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it("should use the relationships file rather than create one", async () => {
|
||||
@ -350,7 +350,7 @@ describe("from-docx", () => {
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
(JSZip.loadAsync as unknown as sinon.SinonStub).restore();
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it("should throw an error if the content types is not found", () =>
|
||||
@ -388,7 +388,7 @@ describe("from-docx", () => {
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
(JSZip.loadAsync as unknown as sinon.SinonStub).restore();
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it("should throw an error if the content types is not found", () =>
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { expect } from "chai";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { findRunElementIndexWithToken, splitRunElement } from "./paragraph-split-inject";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { expect } from "chai";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { replaceTokenInParagraphElement } from "./paragraph-token-replacer";
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { TargetModeType } from "@file/relationships/relationship/relationship";
|
||||
import { expect } from "chai";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { appendRelationship, getNextRelationshipIndex } from "./relationship-manager";
|
||||
|
||||
|
@ -2,7 +2,7 @@ import { IViewWrapper } from "@file/document-wrapper";
|
||||
import { File } from "@file/file";
|
||||
import { Paragraph, TextRun } from "@file/paragraph";
|
||||
import { IContext } from "@file/xml-components";
|
||||
import { expect } from "chai";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import * as sinon from "sinon";
|
||||
|
||||
import { PatchType } from "./from-docx";
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { expect } from "chai";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { renderParagraphNode } from "./run-renderer";
|
||||
|
||||
describe("run-renderer", () => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { expect } from "chai";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { findLocationOfText } from "./traverser";
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { expect } from "chai";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { createTextElementContents, getFirstLevelElements, patchSpaceAttribute, toJson } from "./util";
|
||||
|
||||
|
Reference in New Issue
Block a user