tests: fixup tests and linting issues
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
import { assert, expect } from "chai";
|
||||
import { SinonStub, stub } from "sinon";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
import * as convenienceFunctions from "@util/convenience-functions";
|
||||
|
||||
import { Utility } from "tests/utility";
|
||||
|
||||
@ -458,7 +456,7 @@ describe("Anchor", () => {
|
||||
"wp:docPr": {
|
||||
_attr: {
|
||||
descr: "test",
|
||||
id: 0,
|
||||
id: 1,
|
||||
name: "test",
|
||||
title: "test",
|
||||
},
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { expect } from "chai";
|
||||
import { SinonStub, stub } from "sinon";
|
||||
|
||||
import { IContext } from "@file/xml-components";
|
||||
import { Formatter } from "@export/formatter";
|
||||
import * as convenienceFunctions from "@util/convenience-functions";
|
||||
|
||||
import { ConcreteHyperlink, TextRun } from "../";
|
||||
import { Drawing, IDrawingOptions } from "./drawing";
|
||||
@ -70,7 +68,7 @@ describe("Drawing", () => {
|
||||
"wp:docPr": {
|
||||
_attr: {
|
||||
descr: "",
|
||||
id: 0,
|
||||
id: 1,
|
||||
name: "",
|
||||
title: "",
|
||||
},
|
||||
@ -301,7 +299,7 @@ describe("Drawing", () => {
|
||||
"wp:docPr": {
|
||||
_attr: {
|
||||
descr: "",
|
||||
id: 0,
|
||||
id: 1,
|
||||
name: "",
|
||||
title: "",
|
||||
},
|
||||
@ -535,7 +533,7 @@ describe("Drawing", () => {
|
||||
{
|
||||
_attr: {
|
||||
descr: "",
|
||||
id: 0,
|
||||
id: 1,
|
||||
name: "",
|
||||
title: "",
|
||||
},
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { expect } from "chai";
|
||||
import { SinonStub, stub } from "sinon";
|
||||
|
||||
import { Formatter } from "@export/formatter";
|
||||
import * as convenienceFunctions from "@util/convenience-functions";
|
||||
|
||||
import { Numbering } from "./numbering";
|
||||
|
||||
@ -18,7 +16,7 @@ describe("Numbering", () => {
|
||||
const abstractNums = tree["w:numbering"].filter((el) => el["w:abstractNum"]);
|
||||
expect(abstractNums).to.have.lengthOf(1);
|
||||
expect(abstractNums[0]["w:abstractNum"]).to.deep.include.members([
|
||||
{ _attr: { "w:abstractNumId": 0, "w15:restartNumberingAfterBreak": 0 } },
|
||||
{ _attr: { "w:abstractNumId": 1, "w15:restartNumberingAfterBreak": 0 } },
|
||||
{ "w:multiLevelType": { _attr: { "w:val": "hybridMultilevel" } } },
|
||||
]);
|
||||
|
||||
|
@ -124,7 +124,7 @@ describe("ImageRun", () => {
|
||||
"wp:docPr": {
|
||||
_attr: {
|
||||
descr: "",
|
||||
id: 0,
|
||||
id: 1,
|
||||
name: "",
|
||||
title: "",
|
||||
},
|
||||
@ -376,7 +376,7 @@ describe("ImageRun", () => {
|
||||
"wp:docPr": {
|
||||
_attr: {
|
||||
descr: "",
|
||||
id: 0,
|
||||
id: 1,
|
||||
name: "",
|
||||
title: "",
|
||||
},
|
||||
@ -632,7 +632,7 @@ describe("ImageRun", () => {
|
||||
"wp:docPr": {
|
||||
_attr: {
|
||||
descr: "",
|
||||
id: 0,
|
||||
id: 1,
|
||||
name: "",
|
||||
title: "",
|
||||
},
|
||||
@ -891,7 +891,7 @@ describe("ImageRun", () => {
|
||||
"wp:docPr": {
|
||||
_attr: {
|
||||
descr: "",
|
||||
id: 0,
|
||||
id: 1,
|
||||
name: "",
|
||||
title: "",
|
||||
},
|
||||
|
@ -5,15 +5,21 @@ export const convertMillimetersToTwip = (millimeters: number): number => Math.fl
|
||||
|
||||
export const convertInchesToTwip = (inches: number): number => Math.floor(inches * 72 * 20);
|
||||
|
||||
export const uniqueNumericIdCreator = (initial = 0): (() => number) => {
|
||||
export type UniqueNumericIdCreator = () => number;
|
||||
|
||||
export const uniqueNumericIdCreator = (initial = 0): UniqueNumericIdCreator => {
|
||||
let currentCount = initial;
|
||||
|
||||
return () => ++currentCount;
|
||||
};
|
||||
|
||||
export const abstractNumUniqueNumericIdGen = () => uniqueNumericIdCreator();
|
||||
export const concreteNumUniqueNumericIdGen = () => uniqueNumericIdCreator(1); // Setting initial to 1 as we have numId = 1 for "default-bullet-numbering"
|
||||
export const docPropertiesUniqueNumericIdGen = () => uniqueNumericIdCreator();
|
||||
export const bookmarkUniqueNumericIdGen = () => uniqueNumericIdCreator();
|
||||
export const abstractNumUniqueNumericIdGen = (): UniqueNumericIdCreator => uniqueNumericIdCreator();
|
||||
|
||||
// Setting initial to 1 as we have numId = 1 for "default-bullet-numbering"
|
||||
export const concreteNumUniqueNumericIdGen = (): UniqueNumericIdCreator => uniqueNumericIdCreator(1);
|
||||
|
||||
export const docPropertiesUniqueNumericIdGen = (): UniqueNumericIdCreator => uniqueNumericIdCreator();
|
||||
|
||||
export const bookmarkUniqueNumericIdGen = (): UniqueNumericIdCreator => uniqueNumericIdCreator();
|
||||
|
||||
export const uniqueId = (): string => nanoid().toLowerCase();
|
||||
|
Reference in New Issue
Block a user