Skip to content

Commit 485d920

Browse files
nshkiCopilot
andcommitted
test(hub): verify Build number uniqueness
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: b60c01ad-40e3-4341-a27c-c1bff63a1ff0
1 parent ee0c272 commit 485d920

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

‎hub/test/database/prototype-build-status-migration/index.db.test.ts‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,19 @@ describe("prototype Build status migration", () => {
125125
VALUES ($1, $2, 1, 'successful')`,
126126
[buildId, firstPrototypeId],
127127
)
128+
const otherBuildId = randomUUID()
129+
await expect(
130+
database.query(
131+
`INSERT INTO builds (id, prototype_id, number, state)
132+
VALUES ($1, $2, 1, 'successful')`,
133+
[otherBuildId, firstPrototypeId],
134+
),
135+
).rejects.toMatchObject({ code: "23505" })
136+
await database.query(
137+
`INSERT INTO builds (id, prototype_id, number, state)
138+
VALUES ($1, $2, 1, 'successful')`,
139+
[otherBuildId, secondPrototypeId],
140+
)
128141
const assigned = await database.query(
129142
`UPDATE prototypes SET current_build_id = $1 WHERE id = $2
130143
RETURNING current_build_id`,

0 commit comments

Comments
 (0)