Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tmclaugh committed Sep 30, 2024
1 parent a71dcc3 commit 5451184
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/fetchDocs.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]

Expand Down
15 changes: 10 additions & 5 deletions src/fetchDocs.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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('')

Expand All @@ -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 = {
Expand Down Expand Up @@ -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('')
Expand All @@ -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 = {
Expand Down Expand Up @@ -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('')

Expand Down
4 changes: 2 additions & 2 deletions src/fetchDocsToc.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5451184

Please sign in to comment.