Skip to content

Commit f85dc7c

Browse files
committed
test(nip66): query event_tags table in 30166 integration assertion
Knex already parses jsonb event_tags as an array; JSON.parse on that value caused CI failures. Assert the d tag via the event_tags table instead.
1 parent 4b536ab commit f85dc7c

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

‎test/integration/features/nip-66/nip-66.feature.ts‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,13 @@ Then('the snapshot uses the configured relay URL as its probe target', function
192192
})
193193

194194
Then('a kind 30166 event is stored for the monitor identity', async function () {
195-
const rows = await getMasterDbClient()('events')
196-
.where('event_kind', EventKinds.RELAY_DISCOVERY)
197-
.where('event_pubkey', Buffer.from(MONITOR_PUBKEY, 'hex'))
198-
199-
expect(rows).to.have.length(1)
200-
201-
const tags = JSON.parse(rows[0].event_tags)
202-
expect(tags).to.deep.include(['d', `${INTEGRATION_RELAY_URL}/`])
195+
const tagRows = await getMasterDbClient()('event_tags')
196+
.join('events', 'events.event_id', 'event_tags.event_id')
197+
.where('events.event_kind', EventKinds.RELAY_DISCOVERY)
198+
.where('events.event_pubkey', Buffer.from(MONITOR_PUBKEY, 'hex'))
199+
.where('event_tags.tag_name', 'd')
200+
.select('event_tags.tag_name', 'event_tags.tag_value')
201+
202+
expect(tagRows).to.have.length(1)
203+
expect(tagRows[0].tag_value).to.equal(`${INTEGRATION_RELAY_URL}/`)
203204
})

0 commit comments

Comments
 (0)