@powerhousedao/vetra-builder-package 5.2.0-dev.31 → 5.2.0-dev.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/document-models/builder-account/v1/actions.d.ts +7 -7
- package/dist/document-models/builder-account/v1/actions.d.ts.map +1 -1
- package/dist/document-models/builder-account/v1/gen/controller.d.ts +1 -1
- package/dist/document-models/builder-account/v1/gen/controller.d.ts.map +1 -1
- package/dist/document-models/builder-account/v1/gen/reducer.d.ts +1 -1
- package/dist/document-models/builder-account/v1/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/builder-account/v1/gen/utils.d.ts +8 -8
- package/dist/document-models/builder-account/v1/gen/utils.d.ts.map +1 -1
- package/dist/document-models/builder-account/v1/utils.d.ts +8 -8
- package/dist/document-models/builder-team/actions.d.ts +7 -7
- package/dist/document-models/builder-team/actions.d.ts.map +1 -1
- package/dist/document-models/builder-team/gen/reducer.d.ts +1 -1
- package/dist/document-models/builder-team/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/builder-team/gen/utils.d.ts +8 -8
- package/dist/document-models/builder-team/gen/utils.d.ts.map +1 -1
- package/dist/document-models/builder-team/utils.d.ts +8 -8
- package/dist/document-models/builder-team/v1/actions.d.ts +7 -7
- package/dist/document-models/builder-team/v1/actions.d.ts.map +1 -1
- package/dist/document-models/builder-team/v1/gen/controller.d.ts +1 -1
- package/dist/document-models/builder-team/v1/gen/controller.d.ts.map +1 -1
- package/dist/document-models/builder-team/v1/gen/reducer.d.ts +1 -1
- package/dist/document-models/builder-team/v1/gen/reducer.d.ts.map +1 -1
- package/dist/document-models/builder-team/v1/gen/utils.d.ts +8 -8
- package/dist/document-models/builder-team/v1/gen/utils.d.ts.map +1 -1
- package/dist/document-models/builder-team/v1/utils.d.ts +8 -8
- package/package.json +16 -16
- package/dist/document-models/builder-account/v1/tests/document-model.test.d.ts +0 -10
- package/dist/document-models/builder-account/v1/tests/document-model.test.d.ts.map +0 -1
- package/dist/document-models/builder-account/v1/tests/document-model.test.js +0 -104
- package/dist/document-models/builder-account/v1/tests/members.test.d.ts +0 -2
- package/dist/document-models/builder-account/v1/tests/members.test.d.ts.map +0 -1
- package/dist/document-models/builder-account/v1/tests/members.test.js +0 -25
- package/dist/document-models/builder-account/v1/tests/packages.test.d.ts +0 -2
- package/dist/document-models/builder-account/v1/tests/packages.test.d.ts.map +0 -1
- package/dist/document-models/builder-account/v1/tests/packages.test.js +0 -55
- package/dist/document-models/builder-account/v1/tests/profile.test.d.ts +0 -2
- package/dist/document-models/builder-account/v1/tests/profile.test.d.ts.map +0 -1
- package/dist/document-models/builder-account/v1/tests/profile.test.js +0 -55
- package/dist/document-models/builder-account/v1/tests/spaces.test.d.ts +0 -2
- package/dist/document-models/builder-account/v1/tests/spaces.test.d.ts.map +0 -1
- package/dist/document-models/builder-account/v1/tests/spaces.test.js +0 -55
- package/dist/document-models/builder-team/src/tests/document-model.test.d.ts +0 -10
- package/dist/document-models/builder-team/src/tests/document-model.test.d.ts.map +0 -1
- package/dist/document-models/builder-team/src/tests/document-model.test.js +0 -104
- package/dist/document-models/builder-team/src/tests/member.test.d.ts +0 -2
- package/dist/document-models/builder-team/src/tests/member.test.d.ts.map +0 -1
- package/dist/document-models/builder-team/src/tests/member.test.js +0 -35
- package/dist/document-models/builder-team/src/tests/packages.test.d.ts +0 -2
- package/dist/document-models/builder-team/src/tests/packages.test.d.ts.map +0 -1
- package/dist/document-models/builder-team/src/tests/packages.test.js +0 -45
- package/dist/document-models/builder-team/src/tests/profile.test.d.ts +0 -2
- package/dist/document-models/builder-team/src/tests/profile.test.d.ts.map +0 -1
- package/dist/document-models/builder-team/src/tests/profile.test.js +0 -55
- package/dist/document-models/builder-team/src/tests/spaces.test.d.ts +0 -2
- package/dist/document-models/builder-team/src/tests/spaces.test.d.ts.map +0 -1
- package/dist/document-models/builder-team/src/tests/spaces.test.js +0 -45
- package/dist/document-models/builder-team/v1/tests/document-model.test.d.ts +0 -10
- package/dist/document-models/builder-team/v1/tests/document-model.test.d.ts.map +0 -1
- package/dist/document-models/builder-team/v1/tests/document-model.test.js +0 -104
- package/dist/document-models/builder-team/v1/tests/member.test.d.ts +0 -2
- package/dist/document-models/builder-team/v1/tests/member.test.d.ts.map +0 -1
- package/dist/document-models/builder-team/v1/tests/member.test.js +0 -35
- package/dist/document-models/builder-team/v1/tests/packages.test.d.ts +0 -2
- package/dist/document-models/builder-team/v1/tests/packages.test.d.ts.map +0 -1
- package/dist/document-models/builder-team/v1/tests/packages.test.js +0 -45
- package/dist/document-models/builder-team/v1/tests/profile.test.d.ts +0 -2
- package/dist/document-models/builder-team/v1/tests/profile.test.d.ts.map +0 -1
- package/dist/document-models/builder-team/v1/tests/profile.test.js +0 -55
- package/dist/document-models/builder-team/v1/tests/spaces.test.d.ts +0 -2
- package/dist/document-models/builder-team/v1/tests/spaces.test.d.ts.map +0 -1
- package/dist/document-models/builder-team/v1/tests/spaces.test.js +0 -45
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { generateMock } from "@powerhousedao/common/utils";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { reducer, utils, isBuilderAccountDocument, setLogo, setProfileName, setSlug, setProfileDescription, updateSocials, SetLogoInputSchema, SetProfileNameInputSchema, SetSlugInputSchema, SetProfileDescriptionInputSchema, UpdateSocialsInputSchema, } from "@powerhousedao/vetra-builder-package/document-models/builder-account/v1";
|
|
4
|
-
describe("ProfileOperations", () => {
|
|
5
|
-
it("should handle setLogo operation", () => {
|
|
6
|
-
const document = utils.createDocument();
|
|
7
|
-
const input = generateMock(SetLogoInputSchema());
|
|
8
|
-
const updatedDocument = reducer(document, setLogo(input));
|
|
9
|
-
expect(isBuilderAccountDocument(updatedDocument)).toBe(true);
|
|
10
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
11
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_LOGO");
|
|
12
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
13
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
14
|
-
});
|
|
15
|
-
it("should handle setProfileName operation", () => {
|
|
16
|
-
const document = utils.createDocument();
|
|
17
|
-
const input = generateMock(SetProfileNameInputSchema());
|
|
18
|
-
const updatedDocument = reducer(document, setProfileName(input));
|
|
19
|
-
expect(isBuilderAccountDocument(updatedDocument)).toBe(true);
|
|
20
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
21
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_PROFILE_NAME");
|
|
22
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
23
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
24
|
-
});
|
|
25
|
-
it("should handle setSlug operation", () => {
|
|
26
|
-
const document = utils.createDocument();
|
|
27
|
-
const input = generateMock(SetSlugInputSchema());
|
|
28
|
-
const updatedDocument = reducer(document, setSlug(input));
|
|
29
|
-
expect(isBuilderAccountDocument(updatedDocument)).toBe(true);
|
|
30
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
31
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_SLUG");
|
|
32
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
33
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
34
|
-
});
|
|
35
|
-
it("should handle setProfileDescription operation", () => {
|
|
36
|
-
const document = utils.createDocument();
|
|
37
|
-
const input = generateMock(SetProfileDescriptionInputSchema());
|
|
38
|
-
const updatedDocument = reducer(document, setProfileDescription(input));
|
|
39
|
-
expect(isBuilderAccountDocument(updatedDocument)).toBe(true);
|
|
40
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
41
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_PROFILE_DESCRIPTION");
|
|
42
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
43
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
44
|
-
});
|
|
45
|
-
it("should handle updateSocials operation", () => {
|
|
46
|
-
const document = utils.createDocument();
|
|
47
|
-
const input = generateMock(UpdateSocialsInputSchema());
|
|
48
|
-
const updatedDocument = reducer(document, updateSocials(input));
|
|
49
|
-
expect(isBuilderAccountDocument(updatedDocument)).toBe(true);
|
|
50
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
51
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_SOCIALS");
|
|
52
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
53
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spaces.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-account/v1/tests/spaces.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { generateMock } from "@powerhousedao/common/utils";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { reducer, utils, isBuilderAccountDocument, addSpace, deleteSpace, setSpaceTitle, setSpaceDescription, reorderSpaces, AddSpaceInputSchema, DeleteSpaceInputSchema, SetSpaceTitleInputSchema, SetSpaceDescriptionInputSchema, ReorderSpacesInputSchema, } from "@powerhousedao/vetra-builder-package/document-models/builder-account/v1";
|
|
4
|
-
describe("SpacesOperations", () => {
|
|
5
|
-
it("should handle addSpace operation", () => {
|
|
6
|
-
const document = utils.createDocument();
|
|
7
|
-
const input = generateMock(AddSpaceInputSchema());
|
|
8
|
-
const updatedDocument = reducer(document, addSpace(input));
|
|
9
|
-
expect(isBuilderAccountDocument(updatedDocument)).toBe(true);
|
|
10
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
11
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_SPACE");
|
|
12
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
13
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
14
|
-
});
|
|
15
|
-
it("should handle deleteSpace operation", () => {
|
|
16
|
-
const document = utils.createDocument();
|
|
17
|
-
const input = generateMock(DeleteSpaceInputSchema());
|
|
18
|
-
const updatedDocument = reducer(document, deleteSpace(input));
|
|
19
|
-
expect(isBuilderAccountDocument(updatedDocument)).toBe(true);
|
|
20
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
21
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("DELETE_SPACE");
|
|
22
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
23
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
24
|
-
});
|
|
25
|
-
it("should handle setSpaceTitle operation", () => {
|
|
26
|
-
const document = utils.createDocument();
|
|
27
|
-
const input = generateMock(SetSpaceTitleInputSchema());
|
|
28
|
-
const updatedDocument = reducer(document, setSpaceTitle(input));
|
|
29
|
-
expect(isBuilderAccountDocument(updatedDocument)).toBe(true);
|
|
30
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
31
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_SPACE_TITLE");
|
|
32
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
33
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
34
|
-
});
|
|
35
|
-
it("should handle setSpaceDescription operation", () => {
|
|
36
|
-
const document = utils.createDocument();
|
|
37
|
-
const input = generateMock(SetSpaceDescriptionInputSchema());
|
|
38
|
-
const updatedDocument = reducer(document, setSpaceDescription(input));
|
|
39
|
-
expect(isBuilderAccountDocument(updatedDocument)).toBe(true);
|
|
40
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
41
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_SPACE_DESCRIPTION");
|
|
42
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
43
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
44
|
-
});
|
|
45
|
-
it("should handle reorderSpaces operation", () => {
|
|
46
|
-
const document = utils.createDocument();
|
|
47
|
-
const input = generateMock(ReorderSpacesInputSchema());
|
|
48
|
-
const updatedDocument = reducer(document, reorderSpaces(input));
|
|
49
|
-
expect(isBuilderAccountDocument(updatedDocument)).toBe(true);
|
|
50
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
51
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("REORDER_SPACES");
|
|
52
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
53
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is a scaffold file meant for customization:
|
|
3
|
-
* - change it by adding new tests or modifying the existing ones
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* This is a scaffold file meant for customization:
|
|
7
|
-
* - change it by adding new tests or modifying the existing ones
|
|
8
|
-
*/
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=document-model.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document-model.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/document-model.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;;GAGG"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is a scaffold file meant for customization:
|
|
3
|
-
* - change it by adding new tests or modifying the existing ones
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* This is a scaffold file meant for customization:
|
|
7
|
-
* - change it by adding new tests or modifying the existing ones
|
|
8
|
-
*/
|
|
9
|
-
import { describe, it, expect } from "vitest";
|
|
10
|
-
import { utils, initialGlobalState, initialLocalState, builderTeamDocumentType, isBuilderTeamDocument, assertIsBuilderTeamDocument, isBuilderTeamState, assertIsBuilderTeamState, } from "@powerhousedao/vetra-builder-package/document-models/builder-team";
|
|
11
|
-
import { ZodError } from "zod";
|
|
12
|
-
describe("BuilderTeam Document Model", () => {
|
|
13
|
-
it("should create a new BuilderTeam document", () => {
|
|
14
|
-
const document = utils.createDocument();
|
|
15
|
-
expect(document).toBeDefined();
|
|
16
|
-
expect(document.header.documentType).toBe(builderTeamDocumentType);
|
|
17
|
-
});
|
|
18
|
-
it("should create a new BuilderTeam document with a valid initial state", () => {
|
|
19
|
-
const document = utils.createDocument();
|
|
20
|
-
expect(document.state.global).toStrictEqual(initialGlobalState);
|
|
21
|
-
expect(document.state.local).toStrictEqual(initialLocalState);
|
|
22
|
-
expect(isBuilderTeamDocument(document)).toBe(true);
|
|
23
|
-
expect(isBuilderTeamState(document.state)).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
it("should reject a document that is not a BuilderTeam document", () => {
|
|
26
|
-
const wrongDocumentType = utils.createDocument();
|
|
27
|
-
wrongDocumentType.header.documentType = "the-wrong-thing-1234";
|
|
28
|
-
try {
|
|
29
|
-
expect(assertIsBuilderTeamDocument(wrongDocumentType)).toThrow();
|
|
30
|
-
expect(isBuilderTeamDocument(wrongDocumentType)).toBe(false);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
const wrongState = utils.createDocument();
|
|
37
|
-
// @ts-expect-error - we are testing the error case
|
|
38
|
-
wrongState.state.global = {
|
|
39
|
-
...{ notWhat: "you want" },
|
|
40
|
-
};
|
|
41
|
-
try {
|
|
42
|
-
expect(isBuilderTeamState(wrongState.state)).toBe(false);
|
|
43
|
-
expect(assertIsBuilderTeamState(wrongState.state)).toThrow();
|
|
44
|
-
expect(isBuilderTeamDocument(wrongState)).toBe(false);
|
|
45
|
-
expect(assertIsBuilderTeamDocument(wrongState)).toThrow();
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
49
|
-
}
|
|
50
|
-
const wrongInitialState = utils.createDocument();
|
|
51
|
-
// @ts-expect-error - we are testing the error case
|
|
52
|
-
wrongInitialState.initialState.global = {
|
|
53
|
-
...{ notWhat: "you want" },
|
|
54
|
-
};
|
|
55
|
-
try {
|
|
56
|
-
expect(isBuilderTeamState(wrongInitialState.state)).toBe(false);
|
|
57
|
-
expect(assertIsBuilderTeamState(wrongInitialState.state)).toThrow();
|
|
58
|
-
expect(isBuilderTeamDocument(wrongInitialState)).toBe(false);
|
|
59
|
-
expect(assertIsBuilderTeamDocument(wrongInitialState)).toThrow();
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
63
|
-
}
|
|
64
|
-
const missingIdInHeader = utils.createDocument();
|
|
65
|
-
// @ts-expect-error - we are testing the error case
|
|
66
|
-
delete missingIdInHeader.header.id;
|
|
67
|
-
try {
|
|
68
|
-
expect(isBuilderTeamDocument(missingIdInHeader)).toBe(false);
|
|
69
|
-
expect(assertIsBuilderTeamDocument(missingIdInHeader)).toThrow();
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
73
|
-
}
|
|
74
|
-
const missingNameInHeader = utils.createDocument();
|
|
75
|
-
// @ts-expect-error - we are testing the error case
|
|
76
|
-
delete missingNameInHeader.header.name;
|
|
77
|
-
try {
|
|
78
|
-
expect(isBuilderTeamDocument(missingNameInHeader)).toBe(false);
|
|
79
|
-
expect(assertIsBuilderTeamDocument(missingNameInHeader)).toThrow();
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
83
|
-
}
|
|
84
|
-
const missingCreatedAtUtcIsoInHeader = utils.createDocument();
|
|
85
|
-
// @ts-expect-error - we are testing the error case
|
|
86
|
-
delete missingCreatedAtUtcIsoInHeader.header.createdAtUtcIso;
|
|
87
|
-
try {
|
|
88
|
-
expect(isBuilderTeamDocument(missingCreatedAtUtcIsoInHeader)).toBe(false);
|
|
89
|
-
expect(assertIsBuilderTeamDocument(missingCreatedAtUtcIsoInHeader)).toThrow();
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
93
|
-
}
|
|
94
|
-
const missingLastModifiedAtUtcIsoInHeader = utils.createDocument();
|
|
95
|
-
// @ts-expect-error - we are testing the error case
|
|
96
|
-
delete missingLastModifiedAtUtcIsoInHeader.header.lastModifiedAtUtcIso;
|
|
97
|
-
try {
|
|
98
|
-
expect(isBuilderTeamDocument(missingLastModifiedAtUtcIsoInHeader)).toBe(false);
|
|
99
|
-
expect(assertIsBuilderTeamDocument(missingLastModifiedAtUtcIsoInHeader)).toThrow();
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"member.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/member.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { generateMock } from "@powerhousedao/codegen";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { reducer, utils, isBuilderTeamDocument, addMember, updateMemberInfo, removeMember, AddMemberInputSchema, UpdateMemberInfoInputSchema, RemoveMemberInputSchema, } from "@powerhousedao/vetra-builder-package/document-models/builder-team";
|
|
4
|
-
describe("MemberOperations", () => {
|
|
5
|
-
it("should handle addMember operation", () => {
|
|
6
|
-
const document = utils.createDocument();
|
|
7
|
-
const input = generateMock(AddMemberInputSchema());
|
|
8
|
-
const updatedDocument = reducer(document, addMember(input));
|
|
9
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
10
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
11
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_MEMBER");
|
|
12
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
13
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
14
|
-
});
|
|
15
|
-
it("should handle updateMemberInfo operation", () => {
|
|
16
|
-
const document = utils.createDocument();
|
|
17
|
-
const input = generateMock(UpdateMemberInfoInputSchema());
|
|
18
|
-
const updatedDocument = reducer(document, updateMemberInfo(input));
|
|
19
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
20
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
21
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_MEMBER_INFO");
|
|
22
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
23
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
24
|
-
});
|
|
25
|
-
it("should handle removeMember operation", () => {
|
|
26
|
-
const document = utils.createDocument();
|
|
27
|
-
const input = generateMock(RemoveMemberInputSchema());
|
|
28
|
-
const updatedDocument = reducer(document, removeMember(input));
|
|
29
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
30
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
31
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_MEMBER");
|
|
32
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
33
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packages.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/packages.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { generateMock } from "@powerhousedao/codegen";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { reducer, utils, isBuilderTeamDocument, addPackage, updatePackageInfo, removePackage, reorderPackages, AddPackageInputSchema, UpdatePackageInfoInputSchema, RemovePackageInputSchema, ReorderPackagesInputSchema, } from "@powerhousedao/vetra-builder-package/document-models/builder-team";
|
|
4
|
-
describe("PackagesOperations", () => {
|
|
5
|
-
it("should handle addPackage operation", () => {
|
|
6
|
-
const document = utils.createDocument();
|
|
7
|
-
const input = generateMock(AddPackageInputSchema());
|
|
8
|
-
const updatedDocument = reducer(document, addPackage(input));
|
|
9
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
10
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
11
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_PACKAGE");
|
|
12
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
13
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
14
|
-
});
|
|
15
|
-
it("should handle updatePackageInfo operation", () => {
|
|
16
|
-
const document = utils.createDocument();
|
|
17
|
-
const input = generateMock(UpdatePackageInfoInputSchema());
|
|
18
|
-
const updatedDocument = reducer(document, updatePackageInfo(input));
|
|
19
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
20
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
21
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_PACKAGE_INFO");
|
|
22
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
23
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
24
|
-
});
|
|
25
|
-
it("should handle removePackage operation", () => {
|
|
26
|
-
const document = utils.createDocument();
|
|
27
|
-
const input = generateMock(RemovePackageInputSchema());
|
|
28
|
-
const updatedDocument = reducer(document, removePackage(input));
|
|
29
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
30
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
31
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_PACKAGE");
|
|
32
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
33
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
34
|
-
});
|
|
35
|
-
it("should handle reorderPackages operation", () => {
|
|
36
|
-
const document = utils.createDocument();
|
|
37
|
-
const input = generateMock(ReorderPackagesInputSchema());
|
|
38
|
-
const updatedDocument = reducer(document, reorderPackages(input));
|
|
39
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
40
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
41
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("REORDER_PACKAGES");
|
|
42
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
43
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"profile.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/profile.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { generateMock } from "@powerhousedao/codegen";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { reducer, utils, isBuilderTeamDocument, setLogo, setTeamName, setSlug, setDescription, setSocials, SetLogoInputSchema, SetTeamNameInputSchema, SetSlugInputSchema, SetDescriptionInputSchema, SetSocialsInputSchema, } from "@powerhousedao/vetra-builder-package/document-models/builder-team";
|
|
4
|
-
describe("ProfileOperations", () => {
|
|
5
|
-
it("should handle setLogo operation", () => {
|
|
6
|
-
const document = utils.createDocument();
|
|
7
|
-
const input = generateMock(SetLogoInputSchema());
|
|
8
|
-
const updatedDocument = reducer(document, setLogo(input));
|
|
9
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
10
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
11
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_LOGO");
|
|
12
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
13
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
14
|
-
});
|
|
15
|
-
it("should handle setTeamName operation", () => {
|
|
16
|
-
const document = utils.createDocument();
|
|
17
|
-
const input = generateMock(SetTeamNameInputSchema());
|
|
18
|
-
const updatedDocument = reducer(document, setTeamName(input));
|
|
19
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
20
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
21
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_TEAM_NAME");
|
|
22
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
23
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
24
|
-
});
|
|
25
|
-
it("should handle setSlug operation", () => {
|
|
26
|
-
const document = utils.createDocument();
|
|
27
|
-
const input = generateMock(SetSlugInputSchema());
|
|
28
|
-
const updatedDocument = reducer(document, setSlug(input));
|
|
29
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
30
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
31
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_SLUG");
|
|
32
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
33
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
34
|
-
});
|
|
35
|
-
it("should handle setDescription operation", () => {
|
|
36
|
-
const document = utils.createDocument();
|
|
37
|
-
const input = generateMock(SetDescriptionInputSchema());
|
|
38
|
-
const updatedDocument = reducer(document, setDescription(input));
|
|
39
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
40
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
41
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_DESCRIPTION");
|
|
42
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
43
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
44
|
-
});
|
|
45
|
-
it("should handle setSocials operation", () => {
|
|
46
|
-
const document = utils.createDocument();
|
|
47
|
-
const input = generateMock(SetSocialsInputSchema());
|
|
48
|
-
const updatedDocument = reducer(document, setSocials(input));
|
|
49
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
50
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
51
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_SOCIALS");
|
|
52
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
53
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"spaces.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/src/tests/spaces.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { generateMock } from "@powerhousedao/codegen";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { reducer, utils, isBuilderTeamDocument, addSpace, updateSpaceInfo, removeSpace, reorderSpaces, AddSpaceInputSchema, UpdateSpaceInfoInputSchema, RemoveSpaceInputSchema, ReorderSpacesInputSchema, } from "@powerhousedao/vetra-builder-package/document-models/builder-team";
|
|
4
|
-
describe("SpacesOperations", () => {
|
|
5
|
-
it("should handle addSpace operation", () => {
|
|
6
|
-
const document = utils.createDocument();
|
|
7
|
-
const input = generateMock(AddSpaceInputSchema());
|
|
8
|
-
const updatedDocument = reducer(document, addSpace(input));
|
|
9
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
10
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
11
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_SPACE");
|
|
12
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
13
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
14
|
-
});
|
|
15
|
-
it("should handle updateSpaceInfo operation", () => {
|
|
16
|
-
const document = utils.createDocument();
|
|
17
|
-
const input = generateMock(UpdateSpaceInfoInputSchema());
|
|
18
|
-
const updatedDocument = reducer(document, updateSpaceInfo(input));
|
|
19
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
20
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
21
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_SPACE_INFO");
|
|
22
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
23
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
24
|
-
});
|
|
25
|
-
it("should handle removeSpace operation", () => {
|
|
26
|
-
const document = utils.createDocument();
|
|
27
|
-
const input = generateMock(RemoveSpaceInputSchema());
|
|
28
|
-
const updatedDocument = reducer(document, removeSpace(input));
|
|
29
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
30
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
31
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_SPACE");
|
|
32
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
33
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
34
|
-
});
|
|
35
|
-
it("should handle reorderSpaces operation", () => {
|
|
36
|
-
const document = utils.createDocument();
|
|
37
|
-
const input = generateMock(ReorderSpacesInputSchema());
|
|
38
|
-
const updatedDocument = reducer(document, reorderSpaces(input));
|
|
39
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
40
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
41
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("REORDER_SPACES");
|
|
42
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
43
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is a scaffold file meant for customization:
|
|
3
|
-
* - change it by adding new tests or modifying the existing ones
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* This is a scaffold file meant for customization:
|
|
7
|
-
* - change it by adding new tests or modifying the existing ones
|
|
8
|
-
*/
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=document-model.test.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document-model.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/v1/tests/document-model.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;;GAGG"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is a scaffold file meant for customization:
|
|
3
|
-
* - change it by adding new tests or modifying the existing ones
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* This is a scaffold file meant for customization:
|
|
7
|
-
* - change it by adding new tests or modifying the existing ones
|
|
8
|
-
*/
|
|
9
|
-
import { describe, it, expect } from "vitest";
|
|
10
|
-
import { utils, initialGlobalState, initialLocalState, builderTeamDocumentType, isBuilderTeamDocument, assertIsBuilderTeamDocument, isBuilderTeamState, assertIsBuilderTeamState, } from "@powerhousedao/vetra-builder-package/document-models/builder-team/v1";
|
|
11
|
-
import { ZodError } from "zod";
|
|
12
|
-
describe("BuilderTeam Document Model", () => {
|
|
13
|
-
it("should create a new BuilderTeam document", () => {
|
|
14
|
-
const document = utils.createDocument();
|
|
15
|
-
expect(document).toBeDefined();
|
|
16
|
-
expect(document.header.documentType).toBe(builderTeamDocumentType);
|
|
17
|
-
});
|
|
18
|
-
it("should create a new BuilderTeam document with a valid initial state", () => {
|
|
19
|
-
const document = utils.createDocument();
|
|
20
|
-
expect(document.state.global).toStrictEqual(initialGlobalState);
|
|
21
|
-
expect(document.state.local).toStrictEqual(initialLocalState);
|
|
22
|
-
expect(isBuilderTeamDocument(document)).toBe(true);
|
|
23
|
-
expect(isBuilderTeamState(document.state)).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
it("should reject a document that is not a BuilderTeam document", () => {
|
|
26
|
-
const wrongDocumentType = utils.createDocument();
|
|
27
|
-
wrongDocumentType.header.documentType = "the-wrong-thing-1234";
|
|
28
|
-
try {
|
|
29
|
-
expect(assertIsBuilderTeamDocument(wrongDocumentType)).toThrow();
|
|
30
|
-
expect(isBuilderTeamDocument(wrongDocumentType)).toBe(false);
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
const wrongState = utils.createDocument();
|
|
37
|
-
// @ts-expect-error - we are testing the error case
|
|
38
|
-
wrongState.state.global = {
|
|
39
|
-
...{ notWhat: "you want" },
|
|
40
|
-
};
|
|
41
|
-
try {
|
|
42
|
-
expect(isBuilderTeamState(wrongState.state)).toBe(false);
|
|
43
|
-
expect(assertIsBuilderTeamState(wrongState.state)).toThrow();
|
|
44
|
-
expect(isBuilderTeamDocument(wrongState)).toBe(false);
|
|
45
|
-
expect(assertIsBuilderTeamDocument(wrongState)).toThrow();
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
49
|
-
}
|
|
50
|
-
const wrongInitialState = utils.createDocument();
|
|
51
|
-
// @ts-expect-error - we are testing the error case
|
|
52
|
-
wrongInitialState.initialState.global = {
|
|
53
|
-
...{ notWhat: "you want" },
|
|
54
|
-
};
|
|
55
|
-
try {
|
|
56
|
-
expect(isBuilderTeamState(wrongInitialState.state)).toBe(false);
|
|
57
|
-
expect(assertIsBuilderTeamState(wrongInitialState.state)).toThrow();
|
|
58
|
-
expect(isBuilderTeamDocument(wrongInitialState)).toBe(false);
|
|
59
|
-
expect(assertIsBuilderTeamDocument(wrongInitialState)).toThrow();
|
|
60
|
-
}
|
|
61
|
-
catch (error) {
|
|
62
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
63
|
-
}
|
|
64
|
-
const missingIdInHeader = utils.createDocument();
|
|
65
|
-
// @ts-expect-error - we are testing the error case
|
|
66
|
-
delete missingIdInHeader.header.id;
|
|
67
|
-
try {
|
|
68
|
-
expect(isBuilderTeamDocument(missingIdInHeader)).toBe(false);
|
|
69
|
-
expect(assertIsBuilderTeamDocument(missingIdInHeader)).toThrow();
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
73
|
-
}
|
|
74
|
-
const missingNameInHeader = utils.createDocument();
|
|
75
|
-
// @ts-expect-error - we are testing the error case
|
|
76
|
-
delete missingNameInHeader.header.name;
|
|
77
|
-
try {
|
|
78
|
-
expect(isBuilderTeamDocument(missingNameInHeader)).toBe(false);
|
|
79
|
-
expect(assertIsBuilderTeamDocument(missingNameInHeader)).toThrow();
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
83
|
-
}
|
|
84
|
-
const missingCreatedAtUtcIsoInHeader = utils.createDocument();
|
|
85
|
-
// @ts-expect-error - we are testing the error case
|
|
86
|
-
delete missingCreatedAtUtcIsoInHeader.header.createdAtUtcIso;
|
|
87
|
-
try {
|
|
88
|
-
expect(isBuilderTeamDocument(missingCreatedAtUtcIsoInHeader)).toBe(false);
|
|
89
|
-
expect(assertIsBuilderTeamDocument(missingCreatedAtUtcIsoInHeader)).toThrow();
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
93
|
-
}
|
|
94
|
-
const missingLastModifiedAtUtcIsoInHeader = utils.createDocument();
|
|
95
|
-
// @ts-expect-error - we are testing the error case
|
|
96
|
-
delete missingLastModifiedAtUtcIsoInHeader.header.lastModifiedAtUtcIso;
|
|
97
|
-
try {
|
|
98
|
-
expect(isBuilderTeamDocument(missingLastModifiedAtUtcIsoInHeader)).toBe(false);
|
|
99
|
-
expect(assertIsBuilderTeamDocument(missingLastModifiedAtUtcIsoInHeader)).toThrow();
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"member.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/v1/tests/member.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { generateMock } from "@powerhousedao/common/utils";
|
|
2
|
-
import { describe, expect, it } from "vitest";
|
|
3
|
-
import { reducer, utils, isBuilderTeamDocument, addMember, updateMemberInfo, removeMember, AddMemberInputSchema, UpdateMemberInfoInputSchema, RemoveMemberInputSchema, } from "@powerhousedao/vetra-builder-package/document-models/builder-team/v1";
|
|
4
|
-
describe("MemberOperations", () => {
|
|
5
|
-
it("should handle addMember operation", () => {
|
|
6
|
-
const document = utils.createDocument();
|
|
7
|
-
const input = generateMock(AddMemberInputSchema());
|
|
8
|
-
const updatedDocument = reducer(document, addMember(input));
|
|
9
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
10
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
11
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_MEMBER");
|
|
12
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
13
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
14
|
-
});
|
|
15
|
-
it("should handle updateMemberInfo operation", () => {
|
|
16
|
-
const document = utils.createDocument();
|
|
17
|
-
const input = generateMock(UpdateMemberInfoInputSchema());
|
|
18
|
-
const updatedDocument = reducer(document, updateMemberInfo(input));
|
|
19
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
20
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
21
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_MEMBER_INFO");
|
|
22
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
23
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
24
|
-
});
|
|
25
|
-
it("should handle removeMember operation", () => {
|
|
26
|
-
const document = utils.createDocument();
|
|
27
|
-
const input = generateMock(RemoveMemberInputSchema());
|
|
28
|
-
const updatedDocument = reducer(document, removeMember(input));
|
|
29
|
-
expect(isBuilderTeamDocument(updatedDocument)).toBe(true);
|
|
30
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
31
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_MEMBER");
|
|
32
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
33
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"packages.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builder-team/v1/tests/packages.test.ts"],"names":[],"mappings":""}
|