Merge pull request #3964 from overleaf/jpa-unique-project-name-with-year
[ProjectHelper] _addNumericSuffixToProjectName: add heuristic for year GitOrigin-RevId: 24c57d68706bdabba620137674946e3c8e675939
This commit is contained in:
@@ -259,6 +259,8 @@ describe('ProjectDetailsHandler', function () {
|
||||
{ _id: 138, name: 'numeric (38)' },
|
||||
{ _id: 139, name: 'numeric (39)' },
|
||||
{ _id: 140, name: 'numeric (40)' },
|
||||
{ _id: 141, name: 'Yearbook (2021)' },
|
||||
{ _id: 142, name: 'Yearbook (2021) (1)' },
|
||||
],
|
||||
readAndWrite: [
|
||||
{ _id: 4, name: 'name2' },
|
||||
@@ -364,6 +366,24 @@ describe('ProjectDetailsHandler', function () {
|
||||
)
|
||||
expect(name).to.equal('numeric (41)')
|
||||
})
|
||||
|
||||
it('should handle years in name', async function () {
|
||||
const name = await this.handler.promises.generateUniqueName(
|
||||
this.user._id,
|
||||
'unique-name (2021)',
|
||||
[]
|
||||
)
|
||||
expect(name).to.equal('unique-name (2021)')
|
||||
})
|
||||
|
||||
it('should handle duplicating with year in name', async function () {
|
||||
const name = await this.handler.promises.generateUniqueName(
|
||||
this.user._id,
|
||||
'Yearbook (2021)',
|
||||
[]
|
||||
)
|
||||
expect(name).to.equal('Yearbook (2021) (2)')
|
||||
})
|
||||
})
|
||||
|
||||
describe('fixProjectName', function () {
|
||||
|
||||
Reference in New Issue
Block a user