-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathorganization-create.request.spec.ts
More file actions
37 lines (29 loc) · 1.39 KB
/
organization-create.request.spec.ts
File metadata and controls
37 lines (29 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { OrganizationCreateRequest } from "./organization-create.request";
import { OrganizationKeysRequest } from "./organization-keys.request";
describe("OrganizationCreateRequest", () => {
const validKey = "encrypted-org-key";
const validKeys = new OrganizationKeysRequest("public-key", "encrypted-private-key");
const validCollectionName = "encrypted-collection-name";
it("should create a request with valid key parameters", () => {
const request = new OrganizationCreateRequest(validKey, validKeys, validCollectionName);
expect(request.key).toBe(validKey);
expect(request.keys).toBe(validKeys);
expect(request.collectionName).toBe(validCollectionName);
});
it("should inherit validation from parent class", () => {
expect(() => new OrganizationCreateRequest("", validKeys, validCollectionName)).toThrow(
"Organization key is required",
);
expect(() => new OrganizationCreateRequest(validKey, null!, validCollectionName)).toThrow(
"Organization keys are required",
);
expect(() => new OrganizationCreateRequest(validKey, validKeys, "")).toThrow(
"Collection name is required",
);
});
it("should allow setting payment fields after construction", () => {
const request = new OrganizationCreateRequest(validKey, validKeys, validCollectionName);
request.paymentToken = "token";
expect(request.paymentToken).toBe("token");
});
});