Files
overleaf-cep/libraries/object-persistor/test/unit/ProjectKeyTests.js
Jakob Ackermann 18cff6e1ac [object-persistor] import ProjectKey helper from history-v1 (#30600)
GitOrigin-RevId: c72aa4bf91569904a2072c74d6ed2f3c764d97bb
2026-01-13 09:06:55 +00:00

22 lines
727 B
JavaScript

const { expect } = require('chai')
const { format, pad } = require('../../src/ProjectKey.js')
describe('projectKey', function () {
it('reverses padded keys', function () {
expect(format(1)).to.equal('100/000/000')
expect(format(12)).to.equal('210/000/000')
expect(format(123456789)).to.equal('987/654/321')
expect(format(9123456789)).to.equal('987/654/3219')
})
it('pads numbers with zeros to length 9', function () {
expect(pad(undefined)).to.equal('000000000')
expect(pad(null)).to.equal('000000000')
expect(pad(1)).to.equal('000000001')
expect(pad(10)).to.equal('000000010')
expect(pad(100000000)).to.equal('100000000')
expect(pad(1000000000)).to.equal('1000000000')
})
})