From d209a92efa521ebe2abcf6afb65f4fbb74196b99 Mon Sep 17 00:00:00 2001 From: Sean Hammond Date: Thu, 11 Jul 2024 16:58:51 +0100 Subject: [PATCH] Add Preact component tests Add a first step for a Preact component in h. For now this isn't a very useful test (and the component being tested doesn't have any dynamic behaviour to test), but it suffices to ensure that the necessary test dependencies are setup (e.g. Enzyme). --- .../components/CreateGroupForm.tsx | 26 +- .../components/test/CreateGroupForm-test.js | 20 + h/static/scripts/tests/bootstrap.js | 5 + package.json | 2 + rollup-tests.config.js | 21 +- yarn.lock | 439 ++++++++++++++++-- 6 files changed, 466 insertions(+), 47 deletions(-) create mode 100644 h/static/scripts/group-forms/components/test/CreateGroupForm-test.js diff --git a/h/static/scripts/group-forms/components/CreateGroupForm.tsx b/h/static/scripts/group-forms/components/CreateGroupForm.tsx index 9e25931e978..6a2b3dce7a3 100644 --- a/h/static/scripts/group-forms/components/CreateGroupForm.tsx +++ b/h/static/scripts/group-forms/components/CreateGroupForm.tsx @@ -6,11 +6,21 @@ function Star() { return *; } -function CharacterCounter({ value, limit }: { value: number; limit: number }) { +function CharacterCounter({ + value, + limit, + testid, +}: { + value: number; + limit: number; + testid: string; +}) { return (
- {value}/{limit} + + {value}/{limit} +
); } @@ -46,13 +56,21 @@ export default function CreateGroupForm() {