Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NethmiRodrigo committed Dec 19, 2024
1 parent 750bc17 commit ef8539f
Show file tree
Hide file tree
Showing 8 changed files with 603 additions and 118 deletions.
45 changes: 23 additions & 22 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
"plugin:jest-dom/recommended",
"plugin:testing-library/react"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": true,
"tsconfigRootDir": "__dirname"
},
"plugins": ["@typescript-eslint", "import", "react-hooks", "testing-library"],
"plugins": ["@typescript-eslint", "import", "jest-dom", "react-hooks", "testing-library"],
"root": true,
"overrides": [
{
Expand All @@ -22,36 +19,37 @@
}
],
"rules": {
"import/no-duplicates": "error",
"react-hooks/exhaustive-deps": "warn",
"react-hooks/rules-of-hooks": "error",
// Disabling these rules for now just to keep the diff small. We'll enable them one by one as we go.
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/ban-types": "off",
"@typescript-eslint/no-explicit-any": "off",
// not hugely concerned about accidental implicit type coercions for now https://typescript-eslint.io/rules/no-base-to-string
"@typescript-eslint/no-base-to-string": "off",
"@typescript-eslint/no-unused-vars": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/triple-slash-reference": "off",
// The following rules need `noImplicitAny` to be set to `true` in our tsconfig. They are too restrictive for now, but should be reconsidered in future
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/unbound-method": "off",
// Nitpicky. Prefer `interface T` over type T
"@typescript-eslint/consistent-type-definitions": "error",
"@typescript-eslint/consistent-type-exports": "error",
"@typescript-eslint/no-floating-promises": "off",
// Use `import type` instead of `import` for type imports
// Use `import type` instead of `import` for type imports https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how
"@typescript-eslint/consistent-type-imports": [
"error",
{
"fixStyle": "inline-type-imports"
}
],
// Use Array<T> instead of T[] consistently
"@typescript-eslint/array-type": [
"import/no-duplicates": "error",
"no-console": [
"error",
{
"default": "generic"
"allow": ["warn", "error"]
}
],
"no-console": ["error", { "allow": ["warn", "error"] }],
"no-unsafe-optional-chaining": "off",
"no-explicit-any": "off",
"no-extra-boolean-cast": "off",
"no-prototype-builtins": "off",
"no-useless-escape": "off",
"no-restricted-imports": [
"error",
{
Expand All @@ -77,6 +75,9 @@
}
]
}
]
],
"prefer-const": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn"
}
}
}
19 changes: 7 additions & 12 deletions src/components/interactive-builder/add-question.modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import { useConceptLookup } from '../../hooks/useConceptLookup';
import { usePatientIdentifierTypes } from '../../hooks/usePatientIdentifierTypes';
import { usePersonAttributeTypes } from '../../hooks/usePersonAttributeTypes';
import { useProgramWorkStates, usePrograms } from '../../hooks/useProgramStates';
import MarkdownQuestion from './modals/question/question-form/rendering-types/inputs/markdown/markdown.component';
import styles from './question-modal.scss';

interface AddQuestionModalProps {
Expand Down Expand Up @@ -364,17 +363,13 @@ const AddQuestionModal: React.FC<AddQuestionModalProps> = ({
<ModalBody hasScrollingContent>
<FormGroup legendText={''}>
<Stack gap={5}>
{renderingType === 'markdown' ? (
<MarkdownQuestion onValueChange={setQuestionValue} />
) : (
<TextInput
id="questionLabel"
labelText={<RequiredLabel isRequired={isQuestionRequired} text={t('questionLabel', 'Label')} t={t} />}
placeholder={t('labelPlaceholder', 'e.g. Type of Anaesthesia')}
value={questionLabel}
onChange={(event: React.ChangeEvent<HTMLInputElement>) => setQuestionLabel(event.target.value)}
/>
)}
<TextInput
id="questionLabel"
labelText={<RequiredLabel isRequired={isQuestionRequired} text={t('questionLabel', 'Label')} t={t} />}
placeholder={t('labelPlaceholder', 'e.g. Type of Anaesthesia')}
value={questionLabel}
onChange={(event: React.ChangeEvent<HTMLInputElement>) => setQuestionLabel(event.target.value)}
/>

<TextInput
id="questionId"
Expand Down
Loading

0 comments on commit ef8539f

Please sign in to comment.