overleaf/services/web/test/acceptance/src/EditorHttpControllerTests.js
Alf Eaton 1be43911b4 Merge pull request #3942 from overleaf/prettier-trailing-comma
Set Prettier's "trailingComma" setting to "es5"

GitOrigin-RevId: 9f14150511929a855b27467ad17be6ab262fe5d5
2021-04-28 02:10:01 +00:00

56 lines
1.5 KiB
JavaScript

const User = require('./helpers/User')
const { expect } = require('chai')
describe('EditorHttpController', function () {
beforeEach('login', function (done) {
this.user = new User()
this.user.login(done)
})
beforeEach('create project', function (done) {
this.projectName = 'wombat'
this.user.createProject(this.projectName, (error, projectId) => {
if (error) return done(error)
this.projectId = projectId
done()
})
})
beforeEach('create doc', function (done) {
this.user.createDocInProject(
this.projectId,
null,
'potato.tex',
(error, docId) => {
this.docId = docId
done(error)
}
)
})
describe('joinProject', function () {
it('should emit an empty deletedDocs array', function (done) {
this.user.joinProject(this.projectId, (error, details) => {
if (error) return done(error)
expect(details.project.deletedDocs).to.deep.equal([])
done()
})
})
describe('after deleting a doc', function () {
beforeEach(function (done) {
this.user.deleteItemInProject(this.projectId, 'doc', this.docId, done)
})
it('should include the deleted doc in the deletedDocs array', function (done) {
this.user.joinProject(this.projectId, (error, details) => {
if (error) return done(error)
expect(details.project.deletedDocs).to.deep.equal([
{ _id: this.docId, name: 'potato.tex' },
])
done()
})
})
})
})
})