apps-consumer-utils
Advanced tools
Comparing version 1.0.5-0 to 1.0.6-0
23
index.js
@@ -7,3 +7,2 @@ "use strict"; | ||
module.exports = { | ||
// getEventIds :: [Object] -> [String] | ||
@@ -19,2 +18,3 @@ "getEventIds": R.pipe( | ||
// getSource :: Object -> Object | ||
"normalizeJSON": (record) => { | ||
@@ -42,12 +42,15 @@ let recordImage, | ||
// getId :: Object -> String | ||
"getId": (content) => R.head(content.Source.split('-')) + '.' + content.Id, | ||
// getSource :: Object -> String | ||
"getSource": getSource, | ||
// getId :: Object -> String | ||
"getSource": (content) => R.head(content.Source.split('-')), | ||
"getId": (content) => getSource(content) + '.' + content.Id, | ||
// getId :: Object -> String | ||
"getHomeSectionId": (content) => R.head(content.Source.split('-')) + '.' + content.OwnerHomeSection, | ||
// getHomeSectionId :: Object -> String | ||
"getHomeSectionId": (content) => getSource(content) + '.' + content.OwnerHomeSection, | ||
// getLatestEventById :: [Object] -> [Object] | ||
// getPubId :: Object -> String | ||
"getPubId": (content) => getSource(content) + '.' + content.OwnerPublicationId, | ||
// getLatestEventsById :: [Object] -> [Object] | ||
"getLatestEventsById": (records) => { | ||
@@ -60,2 +63,6 @@ const grouped = R.groupBy(record => { | ||
} | ||
}; | ||
}; | ||
function getSource(content) { | ||
return R.head(content.Source.split('-')); | ||
} |
{ | ||
"name": "apps-consumer-utils", | ||
"version": "1.0.5-0", | ||
"version": "1.0.6-0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -30,9 +30,21 @@ "use strict"; | ||
Source: 'nationals-article', | ||
OwnerHomeSection: '123' | ||
OwnerHomeSection: '456' | ||
}; | ||
assert.equal(index.getHomeSectionId(content), 'nationals.123'); | ||
assert.equal(index.getHomeSectionId(content), 'nationals.456'); | ||
}); | ||
}); | ||
describe('getPubId', () => { | ||
it('should not return the pubId', () => { | ||
const content = { | ||
Source: 'nationals-article', | ||
OwnerPublicationId: '789' | ||
}; | ||
assert.equal(index.getPubId(content), 'nationals.789'); | ||
}); | ||
}); | ||
describe('normalizeJSON', () => { | ||
@@ -39,0 +51,0 @@ it('should not add deleted field to non-delete event', () => { |
19337
395