Merge pull request #1835 from overleaf/hb-analytics-template-ids

Set template ids on cloned projects on creation

GitOrigin-RevId: 6b7ef72d148774c3d5ea7b65cde0e6a8fdfa2ceb
This commit is contained in:
Timothée Alby
2019-06-04 11:23:37 +00:00
committed by sharelatex
parent f9e82003b3
commit 8330c6ae61
6 changed files with 58 additions and 11 deletions
@@ -264,11 +264,40 @@ describe('ProjectCreationHandler', function() {
)
})
return it('should send a project-imported event when importing a project', function(done) {
it('should send a project-created event with template information if provided', function(done) {
const attributes = {
fromV1TemplateId: 100
}
return this.handler.createBlankProject(
ownerId,
projectName,
1234,
attributes,
(err, project) => {
expect(this.AnalyticsManager.recordEvent.callCount).to.equal(1)
expect(
this.AnalyticsManager.recordEvent.calledWith(
ownerId,
'project-created',
{ projectId: project._id, attributes }
)
).to.equal(true)
return done()
}
)
})
return it('should send a project-imported event when importing a project', function(done) {
const attributes = {
overleaf: {
history: {
id: 100
}
}
}
return this.handler.createBlankProject(
ownerId,
projectName,
attributes,
(err, project) => {
expect(this.AnalyticsManager.recordEvent.callCount).to.equal(1)
expect(