-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Integration Tests to GetTags, GetPageMedia and GetContentPublishingLimit * Fix issue with Husky * Update changelog
- Loading branch information
1 parent
8ef8ac2
commit f2ac0f2
Showing
11 changed files
with
204 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm run cti && npm run build && npm test && npm run check-format && npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
# `next.release` | ||
|
||
# Changed | ||
|
||
- Fixed issue with parsing `GetContentPublishingLimitRequest` response. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { getClient } from '../TestEnv'; | ||
import { ContentPublishingLimitFields } from '../../main/Enums'; | ||
|
||
describe('GetContentPublishingLimit.test', () => { | ||
it('Gets the content publishing limit with all fields', async () => { | ||
const request = getClient().newGetContentPublishingLimitRequest(); | ||
const result = await request.execute(); | ||
Object.values(ContentPublishingLimitFields).forEach((field) => { | ||
expect(result.getData()[field]).toBeDefined(); | ||
}); | ||
}); | ||
|
||
Object.values(ContentPublishingLimitFields).forEach((field) => { | ||
it(`Gets the content publishing limit with only '${field}'`, async () => { | ||
const request = getClient().newGetContentPublishingLimitRequest(field); | ||
const result = await request.execute(); | ||
Object.values(ContentPublishingLimitFields) | ||
.filter((expectedField) => field != expectedField) | ||
.forEach((expectedField) => expect(result.getData()[expectedField]).toBeUndefined()); | ||
expect(result.getData()[field]).toBeDefined(); | ||
}); | ||
}); | ||
|
||
it("Accepts the 'since' param", async () => { | ||
const request = getClient().newGetContentPublishingLimitRequest(); | ||
const date = new Date(); | ||
date.setHours(date.getHours() - 1); | ||
request.since(date); | ||
const result = await request.execute(); | ||
Object.values(ContentPublishingLimitFields).forEach((field) => { | ||
expect(result.getData()[field]).toBeDefined(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { getClient, getPageId } from '../TestEnv'; | ||
import { PageField } from '../../main/Enums'; | ||
|
||
describe('GetPageInfo', () => { | ||
it('Gets the page info with all fields', async () => { | ||
const request = getClient().newGetPageInfoRequest(); | ||
const result = await request.execute(); | ||
Object.values(PageField).forEach((field) => expect(result.getData()[field]).toBeDefined()); | ||
expect(result.getId()).toEqual(getPageId()); | ||
}); | ||
|
||
Object.values(PageField) | ||
.filter((field) => field != PageField.ID) | ||
.forEach((field) => { | ||
it(`Gets the page info with only '${field}'`, async () => { | ||
const request = getClient().newGetPageInfoRequest(field); | ||
const result = await request.execute(); | ||
Object.values(PageField) | ||
.filter( | ||
(expectedField) => | ||
![ | ||
field, | ||
PageField.ID, // Always returned | ||
].includes(expectedField) | ||
) | ||
.forEach((expectedField) => expect(result.getData()[expectedField]).toBeUndefined()); | ||
|
||
expect(result.getId()).toEqual(getPageId()); | ||
expect(result.getData()[field]).toBeDefined(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { getClient, getPageId } from '../TestEnv'; | ||
import { PrivateMediaField, PublicMediaField } from '../../main/Enums'; | ||
import { MediaData } from '../../main/requests/data/MediaData'; | ||
|
||
describe('GetPageMedia', () => { | ||
it('Gets the page media with all fields', async () => { | ||
const request = getClient().newGetPageMediaRequest(); | ||
const result = await request.execute(); | ||
|
||
const data: MediaData[] = result.getData(); | ||
expect(data.length).toBeGreaterThan(0); | ||
const firstMedia: MediaData = data[0]; | ||
Object.values(PublicMediaField) | ||
.filter( | ||
(field) => | ||
![ | ||
PublicMediaField.CHILDREN, // We don't know if it's a carousel | ||
PublicMediaField.VIDEO_TITLE, // No longer returned | ||
].includes(field) | ||
) | ||
.forEach((field) => expect(firstMedia[field]).toBeDefined()); | ||
Object.values(PrivateMediaField) | ||
.filter( | ||
(field) => | ||
![ | ||
PrivateMediaField.THUMBNAIL_URL, // We don't know if it's a video | ||
].includes(field) | ||
) | ||
.forEach((field) => { | ||
expect(firstMedia[field]).toBeDefined(); | ||
}); | ||
result.getMediaOwnerIds().forEach((id) => expect(id).toEqual(getPageId())); | ||
}); | ||
|
||
Object.values(PublicMediaField) | ||
.filter( | ||
(field) => ![PublicMediaField.ID, PublicMediaField.CHILDREN, PublicMediaField.VIDEO_TITLE].includes(field) | ||
) | ||
.forEach((field) => { | ||
it(`Gets the page tags with only '${field}'`, async () => { | ||
const request = getClient().newGetTagsRequest(field); | ||
const result = await request.execute(); | ||
|
||
const data: MediaData[] = result.getData(); | ||
expect(data.length).toBeGreaterThan(0); | ||
const firstMedia: MediaData = data[0]; | ||
Object.values(PublicMediaField) | ||
.filter( | ||
(expectedField) => | ||
![ | ||
field, | ||
PublicMediaField.ID, // Always returned | ||
].includes(expectedField) | ||
) | ||
.forEach((expectedField) => expect(firstMedia[expectedField]).toBeUndefined()); | ||
Object.values(PrivateMediaField) | ||
.filter( | ||
(expectedField) => | ||
![ | ||
field, | ||
PrivateMediaField.THUMBNAIL_URL, // Always returned | ||
].includes(expectedField) | ||
) | ||
.forEach((expectedField) => expect(firstMedia[expectedField]).toBeUndefined()); | ||
|
||
expect(firstMedia.id).toBeDefined(); | ||
expect(firstMedia[field]).toBeDefined(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { getClient } from '../TestEnv'; | ||
import { PublicMediaField } from '../../main/Enums'; | ||
import { MediaData } from '../../main/requests/data/MediaData'; | ||
|
||
describe('GetTags', () => { | ||
it('Gets the page tags with all fields', async () => { | ||
const request = getClient().newGetTagsRequest(); | ||
const result = await request.execute(); | ||
|
||
const data: MediaData[] = result.getData(); | ||
expect(data.length).toBeGreaterThan(0); | ||
const firstTag: MediaData = data[0]; | ||
Object.values(PublicMediaField) | ||
.filter( | ||
(field) => | ||
![ | ||
PublicMediaField.CHILDREN, // We don't know if it's a carousel | ||
PublicMediaField.VIDEO_TITLE, // No longer returned | ||
].includes(field) | ||
) | ||
.forEach((field) => expect(firstTag[field]).toBeDefined()); | ||
}); | ||
|
||
Object.values(PublicMediaField) | ||
.filter( | ||
(field) => ![PublicMediaField.ID, PublicMediaField.CHILDREN, PublicMediaField.VIDEO_TITLE].includes(field) | ||
) | ||
.forEach((field) => { | ||
it(`Gets the page tags with only '${field}'`, async () => { | ||
const request = getClient().newGetTagsRequest(field); | ||
const result = await request.execute(); | ||
|
||
const data: MediaData[] = result.getData(); | ||
expect(data.length).toBeGreaterThan(0); | ||
const firstTag: MediaData = data[0]; | ||
Object.values(PublicMediaField) | ||
.filter( | ||
(expectedField) => | ||
![ | ||
field, | ||
PublicMediaField.ID, // Always returned | ||
].includes(expectedField) | ||
) | ||
.forEach((expectedField) => expect(firstTag[expectedField]).toBeUndefined()); | ||
|
||
expect(firstTag.id).toBeDefined(); | ||
expect(firstTag[field]).toBeDefined(); | ||
}); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters