Skip to content

Commit 992a138

Browse files
committed
test(studio): the badge's Studio wording, and collection-time preloads for the edited slot tests
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzfrh8TiPJf1i2kMSoa
1 parent 21b627f commit 992a138

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

‎ui/packages/app-shell/src/views/metadata-admin/PermissionMatrixEditor.badge.test.tsx‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,16 @@
1212
* a stray `managedBy` (an old stored row) must not move the answer.
1313
*
1414
* Both sites are pinned: the routed page's badge, and the Studio Access
15-
* pillar's kind chip (`studio`). They read one derivation, so they agree.
15+
* pillar's kind chip (`studio`). They read one derivation, so they agree; the
16+
* Studio chip words the package answer for the builder (objectstack#35018:
17+
* "Included with the app"), the page keeps "Package".
1618
*/
1719

1820
import '@testing-library/jest-dom/vitest';
21+
// The source under test reaches these through dynamic imports: their first load is paid at collection.
22+
import '@objectstack/formula';
23+
import '@objectstack/lint';
24+
import '@objectstack/spec/identity';
1925
import { describe, it, expect, vi, afterEach } from 'vitest';
2026
import { render, screen, cleanup } from '@testing-library/react';
2127
import { MemoryRouter } from 'react-router-dom';
@@ -88,17 +94,19 @@ async function renderWith(site: Site, extra: Record<string, unknown>, packageId?
8894
}
8995

9096
const badgeText = () => screen.getByTestId('perm-provenance-badge').textContent;
97+
/** The package answer as each site words it (objectstack#35018). */
98+
const PACKAGE_TEXT: Record<Site, string> = { page: 'Package', studio: 'Included with the app' };
9199

92100
describe.each<Site>(['page', 'studio'])('the provenance badge (%s site)', (site) => {
93101
it('a set opened under a packageId reads "Package"', async () => {
94102
await renderWith(site, {}, 'com.example.sales');
95-
expect(badgeText()).toBe('Package');
103+
expect(badgeText()).toBe(PACKAGE_TEXT[site]);
96104
});
97105

98106
it('a set whose code layer is a package artifact reads "Package"', async () => {
99107
codeLayer = { _packageId: 'com.example.sales', name: 'sales_perms' };
100108
await renderWith(site, {});
101-
expect(badgeText()).toBe('Package');
109+
expect(badgeText()).toBe(PACKAGE_TEXT[site]);
102110
});
103111

104112
it('a set with neither reads "Added"', async () => {

‎ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.kanbanCardSelection-12725.test.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
*/
2828

2929
import '@testing-library/jest-dom/vitest';
30+
// The source under test reaches it through dynamic imports: its first load is paid at collection.
31+
import '@objectstack/lint';
3032
import * as React from 'react';
3133
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
3234
import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';

‎ui/packages/app-shell/src/views/studio-design/StudioDesignSurface.leafColumnSelection-12725.test.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
*/
2727

2828
import '@testing-library/jest-dom/vitest';
29+
// The source under test reaches it through dynamic imports: its first load is paid at collection.
30+
import '@objectstack/lint';
2931
import * as React from 'react';
3032
import { afterEach, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
3133
import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';

0 commit comments

Comments
 (0)