Skip to content
Source
Sign inSign up

require-registered-list-scroll.test.ts

32 lines1.0 KB

1import { assert, describe } from "@effect/vitest";
2​
3import { createOxlintRuleHarness } from "../test/utils.ts";
4​
5const rule = createOxlintRuleHarness("t3code/require-registered-list-scroll", {
6 filename: "fixture.tsx",
7});
8​
9describe("t3code/require-registered-list-scroll", () => {
10 rule.valid(
11 "allows a list that renders through a registered scroll view",
12 `const el = <LegendList data={rows} renderScrollComponent={NativeScrollView} />;`,
13 );
14​
15 rule.valid(
16 "allows a keyboard-aware list with its scroll view component",
17 `const el = <KeyboardAwareLegendList data={rows} ScrollViewComponent={FeedScrollView} />;`,
18 );
19​
20 rule.invalid(
21 "reports a list given the other list's scroll prop",
22 `const el = <LegendList data={rows} ScrollViewComponent={NativeScrollView} />;`,
23 );
24​
25 rule.invalid(
26 "reports a list with the default scroll view",
27 `const el = <AnimatedLegendList data={rows} renderItem={renderRow} />;`,
28 (output) => {
29 assert.match(output, /header-registered scroll view/);
30 },
31 );
32});