Skip to content

Commit 319724f

Browse files
committed
test(bigquery): assert the body project id unconditionally
Eighth instance of the vacuous-assertion pattern, found by auditing my own if-guarded expects. The body check was wrapped in if (serialized?.includes('projectId')), so it stopped verifying the moment a body dropped the field — the assertion guarded itself out of existence. All three tools carry projectId in defaultDataset, tableReference or datasetReference, so requiring it is correct. Verified: removing projectId from query.ts's body now fails two assertions where it previously passed silently.
1 parent 41c6b02 commit 319724f

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

apps/sim/tools/google_bigquery/path_safety.test.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,16 @@ describe('projectId agrees between URL and body', () => {
159159

160160
expect(url.pathname).toContain('/projects/123456')
161161
const serialized = JSON.stringify(body)
162-
if (serialized?.includes('projectId')) {
163-
expect(serialized).toContain('"projectId":"123456"')
164-
}
162+
163+
/**
164+
* Asserted unconditionally. Guarding this with
165+
* `if (serialized?.includes('projectId'))` would silently stop checking the
166+
* moment a body dropped the field — the same vacuous-assertion shape this
167+
* suite has had to fix repeatedly. All three tools carry `projectId` in
168+
* `defaultDataset` / `tableReference` / `datasetReference`, so requiring it
169+
* is correct, and if one ever stops the test should say so.
170+
*/
171+
expect(serialized).toContain('"projectId":"123456"')
165172
})
166173

167174
it.each(BODY_TOOLS)('$name sends one project id', ({ tool }) => {
@@ -181,9 +188,7 @@ describe('projectId agrees between URL and body', () => {
181188

182189
expect(url.pathname).toContain('/projects/my-project/')
183190
expect(serialized).not.toContain(' my-project ')
184-
if (serialized?.includes('projectId')) {
185-
expect(serialized).toContain('"projectId":"my-project"')
186-
}
191+
expect(serialized).toContain('"projectId":"my-project"')
187192
})
188193
})
189194

0 commit comments

Comments
 (0)