2020-02-19 06:15:25 -05:00
|
|
|
/* eslint-disable
|
|
|
|
handle-callback-err,
|
|
|
|
no-return-assign,
|
|
|
|
*/
|
|
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
|
|
// Fix any style issues and re-enable lint.
|
2020-02-19 06:15:08 -05:00
|
|
|
/*
|
|
|
|
* decaffeinate suggestions:
|
|
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
|
|
*/
|
2020-02-19 06:15:37 -05:00
|
|
|
const SandboxedModule = require('sandboxed-module')
|
|
|
|
const sinon = require('sinon')
|
|
|
|
const { expect } = require('chai')
|
|
|
|
const modulePath = require('path').join(
|
|
|
|
__dirname,
|
|
|
|
'../../../app/js/RequestParser'
|
|
|
|
)
|
|
|
|
const tk = require('timekeeper')
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('RequestParser', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
tk.freeze()
|
|
|
|
this.callback = sinon.stub()
|
|
|
|
this.validResource = {
|
|
|
|
path: 'main.tex',
|
|
|
|
date: '12:00 01/02/03',
|
|
|
|
content: 'Hello world'
|
|
|
|
}
|
|
|
|
this.validRequest = {
|
|
|
|
compile: {
|
|
|
|
token: 'token-123',
|
|
|
|
options: {
|
|
|
|
imageName: 'basicImageName/here:2017-1',
|
|
|
|
compiler: 'pdflatex',
|
|
|
|
timeout: 42
|
|
|
|
},
|
|
|
|
resources: []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (this.RequestParser = SandboxedModule.require(modulePath, {
|
|
|
|
requires: {
|
2021-07-12 12:47:21 -04:00
|
|
|
'@overleaf/settings': (this.settings = {})
|
2020-02-19 06:15:37 -05:00
|
|
|
}
|
|
|
|
}))
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
afterEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return tk.reset()
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('without a top level object', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.RequestParser.parse([], this.callback)
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return an error', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.callback
|
|
|
|
.calledWith('top level object should have a compile attribute')
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('without a compile attribute', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.RequestParser.parse({}, this.callback)
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return an error', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.callback
|
|
|
|
.calledWith('top level object should have a compile attribute')
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('without a valid compiler', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validRequest.compile.options.compiler = 'not-a-compiler'
|
|
|
|
return this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return an error', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.callback
|
|
|
|
.calledWith(
|
|
|
|
'compiler attribute should be one of: pdflatex, latex, xelatex, lualatex'
|
|
|
|
)
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('without a compiler specified', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
delete this.validRequest.compile.options.compiler
|
|
|
|
return this.RequestParser.parse(this.validRequest, (error, data) => {
|
|
|
|
this.data = data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should set the compiler to pdflatex by default', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.data.compiler.should.equal('pdflatex')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with imageName set', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.RequestParser.parse(this.validRequest, (error, data) => {
|
|
|
|
this.data = data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should set the imageName', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.data.imageName.should.equal('basicImageName/here:2017-1')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('when image restrictions are present', function () {
|
|
|
|
beforeEach(function () {
|
2020-06-30 07:00:18 -04:00
|
|
|
this.settings.clsi = { docker: {} }
|
|
|
|
this.settings.clsi.docker.allowedImages = [
|
|
|
|
'repo/name:tag1',
|
|
|
|
'repo/name:tag2'
|
|
|
|
]
|
2020-06-26 07:29:49 -04:00
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with imageName set to something invalid', function () {
|
|
|
|
beforeEach(function () {
|
2020-06-26 07:29:49 -04:00
|
|
|
const request = this.validRequest
|
|
|
|
request.compile.options.imageName = 'something/different:latest'
|
|
|
|
this.RequestParser.parse(request, (error, data) => {
|
|
|
|
this.error = error
|
|
|
|
this.data = data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
it('should throw an error for imageName', function () {
|
2020-06-26 07:29:49 -04:00
|
|
|
expect(String(this.error)).to.include(
|
|
|
|
'imageName attribute should be one of'
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with imageName set to something valid', function () {
|
|
|
|
beforeEach(function () {
|
2020-06-26 07:29:49 -04:00
|
|
|
const request = this.validRequest
|
|
|
|
request.compile.options.imageName = 'repo/name:tag1'
|
|
|
|
this.RequestParser.parse(request, (error, data) => {
|
|
|
|
this.error = error
|
|
|
|
this.data = data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
it('should set the imageName', function () {
|
2020-06-26 07:29:49 -04:00
|
|
|
this.data.imageName.should.equal('repo/name:tag1')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with flags set', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validRequest.compile.options.flags = ['-file-line-error']
|
|
|
|
return this.RequestParser.parse(this.validRequest, (error, data) => {
|
|
|
|
this.data = data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should set the flags attribute', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return expect(this.data.flags).to.deep.equal(['-file-line-error'])
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with flags not specified', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.RequestParser.parse(this.validRequest, (error, data) => {
|
|
|
|
this.data = data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('it should have an empty flags list', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return expect(this.data.flags).to.deep.equal([])
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('without a timeout specified', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
delete this.validRequest.compile.options.timeout
|
|
|
|
return this.RequestParser.parse(this.validRequest, (error, data) => {
|
|
|
|
this.data = data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should set the timeout to MAX_TIMEOUT', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.data.timeout.should.equal(
|
|
|
|
this.RequestParser.MAX_TIMEOUT * 1000
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a timeout larger than the maximum', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validRequest.compile.options.timeout =
|
|
|
|
this.RequestParser.MAX_TIMEOUT + 1
|
|
|
|
return this.RequestParser.parse(this.validRequest, (error, data) => {
|
|
|
|
this.data = data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should set the timeout to MAX_TIMEOUT', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.data.timeout.should.equal(
|
|
|
|
this.RequestParser.MAX_TIMEOUT * 1000
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a timeout', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.RequestParser.parse(this.validRequest, (error, data) => {
|
|
|
|
this.data = data
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should set the timeout (in milliseconds)', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.data.timeout.should.equal(
|
|
|
|
this.validRequest.compile.options.timeout * 1000
|
|
|
|
)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a resource without a path', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
delete this.validResource.path
|
|
|
|
this.validRequest.compile.resources.push(this.validResource)
|
|
|
|
return this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return an error', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.callback
|
|
|
|
.calledWith('all resources should have a path attribute')
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a resource with a path', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validResource.path = this.path = 'test.tex'
|
|
|
|
this.validRequest.compile.resources.push(this.validResource)
|
|
|
|
this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
return (this.data = this.callback.args[0][1])
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return the path in the parsed response', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.data.resources[0].path.should.equal(this.path)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a resource with a malformed modified date', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validResource.modified = 'not-a-date'
|
|
|
|
this.validRequest.compile.resources.push(this.validResource)
|
|
|
|
return this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return an error', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.callback
|
|
|
|
.calledWith(
|
|
|
|
'resource modified date could not be understood: ' +
|
|
|
|
this.validResource.modified
|
|
|
|
)
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a resource with a valid date', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.date = '12:00 01/02/03'
|
|
|
|
this.validResource.modified = this.date
|
|
|
|
this.validRequest.compile.resources.push(this.validResource)
|
|
|
|
this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
return (this.data = this.callback.args[0][1])
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return the date as a Javascript Date object', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
;(this.data.resources[0].modified instanceof Date).should.equal(true)
|
|
|
|
return this.data.resources[0].modified
|
|
|
|
.getTime()
|
|
|
|
.should.equal(Date.parse(this.date))
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a resource without either a content or URL attribute', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
delete this.validResource.url
|
|
|
|
delete this.validResource.content
|
|
|
|
this.validRequest.compile.resources.push(this.validResource)
|
|
|
|
return this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return an error', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.callback
|
|
|
|
.calledWith(
|
|
|
|
'all resources should have either a url or content attribute'
|
|
|
|
)
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a resource where the content is not a string', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validResource.content = []
|
|
|
|
this.validRequest.compile.resources.push(this.validResource)
|
|
|
|
return this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return an error', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.callback
|
|
|
|
.calledWith('content attribute should be a string')
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a resource where the url is not a string', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validResource.url = []
|
|
|
|
this.validRequest.compile.resources.push(this.validResource)
|
|
|
|
return this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return an error', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.callback
|
|
|
|
.calledWith('url attribute should be a string')
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a resource with a url', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validResource.url = this.url = 'www.example.com'
|
|
|
|
this.validRequest.compile.resources.push(this.validResource)
|
|
|
|
this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
return (this.data = this.callback.args[0][1])
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return the url in the parsed response', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.data.resources[0].url.should.equal(this.url)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a resource with a content attribute', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validResource.content = this.content = 'Hello world'
|
|
|
|
this.validRequest.compile.resources.push(this.validResource)
|
|
|
|
this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
return (this.data = this.callback.args[0][1])
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return the content in the parsed response', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.data.resources[0].content.should.equal(this.content)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('without a root resource path', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
delete this.validRequest.compile.rootResourcePath
|
|
|
|
this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
return (this.data = this.callback.args[0][1])
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it("should set the root resource path to 'main.tex' by default", function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.data.rootResourcePath.should.equal('main.tex')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a root resource path', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validRequest.compile.rootResourcePath = this.path = 'test.tex'
|
|
|
|
this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
return (this.data = this.callback.args[0][1])
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return the root resource path in the parsed response', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.data.rootResourcePath.should.equal(this.path)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a root resource path that is not a string', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validRequest.compile.rootResourcePath = []
|
|
|
|
return this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return an error', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.callback
|
|
|
|
.calledWith('rootResourcePath attribute should be a string')
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a root resource path that needs escaping', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.badPath = '`rm -rf foo`.tex'
|
|
|
|
this.goodPath = 'rm -rf foo.tex'
|
|
|
|
this.validRequest.compile.rootResourcePath = this.badPath
|
|
|
|
this.validRequest.compile.resources.push({
|
|
|
|
path: this.badPath,
|
|
|
|
date: '12:00 01/02/03',
|
|
|
|
content: 'Hello world'
|
|
|
|
})
|
|
|
|
this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
return (this.data = this.callback.args[0][1])
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
it('should return the escaped resource', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.data.rootResourcePath.should.equal(this.goodPath)
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should also escape the resource path', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.data.resources[0].path.should.equal(this.goodPath)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a root resource path that has a relative path', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validRequest.compile.rootResourcePath = 'foo/../../bar.tex'
|
|
|
|
this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
return (this.data = this.callback.args[0][1])
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return an error', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.callback
|
|
|
|
.calledWith('relative path in root resource')
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
describe('with a root resource path that has unescaped + relative path', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validRequest.compile.rootResourcePath = 'foo/#../bar.tex'
|
|
|
|
this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
return (this.data = this.callback.args[0][1])
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return an error', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.callback
|
|
|
|
.calledWith('relative path in root resource')
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return describe('with an unknown syncType', function () {
|
|
|
|
beforeEach(function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
this.validRequest.compile.options.syncType = 'unexpected'
|
|
|
|
this.RequestParser.parse(this.validRequest, this.callback)
|
|
|
|
return (this.data = this.callback.args[0][1])
|
|
|
|
})
|
|
|
|
|
2020-08-10 12:01:11 -04:00
|
|
|
return it('should return an error', function () {
|
2020-02-19 06:15:37 -05:00
|
|
|
return this.callback
|
|
|
|
.calledWith('syncType attribute should be one of: full, incremental')
|
|
|
|
.should.equal(true)
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|