Skip to content

Commit b389aa5

Browse files
committed
test: type the read options in the new organization pins
Claude-Session: https://claude.ai/code/session_01FzQy26KznSa5j2gnf3AzsE Co-authored-by: Claude <noreply@anthropic.com>
1 parent d564b21 commit b389aa5

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

‎packages/plugins/plugin-approvals/src/approval-notification-body.integration.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ describe('every approval notification carries its text in body', () => {
280280
it("[#23284] every notification carries its request's organization, read back from the stored request", async () => {
281281
const stored = new Map<string, string | null>();
282282
for (const id of Object.values(ids)) {
283-
const row: any = await engine.findOne('sys_approval_request', { where: { id }, fields: ['id', 'organization_id'] } as any, { context: SYSTEM } as any);
283+
const row = await engine.findOne('sys_approval_request', { where: { id }, fields: ['id', 'organization_id'] }, { context: SYSTEM });
284284
stored.set(id, row?.organization_id ?? null);
285285
}
286286
// The fixture really is two organizations, and each request landed in its

‎packages/services/service-messaging/src/notification-organization-follows-event.integration.test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@
3535

3636
import { describe, it, expect, afterEach } from 'vitest';
3737
import { ObjectQL } from '@objectstack/objectql';
38+
import type { ExecutionContext } from '@objectstack/spec/kernel';
3839
import { SqlDriver } from '@objectstack/driver-sql';
3940
import { SysNotification } from '@objectstack/platform-objects';
4041
import { MessagingService, NOTIFICATION_EVENT_OBJECT } from './messaging-service.js';
4142
import { createInboxChannel, INBOX_OBJECT, RECEIPT_OBJECT } from './inbox-channel.js';
4243
import { SqlNotificationOutbox, DELIVERY_OBJECT } from './sql-outbox.js';
4344
import { InboxMessage, NotificationDelivery, NotificationPreference, NotificationReceipt } from './objects/index.js';
4445

45-
const SYSTEM = { context: { isSystem: true } } as const;
46+
const SYSTEM = { context: { isSystem: true } as ExecutionContext };
4647

4748
const SYS_ORGANIZATION = { name: 'sys_organization', label: 'Organization', fields: { name: { type: 'text', label: 'Name' } } };
4849
const SYS_USER = { name: 'sys_user', label: 'User', fields: { name: { type: 'text', label: 'Name' } } };
@@ -67,15 +68,15 @@ async function boot(organizations: readonly string[]): Promise<ObjectQL> {
6768
}
6869
await ql.syncSchemas();
6970
ql.setTenancyPostureProvider(() => 'single');
70-
for (const id of organizations) await ql.insert('sys_organization', { id, name: id }, SYSTEM as any);
71-
await ql.insert('sys_user', { id: 'user_1', name: 'Recipient' }, SYSTEM as any);
71+
for (const id of organizations) await ql.insert('sys_organization', { id, name: id }, SYSTEM);
72+
await ql.insert('sys_user', { id: 'user_1', name: 'Recipient' }, SYSTEM);
7273
engine = ql;
7374
return ql;
7475
}
7576

7677
async function organizationsOf(ql: ObjectQL, object: string): Promise<string[]> {
77-
const rows = (await ql.find(object, { fields: ['id', 'organization_id'] } as any, SYSTEM as any)) ?? [];
78-
return rows.map((r: any) => r.organization_id ?? 'NULL');
78+
const rows = (await ql.find(object, { fields: ['id', 'organization_id'] }, SYSTEM)) ?? [];
79+
return rows.map((r: Record<string, unknown>) => String(r.organization_id ?? 'NULL'));
7980
}
8081

8182
const EMIT = { topic: 'sweep.breach', audience: ['user_1'], payload: { title: 'Breach', body: 'An SLA was breached.' } };

0 commit comments

Comments
 (0)