Porting tests over to vitest

This commit is contained in:
Dolan Miu
2023-06-05 00:33:43 +01:00
parent a89919397d
commit e69b063687
256 changed files with 1557 additions and 612 deletions

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { Alignment, AlignmentType } from "./alignment";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { beforeEach, describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { beforeEach, describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { assert } from "chai";
import { assert, beforeEach, describe, it } from "vitest";
import { Utility } from "tests/utility";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { HorizontalPositionAlign, VerticalPositionAlign } from "@file/shared";

View File

@ -1,4 +1,4 @@
import { assert, expect } from "chai";
import { assert, beforeEach, describe, expect, it } from "vitest";
import { Utility } from "tests/utility";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { beforeEach, describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { PageReferenceFieldInstruction } from "./pageref-field-instruction";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { PageReference } from "./pageref";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { MathPreSubSuperScriptProperties } from "./math-pre-sub-super-script-function-properties";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { MathSubScriptProperties } from "./math-sub-script-function-properties";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { MathSubSuperScriptProperties } from "./math-sub-super-script-function-properties";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { MathSuperScriptProperties } from "./math-super-script-function-properties";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,5 +1,4 @@
import { assert, expect } from "chai";
import { SinonStub, stub } from "sinon";
import { afterEach, assert, beforeEach, describe, expect, it, vi } from "vitest";
import * as convenienceFunctions from "@util/convenience-functions";
@ -18,14 +17,13 @@ import { Paragraph } from "./paragraph";
import { TextRun } from "./run";
describe("Paragraph", () => {
before(() => {
stub(convenienceFunctions, "uniqueId").callsFake(() => "test-unique-id");
stub(convenienceFunctions, "bookmarkUniqueNumericIdGen").callsFake(() => () => -101);
beforeEach(() => {
vi.spyOn(convenienceFunctions, "uniqueId").mockReturnValue("test-unique-id");
vi.spyOn(convenienceFunctions, "bookmarkUniqueNumericIdGen").mockReturnValue(() => -101);
});
after(() => {
(convenienceFunctions.uniqueId as SinonStub).restore();
(convenienceFunctions.bookmarkUniqueNumericIdGen as SinonStub).restore();
afterEach(() => {
vi.restoreAllMocks();
});
describe("#constructor()", () => {

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { DocumentWrapper } from "../document-wrapper";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { beforeEach, describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import * as sinon from "sinon";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import {

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,5 +1,4 @@
import { expect } from "chai";
import { SinonStub, stub } from "sinon";
import { afterAll, beforeAll, describe, expect, it, vi } from "vitest";
import { Formatter } from "@export/formatter";
import { IViewWrapper } from "@file/document-wrapper";
@ -9,12 +8,12 @@ import * as convenienceFunctions from "@util/convenience-functions";
import { ImageRun } from "./image-run";
describe("ImageRun", () => {
before(() => {
stub(convenienceFunctions, "uniqueId").callsFake(() => "test-unique-id");
beforeAll(() => {
vi.spyOn(convenienceFunctions, "uniqueId").mockReturnValue("test-unique-id");
});
after(() => {
(convenienceFunctions.uniqueId as SinonStub).restore();
afterAll(() => {
vi.resetAllMocks();
});
describe("#constructor()", () => {

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { SpaceType } from "@file/shared";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { BorderStyle } from "@file/border";

View File

@ -1,4 +1,4 @@
import { assert } from "chai";
import { assert, beforeEach, describe, it } from "vitest";
import { Utility } from "tests/utility";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";
import { FootnoteReferenceRun } from "@file/footnotes/footnote/run/reference-run";

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { describe, expect, it } from "vitest";
import { Formatter } from "@export/formatter";