Skip to content

Commit a39cac7

Browse files
committed
Fixes test suite warnings
Fixes the test suite warnings that are unrelated to the class -> functional conversion
1 parent 272645f commit a39cac7

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

client/modules/IDE/components/EditorAccessibility.unit.test.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import EditorAccessibility from './EditorAccessibility';
66

77
describe('<EditorAccessibility />', () => {
88
it('renders empty message with no lines', () => {
9-
render(<EditorAccessibility lintMessages={[]} />);
9+
render(<EditorAccessibility lintMessages={[]} currentLine={0}/>);
1010

1111
expect(
1212
screen.getByRole('listitem', {
@@ -21,11 +21,12 @@ describe('<EditorAccessibility />', () => {
2121
lintMessages={[
2222
{
2323
severity: 'info',
24-
line: '1',
24+
line: 1,
2525
message: 'foo',
26-
id: '1a2b3c'
26+
id: 123
2727
}
2828
]}
29+
currentLine={0}
2930
/>
3031
);
3132

client/modules/IDE/components/ErrorModal.unit.test.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ jest.mock('../../../i18n');
88

99
describe('<ErrorModal />', () => {
1010
it('renders type forceAuthentication', () => {
11-
render(<ErrorModal type="forceAuthentication" closeModal={jest.fn()} />);
11+
render(<ErrorModal type="forceAuthentication" closeModal={jest.fn()} service="google" />);
1212

1313
expect(screen.getByText('Login')).toBeVisible();
1414
expect(screen.getByText('Sign Up')).toBeVisible();
1515
});
1616

1717
it('renders type staleSession', () => {
18-
render(<ErrorModal type="staleSession" closeModal={jest.fn()} />);
18+
render(<ErrorModal type="staleSession" closeModal={jest.fn()} service="google" />);
1919

2020
expect(screen.getByText('log in')).toBeVisible();
2121
});
2222

2323
it('renders type staleProject', () => {
24-
render(<ErrorModal type="staleProject" closeModal={jest.fn()} />);
24+
render(<ErrorModal type="staleProject" closeModal={jest.fn()} service="google" />);
2525

2626
expect(
2727
screen.getByText(

client/modules/IDE/components/FileNode.unit.test.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,16 @@ describe('<FileNode />', () => {
8383
});
8484

8585
it('can change to a different extension', async () => {
86+
let mockConfirm = jest.fn(() => true);
87+
window.confirm = mockConfirm;
88+
8689
const newName = 'newname.gif';
8790
const props = renderFileNode('file');
8891

8992
changeName(newName);
9093

91-
await waitFor(() => expect(props.updateFileName).not.toHaveBeenCalled());
94+
expect(mockConfirm).toHaveBeenCalled();
95+
await waitFor(() => expect(props.updateFileName).toHaveBeenCalledWith(props.id, newName));
9296
await expectFileNameToBe(props.name);
9397
});
9498

server/controllers/project.controller/__test__/createProject.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ describe('project.controller', () => {
179179
});
180180

181181
it('fails if user does not have permission', async () => {
182+
// We don't want to clog up the jest output with extra
183+
// logs, so we turn off console warn for this one test.
184+
jest.spyOn(console, 'warn').mockImplementation(() => {});
185+
182186
request.user = { _id: 'abc123', username: 'alice' };
183187
request.params = {
184188
username: 'dana'

server/controllers/project.controller/createProject.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export async function apiCreateProject(req, res) {
5959

6060
const checkUserHasPermission = () => {
6161
if (req.user.username !== req.params.username) {
62-
console.log('no permission');
62+
console.warn('no permission');
6363
const error = new ProjectValidationError(
6464
`'${req.user.username}' does not have permission to create for '${req.params.username}'`
6565
);

0 commit comments

Comments
 (0)