mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Merge pull request #3495 from overleaf/ae-prettier-2
Upgrade Prettier to v2 GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
This commit is contained in:
@@ -8,12 +8,12 @@ import {
|
||||
putJSON
|
||||
} from '../../../frontend/js/infrastructure/fetch-json'
|
||||
|
||||
describe('fetchJSON', function() {
|
||||
before(function() {
|
||||
describe('fetchJSON', function () {
|
||||
before(function () {
|
||||
fetchMock.restore()
|
||||
})
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
fetchMock.restore()
|
||||
})
|
||||
|
||||
@@ -22,7 +22,7 @@ describe('fetchJSON', function() {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
|
||||
it('handles GET requests', function() {
|
||||
it('handles GET requests', function () {
|
||||
fetchMock.once(
|
||||
{ method: 'GET', url: '/test', headers },
|
||||
{ status: 200, body: { result: 'success' } }
|
||||
@@ -33,7 +33,7 @@ describe('fetchJSON', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('handles 4xx responses', function() {
|
||||
it('handles 4xx responses', function () {
|
||||
fetchMock.get('/test', {
|
||||
status: 400,
|
||||
body: { message: 'The request was invalid' }
|
||||
@@ -50,7 +50,7 @@ describe('fetchJSON', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('handles 5xx responses', async function() {
|
||||
it('handles 5xx responses', async function () {
|
||||
fetchMock.get('/test', { status: 500 })
|
||||
|
||||
return expect(getJSON('/test'))
|
||||
@@ -62,7 +62,7 @@ describe('fetchJSON', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('handles POST requests', function() {
|
||||
it('handles POST requests', function () {
|
||||
const body = { example: true }
|
||||
|
||||
fetchMock.once(
|
||||
@@ -75,7 +75,7 @@ describe('fetchJSON', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('handles PUT requests', function() {
|
||||
it('handles PUT requests', function () {
|
||||
const body = { example: true }
|
||||
|
||||
fetchMock.once(
|
||||
@@ -88,7 +88,7 @@ describe('fetchJSON', function() {
|
||||
})
|
||||
})
|
||||
|
||||
it('handles DELETE requests', function() {
|
||||
it('handles DELETE requests', function () {
|
||||
fetchMock.once({ method: 'DELETE', url: '/test', headers }, { status: 204 })
|
||||
|
||||
return expect(deleteJSON('/test')).to.eventually.deep.equal({})
|
||||
|
||||
@@ -3,19 +3,19 @@ import sinon from 'sinon'
|
||||
|
||||
import customLocalStorage from '../../../frontend/js/infrastructure/local-storage'
|
||||
|
||||
describe('localStorage', function() {
|
||||
describe('localStorage', function () {
|
||||
let originalLocalStorage
|
||||
before(function() {
|
||||
before(function () {
|
||||
originalLocalStorage = global.localStorage
|
||||
})
|
||||
|
||||
after(function() {
|
||||
after(function () {
|
||||
Object.defineProperty(global, 'localStorage', {
|
||||
value: originalLocalStorage
|
||||
})
|
||||
})
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
Object.defineProperty(global, 'localStorage', {
|
||||
value: {
|
||||
getItem: sinon.stub().returns(null),
|
||||
@@ -28,12 +28,12 @@ describe('localStorage', function() {
|
||||
global.console.error = sinon.stub()
|
||||
})
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
global.console.error.reset()
|
||||
Object.defineProperty(global, 'localStorage', { value: undefined })
|
||||
})
|
||||
|
||||
it('getItem', function() {
|
||||
it('getItem', function () {
|
||||
expect(customLocalStorage.getItem('foo')).to.be.null
|
||||
|
||||
global.localStorage.getItem.returns('false')
|
||||
@@ -47,7 +47,7 @@ describe('localStorage', function() {
|
||||
expect(global.console.error).to.be.calledOnce
|
||||
})
|
||||
|
||||
it('setItem', function() {
|
||||
it('setItem', function () {
|
||||
customLocalStorage.setItem('foo', 'bar')
|
||||
expect(global.localStorage.setItem).to.be.calledOnceWith('foo', '"bar"')
|
||||
global.localStorage.setItem.reset()
|
||||
@@ -65,7 +65,7 @@ describe('localStorage', function() {
|
||||
expect(global.console.error).to.be.calledOnce
|
||||
})
|
||||
|
||||
it('clear', function() {
|
||||
it('clear', function () {
|
||||
customLocalStorage.clear()
|
||||
expect(global.localStorage.clear).to.be.calledOnce
|
||||
|
||||
@@ -74,7 +74,7 @@ describe('localStorage', function() {
|
||||
expect(global.console.error).to.be.calledOnce
|
||||
})
|
||||
|
||||
it('removeItem', function() {
|
||||
it('removeItem', function () {
|
||||
customLocalStorage.removeItem('foo')
|
||||
expect(global.localStorage.removeItem).to.be.calledOnceWith('foo')
|
||||
global.localStorage.removeItem.reset()
|
||||
|
||||
Reference in New Issue
Block a user