mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-06 07:39:02 +02:00
Merge pull request #1948 from overleaf/cmg-allow-array-archiving
Make checking for project.archived array-friendly GitOrigin-RevId: 2902a12fb4611a5786d4b10feba534b1cd29668b
This commit is contained in:
committed by
sharelatex
parent
c8140f9641
commit
3422c17dc4
@@ -16,12 +16,60 @@ const should = chai.should()
|
||||
const { expect } = chai
|
||||
const modulePath = '../../../../app/src/Features/Project/ProjectHelper.js'
|
||||
const SandboxedModule = require('sandboxed-module')
|
||||
const { ObjectId } = require('mongojs')
|
||||
|
||||
describe('ProjectHelper', function() {
|
||||
beforeEach(function() {
|
||||
this.project = {
|
||||
_id: '123213jlkj9kdlsaj'
|
||||
}
|
||||
|
||||
this.user = {
|
||||
_id: '588f3ddae8ebc1bac07c9fa4',
|
||||
first_name: 'bjkdsjfk',
|
||||
features: {}
|
||||
}
|
||||
|
||||
return (this.ProjectHelper = SandboxedModule.require(modulePath))
|
||||
})
|
||||
|
||||
describe('isArchived', function() {
|
||||
describe('project.archived being an array', function() {
|
||||
it('returns true if user id is found', function() {
|
||||
this.project.archived = [
|
||||
ObjectId('588f3ddae8ebc1bac07c9fa4'),
|
||||
ObjectId('5c41deb2b4ca500153340809')
|
||||
]
|
||||
expect(
|
||||
this.ProjectHelper.isArchived(this.project, this.user._id)
|
||||
).to.equal(true)
|
||||
})
|
||||
|
||||
it('returns false if user id is not found', function() {
|
||||
this.project.archived = []
|
||||
expect(
|
||||
this.ProjectHelper.isArchived(this.project, this.user._id)
|
||||
).to.equal(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('project.archived being a boolean', function() {
|
||||
it('returns true if archived is true', function() {
|
||||
this.project.archived = true
|
||||
expect(
|
||||
this.ProjectHelper.isArchived(this.project, this.user._id)
|
||||
).to.equal(true)
|
||||
})
|
||||
|
||||
it('returns false if archived is false', function() {
|
||||
this.project.archived = false
|
||||
expect(
|
||||
this.ProjectHelper.isArchived(this.project, this.user._id)
|
||||
).to.equal(false)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('compilerFromV1Engine', function() {
|
||||
it('returns the correct engine for latex_dvipdf', function() {
|
||||
return expect(
|
||||
|
||||
Reference in New Issue
Block a user