Skip to content

Commit

Permalink
Hygiene...
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Jan 20, 2025
1 parent 4d11ebc commit 70e067d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion servicedesk-gui/src/__tests__/locale/en.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert, expect, test } from 'vitest'
import {expect, test} from 'vitest'

import en from "../../locale/en";
import nl from "../../locale/nl";
Expand Down
9 changes: 6 additions & 3 deletions servicedesk-gui/src/__tests__/stores/AppStore.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { assert, expect, test } from 'vitest'
import {expect, test} from 'vitest'
import {useAppStore} from "../../stores/AppStore";

test("Store outside functional component", () => {
const csrfToken = useAppStore.getState().csrfToken;
expect(csrfToken).toBeUndefined();
const csrfTokenFromState = useAppStore.getState().csrfToken;
expect(csrfTokenFromState).toBeUndefined();

useAppStore.setState({csrfToken: "test"});

const updatedCsrfToken = useAppStore.getState().csrfToken;
expect(updatedCsrfToken).toEqual("test");
//https://mayashavin.com/articles/test-react-hooks-with-vitest
// const {csrfToken} = useAppStore(state => state);
// expect(csrfToken).toEqual("test");
});
2 changes: 1 addition & 1 deletion servicedesk-gui/src/__tests__/utils/Utils.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assert, expect, test } from 'vitest'
import {expect, test} from 'vitest'
import {distinctValues, sanitizeURL} from "../../utils/Utils";

test("Test sanitizeURL", () => {
Expand Down
3 changes: 0 additions & 3 deletions servicedesk-gui/src/tabs/Control.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import I18n from "../locale/I18n";
import {Button, ButtonType, CodeValidation, Switch, Toaster, ToasterType} from "@surfnet/sds";
import {convertUserControlCode, validateDate} from "../api/index.js";
import {useAppStore} from "../stores/AppStore.js";
import {useNavigate} from "react-router-dom";
import DOMPurify from "dompurify";
import {isEmpty} from "../utils/Utils.js";

Expand All @@ -19,8 +18,6 @@ const Control = ({restart, proceed}) => {

const confirmationItems = ["photo", "valid", "lastName", "firstName", "dayOfBirth"];

const navigate = useNavigate();

useEffect(() => {
validateDate(controlCode.dayOfBirth).then(res => {
setValidDayOfBirth(res);
Expand Down
1 change: 1 addition & 0 deletions servicedesk-gui/src/tabs/VerifyWizard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Confirmation from "./Confirmation.jsx";
const VerifyWizard = () => {

const [step, setStep] = useState(1);

if (step === 1) {
return <Verification proceed={() => setStep(2)}/>;
}
Expand Down

0 comments on commit 70e067d

Please sign in to comment.