-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: prevent Logion Identity LOC creation if identity fields are mis…
- Loading branch information
1 parent
bb0e608
commit 0c28de5
Showing
2 changed files
with
32 additions
and
3 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
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 |
---|---|---|
|
@@ -12,6 +12,7 @@ import { | |
VoidInfo, | ||
LocType | ||
} from "../../../src/logion/model/locrequest.model"; | ||
import { UserIdentity } from "../../../src/logion/model/useridentity"; | ||
|
||
describe("LocRequestFactory", () => { | ||
|
||
|
@@ -85,19 +86,32 @@ describe("LocRequestFactory", () => { | |
|
||
it("creates an open Identity LOC with no requester", () => { | ||
givenRequestId(uuid()); | ||
const description = createDescription('Identity'); | ||
const userIdentity = { | ||
firstName: "Scott", | ||
lastName: "Tiger", | ||
email: "[email protected]", | ||
phoneNumber: "+789" | ||
}; | ||
const description = createDescription('Identity', undefined, undefined, userIdentity); | ||
givenLocDescription(description); | ||
whenCreatingOpenLoc(); | ||
}); | ||
|
||
function createDescription(locType: LocType, requesterAddress?: string, requesterIdentityLoc?: string): LocRequestDescription { | ||
it("fails to create an open Identity LOC with no requester when identity is missing", () => { | ||
givenRequestId(uuid()); | ||
const description = createDescription('Identity'); | ||
givenLocDescription(description); | ||
expect(() => whenCreatingOpenLoc()).toThrowError(); | ||
}); | ||
|
||
function createDescription(locType: LocType, requesterAddress?: string, requesterIdentityLoc?: string, userIdentity?: UserIdentity): LocRequestDescription { | ||
return { | ||
requesterAddress, | ||
requesterIdentityLoc, | ||
ownerAddress: ALICE, | ||
description: "Mrs ALice, I want to sell my last art work", | ||
createdOn: moment().toISOString(), | ||
userIdentity: undefined, | ||
userIdentity, | ||
locType | ||
}; | ||
} | ||
|