fix: unit tests fix

This commit is contained in:
Lentyaev Pavel
2023-04-19 16:51:03 +03:00
parent c59c5350fd
commit 704c678333
10 changed files with 25 additions and 24 deletions

View File

@ -41,11 +41,11 @@ const createAnchor = (drawingOptions: IDrawingOptions): Anchor =>
describe("Anchor", () => {
before(() => {
stub(convenienceFunctions, "uniqueNumericId").callsFake(() => 0);
stub(convenienceFunctions, "docPropertiesUniqueNumericId").callsFake(() => 0);
});
after(() => {
(convenienceFunctions.uniqueNumericId as SinonStub).restore();
(convenienceFunctions.docPropertiesUniqueNumericId as SinonStub).restore();
});
let anchor: Anchor;

View File

@ -2,7 +2,7 @@
import { IContext, IXmlableObject, NextAttributeComponent, XmlComponent } from "@file/xml-components";
import { ConcreteHyperlink } from "@file/paragraph";
import { uniqueNumericIdCreator } from "@util/convenience-functions";
import { docPropertiesUniqueNumericId } from "@util/convenience-functions";
import { createHyperlinkClick } from "./doc-properties-children";
@ -24,8 +24,6 @@ export interface DocPropertiesOptions {
readonly title: string;
}
const uniqueNumericId = uniqueNumericIdCreator();
export class DocProperties extends XmlComponent {
public constructor({ name, description, title }: DocPropertiesOptions = { name: "", description: "", title: "" }) {
super("wp:docPr");
@ -34,7 +32,7 @@ export class DocProperties extends XmlComponent {
new NextAttributeComponent({
id: {
key: "id",
value: uniqueNumericId(),
value: docPropertiesUniqueNumericId(),
},
name: {
key: "name",

View File

@ -31,11 +31,11 @@ const createDrawing = (drawingOptions?: IDrawingOptions): Drawing =>
describe("Drawing", () => {
before(() => {
stub(convenienceFunctions, "uniqueNumericId").callsFake(() => 0);
stub(convenienceFunctions, "docPropertiesUniqueNumericId").callsFake(() => 0);
});
after(() => {
(convenienceFunctions.uniqueNumericId as SinonStub).restore();
(convenienceFunctions.docPropertiesUniqueNumericId as SinonStub).restore();
});
let currentBreak: Drawing;