From 54511849a62eb97b33c192b5a7f9b293bbf017ae Mon Sep 17 00:00:00 2001 From: Tom McLaughlin Date: Mon, 30 Sep 2024 16:55:53 -0400 Subject: [PATCH] Update tests --- src/fetchDocs.integration.test.ts | 5 ++++- src/fetchDocs.unit.test.ts | 15 ++++++++++----- src/fetchDocsToc.unit.test.ts | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/fetchDocs.integration.test.ts b/src/fetchDocs.integration.test.ts index be97224..691e2e7 100644 --- a/src/fetchDocs.integration.test.ts +++ b/src/fetchDocs.integration.test.ts @@ -10,16 +10,19 @@ const AWS_CFN_DOC_ROOT = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/U const mockTocItem: TocItem = { "title": "Amazon CloudWatch Logs", "href": "AWS_Logs.html", + "docType": "Service" } const mockTocItemContents: TocItem[] = [ { "title": "AWS::Logs::AccountPolicy", - "href": "aws-resource-logs-accountpolicy.html" + "href": "aws-resource-logs-accountpolicy.html", + "docType": "Resource" }, { "title": "AWS::Logs::Delivery", "href": "aws-resource-logs-delivery.html", + "docType": "Resource" } ] diff --git a/src/fetchDocs.unit.test.ts b/src/fetchDocs.unit.test.ts index ccf9927..939dc4a 100644 --- a/src/fetchDocs.unit.test.ts +++ b/src/fetchDocs.unit.test.ts @@ -53,7 +53,8 @@ describe("fetchDocs", () => { test('Given valid valid tocItem, urlRoot, and docsDir', async () => { const tocItem = { title: "title", - href: "index.html", + href: "AWS_Example.html", + docType: "Service" } fetch.mockResponse('') @@ -64,7 +65,8 @@ describe("fetchDocs", () => { test('Given valid valid tocItem (with contents), urlRoot, and docsDir', async () => { const tocItem = { title: "title", - href: "index.html", + href: "AWS_Example.html", + docType: "Service" } const tocItemWithContents = { @@ -96,7 +98,8 @@ describe("fetchDocs", () => { test('Given valid valid tocItem, urlRoot, and docsDir', async () => { const tocItem = { title: "title", - href: "index.html", + href: "AWS_Example.html", + docType: "Service" } fetch.mockResponse('') @@ -109,7 +112,8 @@ describe("fetchDocs", () => { test('Given valid valid tocItem (with contents), urlRoot, and docsDir', async () => { const tocItem = { title: "title", - href: "index.html", + href: "AWS_Example.html", + docType: "Service" } const tocItemWithContents = { @@ -144,7 +148,8 @@ describe("fetchDocs", () => { test('file with same name as tocItem file already exists', async () => { const tocItem = { title: "title", - href: "index.html", + href: "AWS_Example.html", + docType: "Service" } fetch.mockResponse('') diff --git a/src/fetchDocsToc.unit.test.ts b/src/fetchDocsToc.unit.test.ts index 4305262..30e35ed 100644 --- a/src/fetchDocsToc.unit.test.ts +++ b/src/fetchDocsToc.unit.test.ts @@ -91,12 +91,12 @@ describe('fetchDocsToc', () => { describe('should succeed when', () => { test.each([ [{ 'title': 'AWS Example', 'href': 'AWS_Example' }, 'Service'], - [{ 'title': 'Example Property', 'href': 'aws-properties-example-prop.html' }, 'Property'], + [{ 'title': 'Example Property', 'href': 'aws-properties-example-prop.html' }, 'Type'], [{ 'title': 'Example resource', 'href': 'aws-resource-example-res.html' }, 'Resource'], [{ 'title': 'Example attribute', 'href': 'aws-attribute-example-attr.html' }, 'Attribute'], [{ 'title': 'Example function', 'href': 'intrinsic-function-reference-example-fn.html' }, 'Function'], [{ 'title': 'Alexa Example', 'href': 'Alexa_Example.html' }, 'Service'], - [{ 'title': 'Example property', 'href': 'alexa-properties-example-prop.html' }, 'Property'], + [{ 'title': 'Example property', 'href': 'alexa-properties-example-prop.html' }, 'Type'], [{ 'title': 'Example property', 'href': 'alexa-resource-example-res.html' }, 'Resource'], ])('given a filename with an expected prefix', async (item, expectedDocType) => { const docType = identifyDocType(item)