diff --git a/lib/jsonld_serializers.js b/lib/jsonld_serializers.js index bc052cd..3f24c06 100644 --- a/lib/jsonld_serializers.js +++ b/lib/jsonld_serializers.js @@ -288,7 +288,7 @@ class ResourceSerializer extends JsonLdItemSerializer { ResourceSerializer.getFormattedRecordType = function (recordTypeId) { return { - '@id': 'recordType:' + recordTypeId, + '@id': recordTypeId, prefLabel: recordTypes[recordTypeId].label } } @@ -499,8 +499,7 @@ class AggregationSerializer extends JsonLdItemSerializer { // Build buildingLocation agg labels from nypl-core: v.label = locations[v.value]?.label } else if (field === 'recordType') { - console.log(v) - // Build buildingLocation agg labels from nypl-core: + // Build recordType agg labels from nypl-core: v.label = recordTypes[v.value]?.label } else { v.label = v.value diff --git a/test/resource_serializer.test.js b/test/resource_serializer.test.js index 7dba893..5e6cbd1 100644 --- a/test/resource_serializer.test.js +++ b/test/resource_serializer.test.js @@ -4,7 +4,7 @@ const esResponse = require('./fixtures/item-filter-aggregations.json') describe('Resource Serializer', () => { describe('formatRecordType', () => { it('should format properly', () => { - expect(ResourceSerializer.getFormattedRecordType('a')).to.deep.equal({ '@id': 'recordType:a', prefLabel: 'Book/Text' }) + expect(ResourceSerializer.getFormattedRecordType('a')).to.deep.equal({ '@id': 'a', prefLabel: 'Book/Text' }) }) }) describe('.formatItemFilterAggregations()', () => { diff --git a/test/resources-responses.test.js b/test/resources-responses.test.js index bd577ce..7d5bb91 100644 --- a/test/resources-responses.test.js +++ b/test/resources-responses.test.js @@ -266,7 +266,7 @@ describe('Test Resources responses', function () { assert(doc.itemAggregations) - assert.deepEqual(doc.recordType, { '@id': 'recordType:a', prefLabel: 'Book/Text' }) + assert.deepEqual(doc.recordType, { '@id': 'a', prefLabel: 'Book/Text' }) done() })