Skip to content

[MISC][GZ] shared dirty state test suite and render helper - #633

Open
ghazwan-gt wants to merge 1 commit into
mainfrom
misc/unit-test
Open

[MISC][GZ] shared dirty state test suite and render helper#633
ghazwan-gt wants to merge 1 commit into
mainfrom
misc/unit-test

Conversation

@ghazwan-gt

Copy link
Copy Markdown

Changes

  • Introduce dirtyStateTestSuite and createRenderComponent utils to reduce boilerplate across field integration tests
  • Converts test files to utilize the utils, removing ~2000 lines of duplicated test code. Some tests are left untouched since those doesn't follow the same pattern.

Checklist

  • All test suites pass
  • TypeScript compilation passes

Comment on lines +3 to +4
// eslint-disable-next-line @typescript-eslint/no-explicit-any
export const labelTestSuite = (renderComponent: (overrideField?: any) => void) =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

qn: why does the param need to be changed from unknown to any? unknown seems to work fine without type errors

Comment on lines 20 to +21
import { warningTestSuite } from "../../../common/tests/warnings";
import { dirtyStateTestSuite } from "../../../common/tests";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we include warnings in the barrel index and combine the imports?

Comment on lines +52 to +55
baseSchema: {
referenceKey: UI_TYPE,
src: IFRAME_SRC,
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm I don't see much savings here since we have to redeclare the schema, and it feels a little awkward that to reference the full schema we have to access it from renderComponent.schema. could we still retain the common JSON_SCHEMA in the spec file and pass that wholesale to createRenderComponent?

not sure if there are other patterns I missed!


expect(formIsDirty).toBe(false);
});
dirtyStateTestSuite({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that this was applied for phone but not email, why is that the case?

@qroll qroll added this to the v2-next milestone Jul 3, 2026
@qroll qroll added the type: tests Improvements or additions to tests label Jul 3, 2026
@weili-govtech weili-govtech modified the milestones: v2.2.6, v2-next Jul 17, 2026
@qroll qroll modified the milestone: v2-next Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: tests Improvements or additions to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants