Skip to content

Commit 29bb079

Browse files
committed
test(studio): the ~org overview redirect, read at each of its two doors
Claude-Session: https://claude.ai/code/session_01Utp6CbL6Nn3scsU8yvLyU4 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 3236d33 commit 29bb079

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

‎ui/packages/app-shell/src/views/studio-design/StudioPackageOverview-37454.test.tsx‎

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,12 @@ function renderPage(entry = `/studio/${OWN}/overview`) {
379379
);
380380
}
381381

382-
/** The surface with its address printed outside the routes, so a redirect that leaves the route is still read. */
383-
function renderSurfaceAt(entry: string) {
382+
/**
383+
* The surface with its address printed outside the routes, so a redirect that
384+
* leaves the route is still read. `bare` mounts the surface without the
385+
* pillar redirect in front of it, to read the surface's own guard.
386+
*/
387+
function renderSurfaceAt(entry: string, { bare = false } = {}) {
384388
return render(
385389
<MePermissionsProvider initialPermissions={AUTHOR}>
386390
<MemoryRouter initialEntries={[entry]}>
@@ -389,9 +393,13 @@ function renderSurfaceAt(entry: string) {
389393
<Route
390394
path="/studio/:packageId/:tab"
391395
element={
392-
<StudioPillarRedirect>
396+
bare ? (
393397
<StudioDesignSurface />
394-
</StudioPillarRedirect>
398+
) : (
399+
<StudioPillarRedirect>
400+
<StudioDesignSurface />
401+
</StudioPillarRedirect>
402+
)
395403
}
396404
/>
397405
</Routes>
@@ -441,8 +449,14 @@ describe('the overview\'s branch order (objectstack#37454)', () => {
441449
expect(screen.queryByTestId('studio-package-menu')).toBeNull();
442450
});
443451

444-
it('the package-less scope has no overview: ~org/overview redirects to its area', async () => {
445-
renderSurfaceAt('/studio/~org/overview');
452+
// Two doors stand in front of it: the pillar redirect, which sends every
453+
// `~org` address but Automations to the scope's area, and the surface's own
454+
// guard behind it. Each is read on its own.
455+
it.each([
456+
['through the route as the console mounts it', false],
457+
['the surface alone: its own guard', true],
458+
])('the package-less scope has no overview: ~org/overview redirects to its area (%s)', async (_door, bare) => {
459+
renderSurfaceAt('/studio/~org/overview', { bare });
446460
await waitFor(() => expect(screen.getByTestId('where')).toHaveTextContent(studioOrgScopePath()), { timeout: 8000 });
447461
expect(screen.queryByTestId('studio-package-overview')).toBeNull();
448462
expect(screen.queryByTestId('studio-package-menu')).toBeNull();

0 commit comments

Comments
 (0)