Skip to content

Commit

Permalink
helpers: removed normalizeWikidataTime legacy alias
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlath committed Mar 29, 2017
1 parent df4301a commit a5ae25f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 10 deletions.
3 changes: 0 additions & 3 deletions lib/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,4 @@ helpers.wikidataTimeToISOString = function (wikidataTime) {
return wikidataTimeToDateObject(wikidataTime).toISOString()
}

// keeping normalizeWikidataTime as legacy
helpers.normalizeWikidataTime = helpers.wikidataTimeToEpochTime

module.exports = helpers
2 changes: 0 additions & 2 deletions test/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,13 @@ describe('general', function () {
helpers.wikidataTimeToDateObject.should.be.a.Function()
helpers.wikidataTimeToEpochTime.should.be.a.Function()
helpers.wikidataTimeToISOString.should.be.a.Function()
helpers.normalizeWikidataTime.should.be.a.Function()

wdk.isEntityId.should.be.a.Function()
wdk.isItemId.should.be.a.Function()
wdk.isPropertyId.should.be.a.Function()
wdk.wikidataTimeToDateObject.should.be.a.Function()
wdk.wikidataTimeToEpochTime.should.be.a.Function()
wdk.wikidataTimeToISOString.should.be.a.Function()
wdk.normalizeWikidataTime.should.be.a.Function()
done()
})
})
10 changes: 5 additions & 5 deletions test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ describe('helpers', function () {
const negativeWdTime = '-0044-03-15T00:00:00Z'
const negativeEpoch = -63549360000000

describe('normalizeWikidataTime', function () {
describe('wikidataTimeToEpochTime', function () {
it('env', function (done) {
new Date(epoch).toISOString().should.equal(ISOtime)
new Date(negativeEpoch).toISOString().should.equal(ISOnegativeTime)
done()
})

it('should return a number (epoch time)', function (done) {
helpers.normalizeWikidataTime(wdTime).should.be.a.Number()
helpers.wikidataTimeToEpochTime(wdTime).should.be.a.Number()
done()
})

it('should return a number for negative time', function (done) {
helpers.normalizeWikidataTime(negativeWdTime).should.be.a.Number()
helpers.wikidataTimeToEpochTime(negativeWdTime).should.be.a.Number()
done()
})

it('should return the right number', function (done) {
helpers.normalizeWikidataTime(wdTime).should.equal(epoch)
helpers.wikidataTimeToEpochTime(wdTime).should.equal(epoch)
done()
})

it('should return the right number for negative time too', function (done) {
helpers.normalizeWikidataTime(negativeWdTime).should.equal(negativeEpoch)
helpers.wikidataTimeToEpochTime(negativeWdTime).should.equal(negativeEpoch)
done()
})
})
Expand Down

0 comments on commit a5ae25f

Please sign in to comment.