Merge pull request #3495 from overleaf/ae-prettier-2

Upgrade Prettier to v2

GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
This commit is contained in:
Alf Eaton
2021-04-15 02:05:22 +00:00
committed by Copybot
parent 930d7ba028
commit 1ebc8a79cb
582 changed files with 20382 additions and 20374 deletions
@@ -10,7 +10,7 @@ import {
} from '../../../helpers/render-with-context'
import { stubMathJax, tearDownMathJaxStubs } from './stubs'
describe('<ChatPane />', function() {
describe('<ChatPane />', function () {
const user = {
id: 'fake_user',
first_name: 'fake_user_first_name',
@@ -32,18 +32,18 @@ describe('<ChatPane />', function() {
}
]
beforeEach(function() {
beforeEach(function () {
fetchMock.reset()
cleanUpContext()
stubMathJax()
})
afterEach(function() {
afterEach(function () {
tearDownMathJaxStubs()
})
it('renders multiple messages', async function() {
it('renders multiple messages', async function () {
fetchMock.get(/messages/, testMessages)
renderWithChatContext(<ChatPane />, { user })
@@ -52,7 +52,7 @@ describe('<ChatPane />', function() {
await screen.findByText('another message')
})
it('A loading spinner is rendered while the messages are loading, then disappears', async function() {
it('A loading spinner is rendered while the messages are loading, then disappears', async function () {
fetchMock.get(/messages/, [])
renderWithChatContext(<ChatPane />, { user })
@@ -60,8 +60,8 @@ describe('<ChatPane />', function() {
await waitForElementToBeRemoved(() => screen.getByText('Loading…'))
})
describe('"send your first message" placeholder', function() {
it('is rendered when there are no messages ', async function() {
describe('"send your first message" placeholder', function () {
it('is rendered when there are no messages ', async function () {
fetchMock.get(/messages/, [])
renderWithChatContext(<ChatPane />, { user })
@@ -69,7 +69,7 @@ describe('<ChatPane />', function() {
await screen.findByText('Send your first message to your collaborators')
})
it('is not rendered when messages are displayed', function() {
it('is not rendered when messages are displayed', function () {
fetchMock.get(/messages/, testMessages)
renderWithChatContext(<ChatPane />, { user })
@@ -5,15 +5,15 @@ import { screen, render, fireEvent } from '@testing-library/react'
import MessageInput from '../../../../../frontend/js/features/chat/components/message-input'
describe('<MessageInput />', function() {
describe('<MessageInput />', function () {
let resetUnreadMessages, sendMessage
beforeEach(function() {
beforeEach(function () {
resetUnreadMessages = sinon.stub()
sendMessage = sinon.stub()
})
it('renders successfully', function() {
it('renders successfully', function () {
render(
<MessageInput
sendMessage={sendMessage}
@@ -24,7 +24,7 @@ describe('<MessageInput />', function() {
screen.getByLabelText('Your Message')
})
it('sends a message after typing and hitting enter', function() {
it('sends a message after typing and hitting enter', function () {
render(
<MessageInput
sendMessage={sendMessage}
@@ -40,7 +40,7 @@ describe('<MessageInput />', function() {
expect(sendMessage).to.be.calledWith('hello world')
})
it('resets the number of unread messages after clicking on the input', function() {
it('resets the number of unread messages after clicking on the input', function () {
render(
<MessageInput
sendMessage={sendMessage}
@@ -6,7 +6,7 @@ import { screen, render, fireEvent } from '@testing-library/react'
import MessageList from '../../../../../frontend/js/features/chat/components/message-list'
import { stubMathJax, tearDownMathJaxStubs } from './stubs'
describe('<MessageList />', function() {
describe('<MessageList />', function () {
const currentUser = {
id: 'fake_user',
first_name: 'fake_user_first_name',
@@ -30,15 +30,15 @@ describe('<MessageList />', function() {
]
}
before(function() {
before(function () {
stubMathJax()
})
after(function() {
after(function () {
tearDownMathJaxStubs()
})
it('renders multiple messages', function() {
it('renders multiple messages', function () {
render(
<MessageList
userId={currentUser.id}
@@ -51,7 +51,7 @@ describe('<MessageList />', function() {
screen.getByText('another message')
})
it('renders a single timestamp for all messages within 5 minutes', function() {
it('renders a single timestamp for all messages within 5 minutes', function () {
const msgs = createMessages()
msgs[0].timestamp = new Date(2019, 6, 3, 4, 23).getTime()
msgs[1].timestamp = new Date(2019, 6, 3, 4, 27).getTime()
@@ -68,7 +68,7 @@ describe('<MessageList />', function() {
expect(screen.queryByText('4:27 am Wed, 3rd Jul 19')).to.not.exist
})
it('renders a timestamp for each messages separated for more than 5 minutes', function() {
it('renders a timestamp for each messages separated for more than 5 minutes', function () {
const msgs = createMessages()
msgs[0].timestamp = new Date(2019, 6, 3, 4, 23).getTime()
msgs[1].timestamp = new Date(2019, 6, 3, 4, 31).getTime()
@@ -85,7 +85,7 @@ describe('<MessageList />', function() {
screen.getByText('4:31 am Wed, 3rd Jul 19')
})
it('resets the number of unread messages after clicking on the input', function() {
it('resets the number of unread messages after clicking on the input', function () {
const resetUnreadMessages = sinon.stub()
render(
<MessageList
@@ -5,24 +5,24 @@ import { render, screen } from '@testing-library/react'
import Message from '../../../../../frontend/js/features/chat/components/message'
import { stubMathJax, tearDownMathJaxStubs } from './stubs'
describe('<Message />', function() {
describe('<Message />', function () {
const currentUser = {
id: 'fake_user',
first_name: 'fake_user_first_name',
email: 'fake@example.com'
}
beforeEach(function() {
beforeEach(function () {
window.user = currentUser
stubMathJax()
})
afterEach(function() {
afterEach(function () {
delete window.user
tearDownMathJaxStubs()
})
it('renders a basic message', function() {
it('renders a basic message', function () {
const message = {
contents: ['a message'],
user: currentUser
@@ -33,7 +33,7 @@ describe('<Message />', function() {
screen.getByText('a message')
})
it('renders a message with multiple contents', function() {
it('renders a message with multiple contents', function () {
const message = {
contents: ['a message', 'another message'],
user: currentUser
@@ -45,7 +45,7 @@ describe('<Message />', function() {
screen.getByText('another message')
})
it('renders HTML links within messages', function() {
it('renders HTML links within messages', function () {
const message = {
contents: [
'a message with a <a href="https://overleaf.com">link to Overleaf</a>'
@@ -58,13 +58,13 @@ describe('<Message />', function() {
screen.getByRole('link', { name: 'https://overleaf.com' })
})
describe('when the message is from the user themselves', function() {
describe('when the message is from the user themselves', function () {
const message = {
contents: ['a message'],
user: currentUser
}
it('does not render the user name nor the email', function() {
it('does not render the user name nor the email', function () {
render(<Message userId={currentUser.id} message={message} />)
expect(screen.queryByText(currentUser.first_name)).to.not.exist
@@ -72,7 +72,7 @@ describe('<Message />', function() {
})
})
describe('when the message is from other user', function() {
describe('when the message is from other user', function () {
const otherUser = {
id: 'other_user',
first_name: 'other_user_first_name'
@@ -83,13 +83,13 @@ describe('<Message />', function() {
user: otherUser
}
it('should render the other user name', function() {
it('should render the other user name', function () {
render(<Message userId={currentUser.id} message={message} />)
screen.getByText(otherUser.first_name)
})
it('should render the other user email when their name is not available', function() {
it('should render the other user email when their name is not available', function () {
const msg = {
contents: message.contents,
user: {