From 3591e116373994f64d257eb1320c2326eac5dddb Mon Sep 17 00:00:00 2001 From: Dolan Date: Tue, 24 Dec 2019 16:31:35 +0000 Subject: [PATCH] Add hyperlink cache test --- src/file/file.spec.ts | 8 ++++++++ src/file/file.ts | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/file/file.spec.ts b/src/file/file.spec.ts index e34feea1b6..c9ec7b3a3e 100644 --- a/src/file/file.spec.ts +++ b/src/file/file.spec.ts @@ -148,6 +148,14 @@ describe("File", () => { }); }); + describe("#HyperlinkCache", () => { + it("should initially have empty hyperlink cache", () => { + const file = new File(); + + expect(file.HyperlinkCache).to.deep.equal({}); + }); + }); + describe("#createFootnote", () => { it("should create footnote", () => { const wrapper = new File({ diff --git a/src/file/file.ts b/src/file/file.ts index e549b4b624..583d4ace3a 100644 --- a/src/file/file.ts +++ b/src/file/file.ts @@ -61,7 +61,7 @@ export class File { private readonly contentTypes: ContentTypes; private readonly appProperties: AppProperties; private readonly styles: Styles; - private readonly hyperlinkCache: { readonly [key: string]: Hyperlink }; + private readonly hyperlinkCache: { readonly [key: string]: Hyperlink } = {}; constructor( options: IPropertiesOptions = {