Skip to content

Commit

Permalink
removes failing test and fixes lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jduss4 committed Mar 29, 2024
1 parent 10352e3 commit afed6ff
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 36 deletions.
5 changes: 5 additions & 0 deletions nextjs/nextjs-site/__tests__/app/api/session/route.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import {
import { GET, POST } from '../../../../app/api/session/route';

/* global jest */
/* global Promise */


/* eslint no-undef: "off" */
jest.mock('../../../../db/session', () => ({
addSession: jest.fn(),
Expand Down Expand Up @@ -57,7 +60,9 @@ describe("With valid DB connection", () => {
// TODO this is technically different than the database behavior
// which does not care if the username is blank, do we care?
const request = {
/* es-lint no-undef: "off" */
json() { return Promise.resolve({ username: null }); }
/* es-lint no-undef: "error" */
}
// Note: do not need to mock database as we expect POST
// to catch the error before we get there
Expand Down
22 changes: 1 addition & 21 deletions nextjs/nextjs-site/__tests__/app/session/page.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import {
describe, expect, it
} from '@jest/globals';
import {
act, render, screen
render, screen
} from '@testing-library/react';
import userEvent from '@testing-library/user-event'
import Page from '../../../app/session/page';
import { getData } from '../../../api/api';

Expand Down Expand Up @@ -54,24 +53,5 @@ describe("session page", () => {
});

it.todo("updates the list when the form is submitted");
// it("updates the list when the form is submitted", async () => {
// getData.mockImplementation(() => { return fakeSessions; });

// render (<Page />);

// const user = userEvent.setup();

// await act( async () => {
// const input = await screen.getByRole('textbox', { name: 'username' });
// await user.type(input, 'Test');

// const submit = await screen.getByText('Add username');
// await user.click(submit);

// // const list = document.querySelector('listitem');
// // expect(list).toHaveLength(1);
// expect(await screen.findByText('Test')).toBeInTheDocument();
// });
// });

});
14 changes: 0 additions & 14 deletions nextjs/nextjs-site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion nextjs/nextjs-site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"devDependencies": {
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^14.2.1",
"@testing-library/user-event": "^14.5.2",
"eslint": "8.56.0",
"eslint-config-next": "14.1.0",
"eslint-config-prettier": "^9.1.0",
Expand Down

0 comments on commit afed6ff

Please sign in to comment.