Skip to content
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
35 changes: 35 additions & 0 deletions fixtures/anchorPlaysByGenderEmpty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"provider": "anchor",
"version": 1,
"retrieved": "2023-05-05T16:20:56.696026",
"meta": {
"show": "123abcde",
"endpoint": "playsByGender"
},
"range": {
"start": "2023-05-01",
"end": "2023-05-04"
},
"data": {
"stationId": 98765432,
"kind": "playsByGender",
"parameters": {
"timeRange": []
},
"data": {
"rows": [],
"columnHeaders": [
{
"name": "Gender",
"type": "string"
},
{
"name": "Percent of Plays",
"type": "number"
}
],
"translationMapping": {},
"colors": {}
}
}
}
36 changes: 25 additions & 11 deletions src/schema/anchor/playsByGender.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,18 @@
"type": "string"
}
},
"required": [
"Female",
"Male",
"Non-binary",
"Not specified"
"anyOf": [
{
"maxProperties": 0
},
{
"required": [
"Female",
"Male",
"Non-binary",
"Not specified"
]
}
]
},
"columnHeaders": {
Expand Down Expand Up @@ -141,11 +148,18 @@
"type": "string"
}
},
"required": [
"Male",
"Female",
"Not specified",
"Non-binary"
"anyOf": [
{
"maxProperties": 0
},
{
"required": [
"Male",
"Female",
"Not specified",
"Non-binary"
]
}
]
}
},
Expand All @@ -172,4 +186,4 @@
"meta",
"data"
]
}
}
11 changes: 11 additions & 0 deletions tests/api_e2e/anchor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const anchorPlaysByAgeRangePayload = require('../../fixtures/anchorPlaysByAgeRan
const anchorPlaysByAppPayload = require('../../fixtures/anchorPlaysByApp.json')
const anchorPlaysByDevicePayload = require('../../fixtures/anchorPlaysByDevice.json')
const anchorPlaysByGenderPayload = require('../../fixtures/anchorPlaysByGender.json')
const anchorPlaysByGenderEmptyPayload = require('../../fixtures/anchorPlaysByGenderEmpty.json')
const anchorPlaysByGeoPayload = require('../../fixtures/anchorPlaysByGeo.json')
const anchorPodcastEpisodePayload = require('../../fixtures/anchorPodcastEpisode.json')
const anchorTotalPlaysPayload = require('../../fixtures/anchorTotalPlays.json')
Expand Down Expand Up @@ -170,6 +171,16 @@ describe('check Connector API with anchorPlaysByGenderPayload', () => {
})
})

describe('check Connector API with anchorPlaysByGenderEmptyPayload', () => {
it('should return status 200 when sending Anchor playsByGender payload with empty translationMapping and colors', async () => {
const response = await request(baseURL)
.post('/connector')
.set(auth)
.send(anchorPlaysByGenderEmptyPayload)
expect(response.statusCode).toBe(200)
})
})

describe('check Connector API with anchorPlaysByGeoPayload', () => {
it('should return status 200 when sending proper Anchor payload', async () => {
const response = await request(baseURL)
Expand Down
Loading