@terreno/ui 0.14.1 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/bunSetup.ts CHANGED
@@ -1189,10 +1189,6 @@ mock.module("react-native/Libraries/vendor/core/ErrorUtils", () => ({
1189
1189
  },
1190
1190
  }));
1191
1191
 
1192
- mock.module("react-native/Libraries/Core/ReactNativeVersion", () => ({
1193
- version: {major: 0, minor: 81, patch: 5},
1194
- }));
1195
-
1196
1192
  mock.module("react-native/Libraries/Core/NativeExceptionsManager", () => ({
1197
1193
  default: null,
1198
1194
  }));
@@ -131,6 +131,18 @@ describe("LoginScreen", () => {
131
131
  expect(queryByTestId("login-screen-signup-link")).toBeNull();
132
132
  });
133
133
 
134
+ it("calls onSubmit when submit button is pressed and fields filled", async () => {
135
+ const onSubmit = mock(() => Promise.resolve());
136
+ const {getByTestId} = renderWithTheme(
137
+ <LoginScreen fields={defaultFields} onSubmit={onSubmit} />
138
+ );
139
+ fireEvent.changeText(getByTestId("login-screen-email-input"), "user@test.com");
140
+ fireEvent.changeText(getByTestId("login-screen-password-input"), "secret123");
141
+ fireEvent.press(getByTestId("login-screen-submit-button"));
142
+ await new Promise((r) => setTimeout(r, 600));
143
+ expect(onSubmit).toHaveBeenCalled();
144
+ });
145
+
134
146
  it("renders correctly with all props", () => {
135
147
  const {toJSON} = renderWithTheme(
136
148
  <LoginScreen
@@ -25,17 +25,22 @@ describe("useConsentHistory", () => {
25
25
  refetch,
26
26
  }));
27
27
  const api = {
28
- injectEndpoints: mock((opts: MockInjectOpts) => {
29
- const build = {
30
- query: mock((def: MockQueryDef) => {
31
- // Exercise the URL builder so the closure captures `base`
32
- const url = def.query();
33
- expect(url).toContain("/consents/my");
34
- return "my-consents-query";
28
+ enhanceEndpoints: mock((opts: {addTagTypes: string[]}) => {
29
+ expect(opts.addTagTypes).toContain("MyConsents");
30
+ return {
31
+ injectEndpoints: mock((injectOpts: MockInjectOpts) => {
32
+ const build = {
33
+ query: mock((def: MockQueryDef) => {
34
+ // Exercise the URL builder so the closure captures `base`
35
+ const url = def.query();
36
+ expect(url).toContain("/consents/my");
37
+ return "my-consents-query";
38
+ }),
39
+ };
40
+ injectOpts.endpoints(build);
41
+ return {useGetMyConsentsQuery};
35
42
  }),
36
43
  };
37
- opts.endpoints(build);
38
- return {useGetMyConsentsQuery};
39
44
  }),
40
45
  };
41
46
  return {api, refetch};
@@ -84,10 +89,12 @@ describe("useConsentHistory", () => {
84
89
  refetch,
85
90
  }));
86
91
  const api = {
87
- injectEndpoints: () => {
88
- injectCallCount += 1;
89
- return {useGetMyConsentsQuery};
90
- },
92
+ enhanceEndpoints: () => ({
93
+ injectEndpoints: () => {
94
+ injectCallCount += 1;
95
+ return {useGetMyConsentsQuery};
96
+ },
97
+ }),
91
98
  };
92
99
  const {rerender} = renderHook(() => useConsentHistory(api as unknown as ConsentHistoryApi));
93
100
  rerender(undefined);
@@ -39,13 +39,17 @@ interface ConsentHistoryEnhancedApi {
39
39
  useGetMyConsentsQuery: () => ConsentHistoryHookState;
40
40
  }
41
41
 
42
- interface ConsentHistoryApi {
42
+ interface ConsentHistoryApiWithTags {
43
43
  injectEndpoints: (options: {
44
44
  endpoints: (build: ConsentHistoryQueryBuilder) => {getMyConsents: unknown};
45
45
  overrideExisting: boolean;
46
46
  }) => ConsentHistoryEnhancedApi;
47
47
  }
48
48
 
49
+ interface ConsentHistoryApi {
50
+ enhanceEndpoints: (options: {addTagTypes: string[]}) => ConsentHistoryApiWithTags;
51
+ }
52
+
49
53
  /**
50
54
  * Cache the enhanced api per (api, baseUrl). `injectEndpoints` logs a console
51
55
  * error in development whenever an endpoint with the same name is re-injected
@@ -65,7 +69,8 @@ const getEnhancedApi = (api: ConsentHistoryApi, base: string): ConsentHistoryEnh
65
69
  if (cached) {
66
70
  return cached;
67
71
  }
68
- const enhanced = api.injectEndpoints({
72
+ const apiWithConsentTags = api.enhanceEndpoints({addTagTypes: ["MyConsents"]});
73
+ const enhanced = apiWithConsentTags.injectEndpoints({
69
74
  endpoints: (build) => ({
70
75
  getMyConsents: build.query({
71
76
  providesTags: ["MyConsents"],