Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return default value of contactPoint['@type'] when overwritten #17

Merged
merged 1 commit into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG.md

## Unreleased
Fixed
- Default value is returned when custom config attempts to overwrite contactPoint['@type'] [#17](https://github.com/koopjs/koop-output-dcat-us-11/pull/17)

## 1.5.0
Added
- Handling of path hierarchies/fallback values [#16](https://github.com/koopjs/koop-output-dcat-us-11/pull/16)
Expand Down
2 changes: 1 addition & 1 deletion src/dcat-us/dataset-formatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function scrubProtectedKeys (customizations: DcatDatasetTemplate): DcatDatasetTe
delete scrubbedCustomizations.landingPage;
delete scrubbedCustomizations.webService;
if (scrubbedCustomizations.contactPoint) {
delete scrubbedCustomizations.contactPoint['@type'];
scrubbedCustomizations.contactPoint['@type'] = 'vcard:Contact';
}
delete scrubbedCustomizations.distribution;
}
Expand Down
5 changes: 4 additions & 1 deletion src/dcat-us/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ describe('generating DCAT-US 1.1 feed', () => {
expect(chk1.issued).toBe('2021-01-29T15:34:38.000Z');
expect(chk1.modified).toBe('2021-07-27T20:25:19.723Z');
expect(chk1.publisher).toEqual({ name: 'QA Premium Alpha Hub' });
expect(chk1.contactPoint).toEqual({ fn: 'thervey_qa_pre_a_hub' });
expect(chk1.contactPoint).toEqual({
"@type": "vcard:Contact",
fn: 'thervey_qa_pre_a_hub'
});
expect(chk1.accessLevel).toBe('public');
expect(chk1.spatial).toBe('-121.118,38.7754,-119.009,39.359');
expect(chk1.theme).toEqual(['geospatial']);
Expand Down
3 changes: 2 additions & 1 deletion src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ describe('Output Plugin', () => {
describe('configuration via query params', () => {
let mockGetDataStreamDcatUs11;

beforeAll(() => {
beforeEach(() => {
const { getDataStreamDcatUs11 } = require('./dcat-us');
jest.mock('./dcat-us');
mockGetDataStreamDcatUs11 = mocked(getDataStreamDcatUs11)
Expand Down Expand Up @@ -318,6 +318,7 @@ describe('Output Plugin', () => {
}
}
mockFetchSite.mockResolvedValue(customConfigSiteModel);
[plugin, app] = buildPluginAndApp();

await request(app)
.get('/dcat')
Expand Down