@terreno/admin-frontend 0.25.0 → 0.26.0
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dependencies": {
|
|
3
|
-
"@terreno/ui": "0.
|
|
3
|
+
"@terreno/ui": "0.26.0",
|
|
4
4
|
"expo-router": "~6.0.19",
|
|
5
5
|
"jspdf": "^4.2.0",
|
|
6
6
|
"lodash": "^4.17.23",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"test:coverage": "bun run ../scripts/check-coverage.ts"
|
|
53
53
|
},
|
|
54
54
|
"types": "dist/index.d.ts",
|
|
55
|
-
"version": "0.
|
|
55
|
+
"version": "0.26.0"
|
|
56
56
|
}
|
package/src/AdminHome.test.tsx
CHANGED
|
@@ -33,12 +33,24 @@ mock.module("./useAdminApi", () => ({
|
|
|
33
33
|
}),
|
|
34
34
|
}));
|
|
35
35
|
|
|
36
|
-
mock.module("./AdminVersionConfig", () => ({
|
|
37
|
-
AdminVersionConfig: () => <React.Fragment />,
|
|
38
|
-
}));
|
|
39
|
-
|
|
40
36
|
import {AdminHome} from "./AdminHome";
|
|
41
37
|
|
|
38
|
+
const adminApi = {
|
|
39
|
+
injectEndpoints: ({endpoints}: {endpoints: (builder: unknown) => Record<string, unknown>}) => {
|
|
40
|
+
endpoints({
|
|
41
|
+
mutation: (spec: Record<string, unknown>) => spec,
|
|
42
|
+
query: (spec: Record<string, unknown>) => spec,
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
useAdminVersionConfigQuery: () => ({data: null, error: null, isLoading: false}),
|
|
46
|
+
useUpdateVersionConfigMutation: () => [
|
|
47
|
+
() => ({unwrap: async () => ({})}),
|
|
48
|
+
{isLoading: false},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
} as unknown as AdminApi;
|
|
53
|
+
|
|
42
54
|
const buildConfig = (overrides?: Partial<AdminConfigResponse>): AdminConfigResponse => ({
|
|
43
55
|
customScreens: [],
|
|
44
56
|
home: {
|
|
@@ -108,9 +120,7 @@ describe("AdminHome", () => {
|
|
|
108
120
|
|
|
109
121
|
it("renders scriptRunner in the top band with contentTop widgets on the same row, not inside main", () => {
|
|
110
122
|
configState.config = buildConfig();
|
|
111
|
-
const {UNSAFE_root} = renderWithTheme(
|
|
112
|
-
<AdminHome api={{} as unknown as AdminApi} baseUrl="/admin" />
|
|
113
|
-
);
|
|
123
|
+
const {UNSAFE_root} = renderWithTheme(<AdminHome api={adminApi} baseUrl="/admin" />);
|
|
114
124
|
const top = UNSAFE_root.findAll(
|
|
115
125
|
(n: ReactTestInstance) => n.props?.testID === "admin-home-slot-top"
|
|
116
126
|
);
|
|
@@ -130,9 +140,7 @@ describe("AdminHome", () => {
|
|
|
130
140
|
|
|
131
141
|
it("shows per-model row counts on each model card", () => {
|
|
132
142
|
configState.config = buildConfig();
|
|
133
|
-
const {UNSAFE_root} = renderWithTheme(
|
|
134
|
-
<AdminHome api={{} as unknown as AdminApi} baseUrl="/admin" />
|
|
135
|
-
);
|
|
143
|
+
const {UNSAFE_root} = renderWithTheme(<AdminHome api={adminApi} baseUrl="/admin" />);
|
|
136
144
|
const modelCountLabels = UNSAFE_root.findAll(
|
|
137
145
|
(n: ReactTestInstance) => n.props?.testID === "admin-home-model-count-Widget"
|
|
138
146
|
);
|
|
@@ -150,9 +158,7 @@ describe("AdminHome", () => {
|
|
|
150
158
|
title: "Test Admin",
|
|
151
159
|
},
|
|
152
160
|
});
|
|
153
|
-
const {UNSAFE_root} = renderWithTheme(
|
|
154
|
-
<AdminHome api={{} as unknown as AdminApi} baseUrl="/admin" />
|
|
155
|
-
);
|
|
161
|
+
const {UNSAFE_root} = renderWithTheme(<AdminHome api={adminApi} baseUrl="/admin" />);
|
|
156
162
|
const mainSlots = UNSAFE_root.findAll(
|
|
157
163
|
(n: ReactTestInstance) => n.props?.testID === "admin-home-slot-main"
|
|
158
164
|
);
|
|
@@ -176,9 +182,7 @@ describe("AdminHome", () => {
|
|
|
176
182
|
title: "Test Admin",
|
|
177
183
|
},
|
|
178
184
|
});
|
|
179
|
-
const {UNSAFE_root} = renderWithTheme(
|
|
180
|
-
<AdminHome api={{} as unknown as AdminApi} baseUrl="/admin" />
|
|
181
|
-
);
|
|
185
|
+
const {UNSAFE_root} = renderWithTheme(<AdminHome api={adminApi} baseUrl="/admin" />);
|
|
182
186
|
const sidebar = UNSAFE_root.findAll(
|
|
183
187
|
(n: ReactTestInstance) => n.props?.testID === "admin-home-slot-sidebar"
|
|
184
188
|
);
|
|
@@ -205,4 +209,10 @@ describe("AdminHome", () => {
|
|
|
205
209
|
expect(ids[ids.length - 1]).toBe("admin-home-widget-recentActivity");
|
|
206
210
|
expect(ids[0]).toBe("admin-home-widget-modelsGrid");
|
|
207
211
|
});
|
|
212
|
+
|
|
213
|
+
it("renders the real version config widget without replacing its module", () => {
|
|
214
|
+
configState.config = buildConfig();
|
|
215
|
+
const {getByTestId} = renderWithTheme(<AdminHome api={adminApi} baseUrl="/admin" />);
|
|
216
|
+
expect(getByTestId("admin-version-config-widget")).toBeTruthy();
|
|
217
|
+
});
|
|
208
218
|
});
|
|
@@ -220,7 +220,7 @@ describe("useAdminScripts", () => {
|
|
|
220
220
|
method: "DELETE",
|
|
221
221
|
url: "/admin/scripts/tasks/task-1",
|
|
222
222
|
});
|
|
223
|
-
expect(cancelDef.invalidatesTags).toEqual(["admin_scriptTask"]);
|
|
223
|
+
expect(cancelDef.invalidatesTags).toEqual(["admin_scriptTask", "admin_scriptRuns"]);
|
|
224
224
|
|
|
225
225
|
expect(typeof result.useRunScriptMutation).toBe("function");
|
|
226
226
|
expect(typeof result.useGetScriptTaskQuery).toBe("function");
|