Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
sessionCookieHeader,
setupTestDatabase,
} from '@testkit/integration'
import { eq } from 'drizzle-orm'
import { and, eq } from 'drizzle-orm'
import { beforeAll, describe, expect, it } from 'vitest'
import { groupMembers, groups, groupTypes } from '@/db/schema/kit'
import { analyticsPageGroups } from '../../db/schema/analytics-page-groups'
Expand Down Expand Up @@ -155,7 +155,11 @@ describe('a dashboard restricted to a group', () => {
describe('an EMPTY grant list is private, not public', () => {
it('narrows to the creator and admins when the last group goes', async () => {
const orphaned = await page(creator.userId, 'groups', [groupId])
await db.delete(analyticsPageGroups).where(eq(analyticsPageGroups.pageId, orphaned))
await db
.delete(analyticsPageGroups)
.where(
and(eq(analyticsPageGroups.tenantId, tenantId), eq(analyticsPageGroups.pageId, orphaned))
)

for (const [label, get, isAdminLevel] of [
['the creator', () => creator, true],
Expand Down
14 changes: 11 additions & 3 deletions plugins/analytics/docs/upgrades/unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,27 @@ previous: 3.4.1
date: null
breaking: false
migrations: []
areas: []
areas: [api]
touches_surfaces: []
requires_surfaces: []
manual: false
---

## What changed

_Nothing yet. Add an entry here in the same pull request as the change — see `README.md` beside this
file for the fields and for what "How to apply" has to say._
The dashboard-visibility test's setup delete now names the tenant, so an app with analytics installed passes the kit's `unscoped-allowlist` scan.

- `apps/web/src/plugins/analytics/tests/api/dashboard-visibility.test.ts`: the delete that removes a page's last group grant filters on `tenantId` as well as `pageId` (#8).

## How to apply

1. `pnpm plugin upgrade analytics --apply` replaces the test file; nothing else changes.
2. If the app added `src/plugins/analytics/tests/api/dashboard-visibility.test.ts` to `CORE_UNSCOPED_ALLOWLIST` in `apps/web/tests/config/unscoped-allowlist.test.ts` as a workaround, delete that entry: the test fails a stale allow-list entry.

## Conflicts to expect

None.

## Verify

1. `pnpm web test:config` passes, including `tests/config/unscoped-allowlist.test.ts`.
Loading