Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
unit(manager): ensure retrieval can be done
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Nov 23, 2022
1 parent cea3114 commit 9a54926
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions database/managers/user.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import type { RawBulkDataForStudents, RawBulkDataForEmployees } from "%/types/in
import compare from "$!/auth/compare"
import convertTimeToMinutes from "$/time/convert_time_to_minutes"

import { RESET_PASSWORD } from "$/permissions/user_combinations"
import { user as permissionGroup } from "$/permissions/permission_list"

import Model from "%/models/user"
import AttachedRole from "%/models/attached_role"
import StudentDetail from "%/models/student_detail"
Expand Down Expand Up @@ -157,6 +160,20 @@ describe("Database Manager: User read operations", () => {
expect(users).toHaveProperty("data")
expect(users.data).toHaveLength(1)
})

it("can get user that can reset password", async() => {
const manager = new Manager()
const resetterRole = await new RoleFactory()
.userFlags(permissionGroup.generateMask(...RESET_PASSWORD))
.insertOne()
const model = await new Factory().attach(resetterRole).insertOne()

const users = await manager.retrieveResetterEmails()

expect(users).toHaveProperty("data")
expect(users.data).toHaveLength(1)
expect(users).toHaveProperty("data.0.attributes.email", model.email)
})
})

describe("Database Manager: User create operations", () => {
Expand Down

0 comments on commit 9a54926

Please sign in to comment.