generated from CodrJS/ts-jsr-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
document Group, update Base, add tests
- Loading branch information
DylanBulmer
committed
Jul 26, 2024
1 parent
861bb98
commit 07ab24f
Showing
6 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// export * as Types from "./types/mod.ts"; | ||
export * from "./models/mod.ts"; | ||
export type { JwtPayload } from "./types/mod.ts"; | ||
export { type JwtPayload, UserTypeCode } from "./types/mod.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { assert, assertEquals } from "@std/assert"; | ||
import { Profile } from "../mod.ts"; | ||
import { ObjectId } from "bson"; | ||
|
||
Deno.test("Create Profile", function createProfile() { | ||
const userId: ObjectId = new ObjectId(); | ||
const createdBy: ObjectId = new ObjectId(); | ||
const profile = new Profile({ | ||
userId: userId, | ||
name: { first: "Demo", last: "User" }, | ||
username: "DemoUser", | ||
createdBy, | ||
}); | ||
|
||
assertEquals(profile.toJSON().name.first, "Demo"); | ||
assertEquals(profile.toJSON().name.last, "User"); | ||
assertEquals(profile.toJSON().username, "DemoUser"); | ||
assert(profile.toJSON().userId.equals(userId)); | ||
assert(profile.toJSON().createdBy.equals(createdBy)); | ||
assert(profile.toJSON().updatedBy.equals(createdBy)); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { assert, assertEquals } from "@std/assert"; | ||
import { User, UserTypeCode } from "../mod.ts"; | ||
import { ObjectId } from "bson"; | ||
|
||
Deno.test("Create User", function createUser() { | ||
const orgId: ObjectId = new ObjectId(); | ||
const roleId: ObjectId = new ObjectId(); | ||
const createdBy: ObjectId = new ObjectId(); | ||
const user = new User({ | ||
organizationId: orgId, | ||
identityId: "identity_id", | ||
type: UserTypeCode.Member, | ||
email: "[email protected]", | ||
roles: [roleId], | ||
flags: { | ||
isActive: true, | ||
isAnonymous: false, | ||
isDeleted: false, | ||
}, | ||
createdBy, | ||
}); | ||
|
||
assertEquals(user.toJSON().email, "[email protected]"); | ||
assertEquals(user.toJSON().flags.isActive, true); | ||
assertEquals(user.toJSON().flags.isDeleted, false); | ||
assertEquals(user.toJSON().flags.isAnonymous, false); | ||
assert(user.toJSON().organizationId.equals(orgId)); | ||
assert(user.toJSON().roles[0].equals(roleId)); | ||
assert(user.toJSON().createdBy.equals(createdBy)); | ||
assert(user.toJSON().updatedBy.equals(createdBy)); | ||
}); |