Skip to content

Commit 9fcf4a2

Browse files
committed
test: drop or tighten assertions that could not fail
- delegation: the read-only replacement case decided its filter by scanning bound params in a fake DB; no real-boundary check exists, so it is dropped with the fake's filter - Twilio: assert how many recordings requests were sent, so an empty loop cannot pass - Pi: the removed-model case restated the absent-from-catalog case
1 parent 8369595 commit 9fcf4a2

3 files changed

Lines changed: 17 additions & 47 deletions

File tree

‎apps/sim/lib/mothership/chat/delegation.test.ts‎

Lines changed: 7 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,13 @@ function database() {
6565
if (!locked) throw new Error('Read before acquiring the user lock')
6666
return {
6767
from: () => ({
68-
where: (condition: SQL) => {
69-
const query = dialect.sqlToQuery(condition)
70-
// Only the access filter binds 'write'; the other predicates bind ids, names and dates.
71-
const writeOnly = query.params.includes('write')
72-
return {
73-
limit: async () => {
74-
const row = rows.get(name)
75-
if (!row || row.expiresAt.getTime() <= Date.now() + 30 * 60_000) return []
76-
return writeOnly && row.access === 'read' ? [] : [row]
77-
},
78-
}
79-
},
68+
where: () => ({
69+
limit: async () => {
70+
const row = rows.get(name)
71+
if (!row || row.expiresAt.getTime() <= Date.now() + 30 * 60_000) return []
72+
return [row]
73+
},
74+
}),
8075
}),
8176
}
8277
},
@@ -161,22 +156,6 @@ describe('delegation key concurrency', () => {
161156
expect(db.rows.get('mothership-delegation:alice')).toBe(old)
162157
})
163158

164-
it('replaces a read-only key instead of handing it to the CLI', async () => {
165-
const db = database()
166-
db.rows.set('mothership-delegation:actor', {
167-
id: 'read-key',
168-
name: 'mothership-delegation:actor',
169-
key: 'encrypted-read-only',
170-
expiresAt: new Date(Date.now() + 6 * 60 * 60_000),
171-
access: 'read',
172-
})
173-
expect(await mintDelegationToken({ workspaceId: 'shared', userId: 'actor' })).toBe('plain-1')
174-
expect(db.rows.get('mothership-delegation:actor')).toMatchObject({
175-
key: 'encrypted-1',
176-
access: 'write',
177-
})
178-
})
179-
180159
it('does not log bound credential values from database errors', async () => {
181160
mocks.transaction.mockRejectedValue(
182161
new Error('Failed query params: plaintext-key, encrypted-key')

‎apps/sim/providers/pi-providers.test.ts‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,6 @@ describe('Pi provider catalog', () => {
3232
)
3333
})
3434

35-
it('rejects saved model IDs removed by Pi without substituting another model', () => {
36-
expect(resolvePiModelId('anthropic', 'claude-opus-4-1')).toBeUndefined()
37-
expect(resolvePiModelId('cerebras', 'cerebras/zai-glm-4.7')).toBeUndefined()
38-
expect(resolvePiModelId('zai', 'glm-5.1')).toBeUndefined()
39-
expect(resolvePiModelId('zai', 'glm-4.5-air')).toBeUndefined()
40-
expect(resolvePiModelId('mistral', 'mistral-large-2411')).toBeUndefined()
41-
expect(resolvePiModelId('mistral', 'devstral-small-2507')).toBeUndefined()
42-
expect(resolvePiModelId('mistral', 'devstral-medium-2507')).toBeUndefined()
43-
expect(resolvePiModelId('nvidia', 'nvidia/nemotron-3-super-120b-a12b')).toBeUndefined()
44-
})
45-
4635
it('rejects provider/model pairs absent from the installed Pi catalog', () => {
4736
expect(resolvePiModelId('anthropic', 'claude-sonnet-999')).toBeUndefined()
4837
expect(resolvePiModelId('zai', 'glm-4.5-air-unknown')).toBeUndefined()

‎apps/sim/tools/twilio_voice/list_calls.test.ts‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,17 @@ describe('Twilio list calls recordings lookup', () => {
4141
fetchMock.mockImplementation(async () => jsonResponse({ recordings: [{ sid: 'RE1' }] }))
4242
})
4343

44-
it.each(['@evil.test/x', '//evil.test/x', 'https://evil.test/x'])(
45-
'never sends the saved credentials off the Twilio API origin for %s',
46-
async (path) => {
47-
await listCalls([path])
48-
for (const [url] of fetchMock.mock.calls) {
49-
expect(new URL(String(url)).origin).toBe('https://api.twilio.com')
50-
}
44+
it.each([
45+
['@evil.test/x', 1],
46+
['//evil.test/x', 0],
47+
['https://evil.test/x', 0],
48+
])('never sends the saved credentials off the Twilio API origin for %s', async (path, calls) => {
49+
await listCalls([path])
50+
expect(fetchMock).toHaveBeenCalledTimes(calls)
51+
for (const [url] of fetchMock.mock.calls) {
52+
expect(new URL(String(url)).origin).toBe('https://api.twilio.com')
5153
}
52-
)
54+
})
5355

5456
it('fetches recordings for Twilio-relative paths', async () => {
5557
const result = await listCalls(['/2010-04-01/Accounts/AC123/Calls/CA0/Recordings.json'])

0 commit comments

Comments
 (0)