chore(tests): add tester user to prisma seed for cross-user isolation tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
db85d4b49e
commit
0be3052f97
1 changed files with 20 additions and 0 deletions
|
|
@ -63,6 +63,26 @@ async function main() {
|
|||
|
||||
console.log(`Main user: ${user.username} (id: ${user.id})`)
|
||||
|
||||
// Create tester user for cross-user isolation tests (no products)
|
||||
const testerHash = await bcrypt.hash('tester123', 12)
|
||||
const tester = await prisma.user.upsert({
|
||||
where: { username: 'tester' },
|
||||
update: {},
|
||||
create: {
|
||||
username: 'tester',
|
||||
password_hash: testerHash,
|
||||
is_demo: false,
|
||||
roles: {
|
||||
create: [
|
||||
{ role: 'PRODUCT_OWNER' },
|
||||
{ role: 'DEVELOPER' },
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
console.log(`Tester user: ${tester.username} (id: ${tester.id})`)
|
||||
|
||||
// Reset demo product data — delete in dependency order to avoid FK violations
|
||||
const existingProducts = await prisma.product.findMany({ where: { user_id: demo.id }, select: { id: true } })
|
||||
for (const p of existingProducts) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue