mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
[object-persistor] import ProjectKey helper from history-v1 (#30600)
GitOrigin-RevId: c72aa4bf91569904a2072c74d6ed2f3c764d97bb
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
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')
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user