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
4 changes: 2 additions & 2 deletions lib/jsonld_serializers.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,10 +289,10 @@ class ResourceSerializer extends JsonLdItemSerializer {
ResourceSerializer.getFormattedFormat = function (formatId) {
const prefLabel = nyplCore.formats()[formatId]?.label
if (!prefLabel) return null
return {
return [{
'@id': formatId,
prefLabel
}
}]
}

ResourceSerializer.formatElectronicResourceBlankNode = function (link, rdfsType) {
Expand Down
4 changes: 2 additions & 2 deletions test/jsonld-serializers.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ describe('JSONLD Serializers', () => {
const serialized = await ResourceSerializer.serialize({
formatId: 'a'
})
expect(serialized.format).to.deep.equal({
expect(serialized.format).to.deep.equal([{
'@id': 'a',
prefLabel: 'Book/Text'
})
}])
})

it('removes invalid format', async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/resource_serializer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const esResponse = require('./fixtures/item-filter-aggregations.json')
describe('Resource Serializer', () => {
describe('formatformat', () => {
it('should format properly', () => {
expect(ResourceSerializer.getFormattedFormat('a')).to.deep.equal({ '@id': 'a', prefLabel: 'Book/Text' })
expect(ResourceSerializer.getFormattedFormat('a')).to.deep.equal([{ '@id': 'a', prefLabel: 'Book/Text' }])
})
})
describe('.formatItemFilterAggregations()', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/resources-responses.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ describe('Test Resources responses', function () {

assert(doc.itemAggregations)

assert.deepEqual(doc.format, { '@id': 'a', prefLabel: 'Book/Text' })
assert.deepEqual(doc.format, [{ '@id': 'a', prefLabel: 'Book/Text' }])

done()
})
Expand Down