create employee table
This commit is contained in:
@@ -66,13 +66,26 @@ func setStatus(t *testing.T, pool *pgxpool.Pool, userID, status string) {
|
||||
}
|
||||
}
|
||||
|
||||
// seededUser is the demo user the fixture loads into the test database.
|
||||
// seededUser is the demo ADMINISTRATOR the fixture loads into the test
|
||||
// database.
|
||||
//
|
||||
// The role is now part of the question. The fixture used to hold one account,
|
||||
// so "the seeded user" and "the administrator" were the same row and ordering
|
||||
// by date was enough to find it. It holds two since the Employer console gained
|
||||
// somebody to sign in as, both created on the same seeded date, which left the
|
||||
// tiebreak to a deterministic UUID — and picked the employer. Tests that assert
|
||||
// an administrator's access were then asserting an employer's, and failed
|
||||
// exactly as they should have.
|
||||
//
|
||||
// So it asks for what it means. Ordering is kept beneath the filter for the
|
||||
// case of several administrators.
|
||||
func seededUser(t *testing.T, pool *pgxpool.Pool) (id, email string) {
|
||||
t.Helper()
|
||||
if err := pool.QueryRow(context.Background(),
|
||||
`SELECT id::text, email::text FROM users ORDER BY created_date, id LIMIT 1`).
|
||||
`SELECT id::text, email::text FROM users WHERE role = 'admin'
|
||||
ORDER BY created_date, id LIMIT 1`).
|
||||
Scan(&id, &email); err != nil {
|
||||
t.Fatalf("read the seeded user: %v", err)
|
||||
t.Fatalf("read the seeded administrator: %v", err)
|
||||
}
|
||||
return id, email
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user