diff --git a/packages/realm-server/tests/realm-endpoints/cancel-indexing-job-test.ts b/packages/realm-server/tests/realm-endpoints/cancel-indexing-job-test.ts index e85d27f5810..f500e5ce3b9 100644 --- a/packages/realm-server/tests/realm-endpoints/cancel-indexing-job-test.ts +++ b/packages/realm-server/tests/realm-endpoints/cancel-indexing-job-test.ts @@ -36,6 +36,7 @@ module(`realm-endpoints/${basename(__filename)}`, function () { } setupPermissionedRealmCached(hooks, { + fixture: 'blank', permissions: { writer: ['read', 'write'], reader: ['read'], diff --git a/packages/realm-server/tests/realm-endpoints/dependencies-test.ts b/packages/realm-server/tests/realm-endpoints/dependencies-test.ts index 7150953624d..e8616d00c9c 100644 --- a/packages/realm-server/tests/realm-endpoints/dependencies-test.ts +++ b/packages/realm-server/tests/realm-endpoints/dependencies-test.ts @@ -29,6 +29,7 @@ module(`realm-endpoints/${basename(__filename)}`, function (hooks) { }); setupPermissionedRealmCached(hooks, { + fixture: 'blank', permissions: { '*': ['read'], }, diff --git a/packages/realm-server/tests/realm-endpoints/directory-test.ts b/packages/realm-server/tests/realm-endpoints/directory-test.ts index 49c789728ae..70bea72f2ff 100644 --- a/packages/realm-server/tests/realm-endpoints/directory-test.ts +++ b/packages/realm-server/tests/realm-endpoints/directory-test.ts @@ -1,8 +1,6 @@ import { module, test } from 'qunit'; import type { Test, SuperTest } from 'supertest'; -import { join, basename } from 'path'; -import { dirSync, type DirResult } from 'tmp'; -import { copySync } from 'fs-extra'; +import { basename } from 'path'; import type { Realm } from '@cardstack/runtime-common'; import { setupPermissionedRealmCached, @@ -12,28 +10,21 @@ import { import '@cardstack/runtime-common/helpers/code-equality-assertion'; module(`realm-endpoints/${basename(__filename)}`, function () { - module('Realm-specific Endpoints | GET directory path', function (hooks) { + module('Realm-specific Endpoints | GET directory path', function () { let testRealm: Realm; let request: SuperTest; - let dir: DirResult; - - hooks.beforeEach(async function () { - dir = dirSync(); - copySync(join(__dirname, '..', 'cards'), dir.name); - }); function onRealmSetup(args: { testRealm: Realm; request: SuperTest; - dir: DirResult; }) { testRealm = args.testRealm; request = args.request; - dir = args.dir; } module('public readable realm', function (hooks) { setupPermissionedRealmCached(hooks, { + fixture: 'realistic', permissions: { '*': ['read'], }, @@ -102,6 +93,7 @@ module(`realm-endpoints/${basename(__filename)}`, function () { module('permissioned realm', function (hooks) { setupPermissionedRealmCached(hooks, { + fixture: 'realistic', permissions: { john: ['read'], '@node-test_realm:localhost': ['read', 'realm-owner'], diff --git a/packages/realm-server/tests/realm-endpoints/info-test.ts b/packages/realm-server/tests/realm-endpoints/info-test.ts index 841a52b2f70..fee220e9e2d 100644 --- a/packages/realm-server/tests/realm-endpoints/info-test.ts +++ b/packages/realm-server/tests/realm-endpoints/info-test.ts @@ -1,9 +1,7 @@ import { module, test } from 'qunit'; import type { Test, SuperTest } from 'supertest'; -import { join, basename } from 'path'; +import { basename } from 'path'; import type { Server } from 'http'; -import { dirSync, type DirResult } from 'tmp'; -import { copySync } from 'fs-extra'; import type { Realm } from '@cardstack/runtime-common'; import { setupPermissionedRealmCached, @@ -21,25 +19,17 @@ module(`realm-endpoints/${basename(__filename)}`, function () { let testRealm: Realm; let testRealmHttpServer: Server; let request: SuperTest; - let dir: DirResult; function onRealmSetup(args: { testRealm: Realm; testRealmHttpServer: Server; request: SuperTest; - dir: DirResult; }) { testRealm = args.testRealm; testRealmHttpServer = args.testRealmHttpServer; request = args.request; - dir = args.dir; } - hooks.beforeEach(async function () { - dir = dirSync(); - copySync(join(__dirname, '..', 'cards'), dir.name); - }); - hooks.afterEach(async function () { await closeServer(testRealmHttpServer); resetCatalogRealms(); @@ -47,6 +37,7 @@ module(`realm-endpoints/${basename(__filename)}`, function () { module('public readable realm', function (hooks) { setupPermissionedRealmCached(hooks, { + fixture: 'realistic', permissions: { '*': ['read'], }, @@ -91,6 +82,7 @@ module(`realm-endpoints/${basename(__filename)}`, function () { module('permissioned realm', function (hooks) { setupPermissionedRealmCached(hooks, { + fixture: 'realistic', permissions: { '@node-test_realm:localhost': ['read', 'realm-owner'], }, @@ -163,6 +155,7 @@ module(`realm-endpoints/${basename(__filename)}`, function () { 'shared realm because there is `users` permission', function (hooks) { setupPermissionedRealmCached(hooks, { + fixture: 'realistic', permissions: { users: ['read'], '@node-test_realm:localhost': ['read', 'realm-owner'], @@ -204,6 +197,7 @@ module(`realm-endpoints/${basename(__filename)}`, function () { module('shared realm because there are multiple users', function (hooks) { setupPermissionedRealmCached(hooks, { + fixture: 'realistic', permissions: { bob: ['read'], jane: ['read'], diff --git a/packages/realm-server/tests/realm-endpoints/lint-test.ts b/packages/realm-server/tests/realm-endpoints/lint-test.ts index 6a099a9ef26..a0934b8d7e9 100644 --- a/packages/realm-server/tests/realm-endpoints/lint-test.ts +++ b/packages/realm-server/tests/realm-endpoints/lint-test.ts @@ -26,6 +26,7 @@ module(`realm-endpoints/${basename(__filename)}`, function () { } setupPermissionedRealmCached(hooks, { + fixture: 'blank', permissions: { john: ['read', 'write'], '@node-test_realm:localhost': ['read', 'realm-owner'], diff --git a/packages/realm-server/tests/realm-endpoints/mtimes-test.ts b/packages/realm-server/tests/realm-endpoints/mtimes-test.ts index 80feb92620e..7035151d31b 100644 --- a/packages/realm-server/tests/realm-endpoints/mtimes-test.ts +++ b/packages/realm-server/tests/realm-endpoints/mtimes-test.ts @@ -28,6 +28,7 @@ module(`realm-endpoints/${basename(__filename)}`, function () { } setupPermissionedRealmCached(hooks, { + fixture: 'blank', permissions: { mary: ['read'], '@node-test_realm:localhost': ['read', 'realm-owner'], diff --git a/packages/realm-server/tests/realm-endpoints/permissions-test.ts b/packages/realm-server/tests/realm-endpoints/permissions-test.ts index a034b0a0c6e..0de2589888e 100644 --- a/packages/realm-server/tests/realm-endpoints/permissions-test.ts +++ b/packages/realm-server/tests/realm-endpoints/permissions-test.ts @@ -1,8 +1,6 @@ import { module, test } from 'qunit'; import type { Test, SuperTest } from 'supertest'; -import { join, basename } from 'path'; -import { dirSync, type DirResult } from 'tmp'; -import { copySync } from 'fs-extra'; +import { basename } from 'path'; import type { Realm } from '@cardstack/runtime-common'; import { fetchRealmPermissions } from '@cardstack/runtime-common'; import { @@ -15,32 +13,24 @@ import '@cardstack/runtime-common/helpers/code-equality-assertion'; import type { PgAdapter } from '@cardstack/postgres'; module(`realm-endpoints/${basename(__filename)}`, function () { - module('Realm-specific Endpoints | _permissions', function (hooks) { + module('Realm-specific Endpoints | _permissions', function () { let testRealm: Realm; let request: SuperTest; - let dir: DirResult; let dbAdapter: PgAdapter; function onRealmSetup(args: { testRealm: Realm; request: SuperTest; dbAdapter: PgAdapter; - dir: DirResult; }) { testRealm = args.testRealm; request = args.request; dbAdapter = args.dbAdapter; - dir = args.dir; } - hooks.beforeEach(async function () { - dir = dirSync(); - copySync(join(__dirname, '..', 'cards'), dir.name); - }); - module('permissions requests', function (hooks) { setupPermissionedRealmCached(hooks, { - fileSystem: {}, + fixture: 'blank', permissions: { mary: ['read', 'write', 'realm-owner'], bob: ['read', 'write'], diff --git a/packages/realm-server/tests/realm-endpoints/search-test.ts b/packages/realm-server/tests/realm-endpoints/search-test.ts index 88951a82ae5..c5ec4822dd1 100644 --- a/packages/realm-server/tests/realm-endpoints/search-test.ts +++ b/packages/realm-server/tests/realm-endpoints/search-test.ts @@ -58,7 +58,13 @@ module(`realm-endpoints/${basename(__filename)}`, function () { let query = () => buildPersonQuery('Mango'); module('public readable realm', function (hooks) { + // Uses `realistic` because tests in this module depend on + // multiple Person instances (pagination), FileDef instances + // beyond person.gts (file-meta queries), and the kitchen-sink + // content variety (sparse-fieldsets backward-compat). Sibling + // modules below only ever query for Mango and stay on `simple`. setupPermissionedRealmCached(hooks, { + fixture: 'realistic', permissions: { '*': ['read'], }, @@ -753,6 +759,7 @@ module(`realm-endpoints/${basename(__filename)}`, function () { module('public readable realm', function (hooks) { setupPermissionedRealmCached(hooks, { + fixture: 'simple', permissions: { '*': ['read'], }, @@ -829,6 +836,7 @@ module(`realm-endpoints/${basename(__filename)}`, function () { module('permissioned realm', function (hooks) { setupPermissionedRealmCached(hooks, { + fixture: 'simple', permissions: { john: ['read'], '@node-test_realm:localhost': ['read', 'realm-owner'], @@ -886,6 +894,7 @@ module(`realm-endpoints/${basename(__filename)}`, function () { module('search query validation', function (hooks) { setupPermissionedRealmCached(hooks, { + fixture: 'simple', permissions: { '*': ['read'], '@node-test_realm:localhost': ['read', 'realm-owner'], diff --git a/packages/realm-server/tests/realm-endpoints/user-test.ts b/packages/realm-server/tests/realm-endpoints/user-test.ts index 437659f98fd..8a22fa869ec 100644 --- a/packages/realm-server/tests/realm-endpoints/user-test.ts +++ b/packages/realm-server/tests/realm-endpoints/user-test.ts @@ -1,9 +1,7 @@ import { module, test } from 'qunit'; import type { Test, SuperTest } from 'supertest'; -import { join, basename } from 'path'; +import { basename } from 'path'; import type { Server } from 'http'; -import { dirSync, type DirResult } from 'tmp'; -import { copySync } from 'fs-extra'; import type { Realm } from '@cardstack/runtime-common'; import { setupPermissionedRealmCached, @@ -28,7 +26,6 @@ module(`realm-endpoints/${basename(__filename)}`, function () { let testRealm: Realm; let testRealmHttpServer: Server; let request: SuperTest; - let dir: DirResult; let dbAdapter: PgAdapter; let originalLowCreditThreshold: string | undefined; @@ -37,20 +34,16 @@ module(`realm-endpoints/${basename(__filename)}`, function () { testRealmHttpServer: Server; request: SuperTest; dbAdapter: PgAdapter; - dir: DirResult; }) { testRealm = args.testRealm; testRealmHttpServer = args.testRealmHttpServer; request = args.request; dbAdapter = args.dbAdapter; - dir = args.dir; } hooks.beforeEach(async function () { originalLowCreditThreshold = process.env.LOW_CREDIT_THRESHOLD; process.env.LOW_CREDIT_THRESHOLD = '2000'; - dir = dirSync(); - copySync(join(__dirname, '..', 'cards'), dir.name); }); hooks.afterEach(async function () { @@ -64,6 +57,7 @@ module(`realm-endpoints/${basename(__filename)}`, function () { }); setupPermissionedRealmCached(hooks, { + fixture: 'blank', permissions: { john: ['read', 'write'], '@node-test_realm:localhost': ['read', 'realm-owner'], @@ -450,7 +444,6 @@ module(`realm-endpoints/${basename(__filename)}`, function () { let testRealm: Realm; let testRealmHttpServer: Server; let request: SuperTest; - let dir: DirResult; let dbAdapter: PgAdapter; let originalLowCreditThreshold: string | undefined; @@ -459,20 +452,16 @@ module(`realm-endpoints/${basename(__filename)}`, function () { testRealmHttpServer: Server; request: SuperTest; dbAdapter: PgAdapter; - dir: DirResult; }) { testRealm = args.testRealm; testRealmHttpServer = args.testRealmHttpServer; request = args.request; dbAdapter = args.dbAdapter; - dir = args.dir; } hooks.beforeEach(async function () { originalLowCreditThreshold = process.env.LOW_CREDIT_THRESHOLD; process.env.LOW_CREDIT_THRESHOLD = '2000'; - dir = dirSync(); - copySync(join(__dirname, '..', 'cards'), dir.name); }); hooks.afterEach(async function () { @@ -486,6 +475,7 @@ module(`realm-endpoints/${basename(__filename)}`, function () { }); setupPermissionedRealmCached(hooks, { + fixture: 'blank', permissions: { john: ['read', 'write'], '@node-test_realm:localhost': ['read', 'realm-owner'],