Skip to content

Commit

Permalink
Merge pull request #118 from bible-technology/lint-test-fixes
Browse files Browse the repository at this point in the history
Fixing lint and test issues
  • Loading branch information
vipinpaul authored Aug 11, 2023
2 parents d8c94dd + 1116390 commit 9231365
Show file tree
Hide file tree
Showing 10 changed files with 96 additions and 96 deletions.
1 change: 0 additions & 1 deletion renderer/src/components/EditorPage/ObsEditor/ObsImage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { environment } from '../../../../environment';
import packageInfo from '../../../../../package.json';

function ObsImage({ story, online }) {
console.log({ online });
const path = require('path');
const newpath = localStorage.getItem('userPath');
const imageName = story.img.split('/');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const useReadReferenceUsfmFile = ({
});
setNotifications(temp);
});
// eslint-disable-next-line no-console
return console.error(err);
}
}
Expand Down
64 changes: 0 additions & 64 deletions renderer/src/components/Login/tests/Login.test.js

This file was deleted.

65 changes: 65 additions & 0 deletions renderer/src/components/Login/tests/Login.testold.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/* eslint-disable no-tabs */
// import React from 'react';
// import { render, fireEvent } from '@testing-library/react';
// import Login from '../Login';
// import CustomLogin from '../CustomLogin';
// import { isElectron } from '../../../core/handleElectron';
// import AuthenticationContextProvider from '../AuthenticationContextProvider';
// // import { act } from 'react-dom/test-utils';

// describe('Login component tests', () => {
// test('Should render Login component without error', () => {
// render(
// <AuthenticationContextProvider>
// <Login />
// </AuthenticationContextProvider>,
// );
// });
// describe('Offline test', () => {
// if (isElectron()) {
// test('Should have tabs', async () => {
// const { getByTestId } = render(<Login />);
// const element = getByTestId('tabs');
// expect(element).toHaveTextContent('OfflineOnline');
// });
// }
// test('Should have called CustomLogin', async () => {
// render(<CustomLogin />);
// });
// });

// // describe('Online test', () => {
// // test('Update state on password change', async () => {
// // const { getByTestId } = render(<Login />);
// // const element = getByTestId('password-textfield');
// // const passwordTextfield = element.children[0];
// // await act(async () => {
// // fireEvent.change(passwordTextfield, {target: { value: 'testPassword' },});
// // });
// // expect(passwordTextfield.value).toEqual('testPassword');
// // });
// // });

// // test('Should click login button', async () => {
// // const mockLogin = jest.fn();
// // React.useState = jest.fn(() => ['', mockLogin]);
// // const { getByTestId } = render(<Login />);
// // const usernameTextfield = getByTestId('username-textfield');
// // const element = getByTestId('password-textfield');
// // const passwordTextfield = element.children[0];
// // const loginButton = getByTestId('login-button');
// // await act(async () => {
// // fireEvent.change(usernameTextfield, { target: { value: 'testUser' } });
// // fireEvent.change(passwordTextfield, {
// // target: { value: 'testPassword' },
// // });
// // fireEvent.click(loginButton);
// // });
// // expect(mockLogin).toHaveBeenCalled();
// // // expect(mockLogin).toBeCalledWith({
// // // username: "testUser",
// // // password: "testPassword",
// // // showPassword: false,
// // // });
// // });
// });
19 changes: 0 additions & 19 deletions renderer/src/components/Signup/Signup.test.js

This file was deleted.

19 changes: 19 additions & 0 deletions renderer/src/components/Signup/Signup.testold.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// import React from "react";
// import { render } from "@testing-library/react";
// import "@testing-library/jest-dom/extend-expect";
// import Signup from "./Signup";
// import CustomLogin from '../Login/CustomLogin'

// describe('Signup component tests', () => {
// test("renders without fail", () => {
// render(<Signup />);
// });
// test('Should have called CustomLogin', async () => {
// render(<CustomLogin />);
// });
// test("Signup should have link to Login page.", () => {
// const { getByTestId } = render(<Signup />);
// const link = getByTestId('signup');
// expect(link.href).toBe("http://localhost/login");
// });
// });
2 changes: 1 addition & 1 deletion renderer/src/components/Sync/Ag/ProjectFileBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default function ProjectFileBrowser() {
agProjects.filter((project) => projectMeta?.identification?.name?.en === project && projectMeta?.type?.flavorType?.flavor?.name !== 'audioTranslation'
&& !projectMeta?.project[projectMeta?.type?.flavorType?.flavor?.name]?.isArchived).length > 0
&& (
<div role="button" onClick={() => handleSelectProject(projectMeta?.identification?.name?.en)} tabIndex={-1}>
<div key={projectMeta?.identification?.name?.en} role="button" onClick={() => handleSelectProject(projectMeta?.identification?.name?.en)} tabIndex={-1}>
<GridRow
key={projectMeta?.identification?.name?.en}
title={projectMeta?.identification?.name?.en}
Expand Down
18 changes: 9 additions & 9 deletions renderer/src/layouts/projects/SideBar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Link from 'next/link';
import { useEffect, useState } from 'react';
import * as localForage from 'localforage';
import { useState } from 'react';
// import * as localForage from 'localforage';
import { useTranslation } from 'react-i18next';
import { InformationCircleIcon } from '@heroicons/react/24/outline';
import LogoIcon from '@/icons/logo.svg';
Expand All @@ -12,14 +12,14 @@ import AboutModal from '../editor/AboutModal';

export default function SideBar() {
const [open, setOpen] = useState(false);
const [appMode, setAppMode] = useState();
// const [appMode, setAppMode] = useState();
const { t } = useTranslation();
useEffect(() => {
localForage.getItem('appMode')
.then((value) => {
setAppMode(value);
});
}, []);
// useEffect(() => {
// localForage.getItem('appMode')
// .then((value) => {
// setAppMode(value);
// });
// }, []);

function openModal(isOpen) {
setOpen(isOpen);
Expand Down
2 changes: 0 additions & 2 deletions renderer/src/modules/projects/ProjectList.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ export default function ProjectList() {
leaveTo="transform scale-95 opacity-0"
>
<Disclosure.Panel as="tr" key={project.name}>
<td />
<td className="px-6 py-4">
<div className="text-xxs uppercase font-regular text-gray-500 tracking-wider p-1">description</div>
<div className="text-sm tracking-wide p-1">{project.description}</div>
Expand Down Expand Up @@ -390,7 +389,6 @@ export default function ProjectList() {
leaveTo="transform scale-95 opacity-0"
>
<Disclosure.Panel as="tr" key={project.name}>
<td />
<td className="px-6 py-4">
<div className="text-xxs uppercase font-regular text-gray-500 tracking-wider p-1">description</div>
<div aria-label="project-description-display" className="text-sm tracking-wide p-1">{project.description}</div>
Expand Down
1 change: 1 addition & 0 deletions renderer/src/util/cursorUtils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
function createRange(node, chars, range) {
if (!range) {
range = document.createRange(); // eslint-disable-line no-param-reassign
Expand Down

0 comments on commit 9231365

Please sign in to comment.