mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-11 07:00:47 +02:00
Merge pull request #3495 from overleaf/ae-prettier-2
Upgrade Prettier to v2 GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
This commit is contained in:
@@ -4,9 +4,9 @@ const {
|
||||
callbackifyMultiResult
|
||||
} = require('../../../../app/src/util/promises')
|
||||
|
||||
describe('promisifyAll', function() {
|
||||
describe('basic functionality', function() {
|
||||
before(function() {
|
||||
describe('promisifyAll', function () {
|
||||
describe('basic functionality', function () {
|
||||
before(function () {
|
||||
this.module = {
|
||||
SOME_CONSTANT: 1,
|
||||
asyncAdd(a, b, callback) {
|
||||
@@ -19,27 +19,27 @@ describe('promisifyAll', function() {
|
||||
this.promisified = promisifyAll(this.module)
|
||||
})
|
||||
|
||||
it('promisifies functions in the module', async function() {
|
||||
it('promisifies functions in the module', async function () {
|
||||
const sum = await this.promisified.asyncAdd(29, 33)
|
||||
expect(sum).to.equal(62)
|
||||
})
|
||||
|
||||
it('binds this to the original module', async function() {
|
||||
it('binds this to the original module', async function () {
|
||||
const sum = await this.promisified.asyncDouble(38)
|
||||
expect(sum).to.equal(76)
|
||||
})
|
||||
|
||||
it('does not copy over non-functions', async function() {
|
||||
it('does not copy over non-functions', async function () {
|
||||
expect(this.promisified).not.to.have.property('SOME_CONSTANT')
|
||||
})
|
||||
|
||||
it('does not modify the prototype of the module', async function() {
|
||||
it('does not modify the prototype of the module', async function () {
|
||||
expect(this.promisified.toString()).to.equal('[object Object]')
|
||||
})
|
||||
})
|
||||
|
||||
describe('without option', function() {
|
||||
before(function() {
|
||||
describe('without option', function () {
|
||||
before(function () {
|
||||
this.module = {
|
||||
asyncAdd(a, b, callback) {
|
||||
callback(null, a + b)
|
||||
@@ -51,18 +51,18 @@ describe('promisifyAll', function() {
|
||||
this.promisified = promisifyAll(this.module, { without: 'syncAdd' })
|
||||
})
|
||||
|
||||
it('does not promisify excluded functions', function() {
|
||||
it('does not promisify excluded functions', function () {
|
||||
expect(this.promisified.syncAdd).not.to.exist
|
||||
})
|
||||
|
||||
it('promisifies other functions', async function() {
|
||||
it('promisifies other functions', async function () {
|
||||
const sum = await this.promisified.asyncAdd(12, 89)
|
||||
expect(sum).to.equal(101)
|
||||
})
|
||||
})
|
||||
|
||||
describe('multiResult option', function() {
|
||||
before(function() {
|
||||
describe('multiResult option', function () {
|
||||
before(function () {
|
||||
this.module = {
|
||||
asyncAdd(a, b, callback) {
|
||||
callback(null, a + b)
|
||||
@@ -76,20 +76,20 @@ describe('promisifyAll', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('promisifies multi-result functions', async function() {
|
||||
it('promisifies multi-result functions', async function () {
|
||||
const result = await this.promisified.asyncArithmetic(3, 6)
|
||||
expect(result).to.deep.equal({ sum: 9, product: 18 })
|
||||
})
|
||||
|
||||
it('promisifies other functions normally', async function() {
|
||||
it('promisifies other functions normally', async function () {
|
||||
const sum = await this.promisified.asyncAdd(6, 1)
|
||||
expect(sum).to.equal(7)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('callbackifyMultiResult', function() {
|
||||
it('callbackifies a multi-result function', function(done) {
|
||||
describe('callbackifyMultiResult', function () {
|
||||
it('callbackifies a multi-result function', function (done) {
|
||||
async function asyncArithmetic(a, b) {
|
||||
return { sum: a + b, product: a * b }
|
||||
}
|
||||
@@ -107,7 +107,7 @@ describe('callbackifyMultiResult', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('propagates errors', function(done) {
|
||||
it('propagates errors', function (done) {
|
||||
async function asyncBomb() {
|
||||
throw new Error('BOOM!')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user