@powerhousedao/builder-team-admin 0.0.1 → 0.0.3
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/expense-report/hooks.d.ts +1 -1
- package/dist/document-models/expense-report/hooks.d.ts.map +1 -1
- package/dist/document-models/expense-report/module.d.ts +2 -2
- package/dist/document-models/expense-report/module.d.ts.map +1 -1
- package/dist/document-models/expense-report/module.js +4 -2
- package/dist/document-models/expense-report/src/reducers/wallet.d.ts +1 -1
- package/dist/document-models/expense-report/src/reducers/wallet.d.ts.map +1 -1
- package/dist/document-models/service-subscriptions/hooks.d.ts +1 -1
- package/dist/document-models/service-subscriptions/hooks.d.ts.map +1 -1
- package/dist/document-models/service-subscriptions/module.d.ts +2 -2
- package/dist/document-models/service-subscriptions/module.d.ts.map +1 -1
- package/dist/document-models/service-subscriptions/module.js +4 -2
- package/dist/document-models/service-subscriptions/src/reducers/categories.d.ts +1 -1
- package/dist/document-models/service-subscriptions/src/reducers/categories.d.ts.map +1 -1
- package/dist/document-models/service-subscriptions/src/reducers/subscriptions.d.ts +1 -1
- package/dist/document-models/service-subscriptions/src/reducers/subscriptions.d.ts.map +1 -1
- package/dist/document-models/service-subscriptions/src/reducers/vendors.d.ts +1 -1
- package/dist/document-models/service-subscriptions/src/reducers/vendors.d.ts.map +1 -1
- package/dist/editors/builder-team-admin/components/ExpenseReportsStats.d.ts +1 -1
- package/dist/editors/builder-team-admin/components/ExpenseReportsStats.d.ts.map +1 -1
- package/dist/editors/builder-team-admin/components/overview/SubscriptionsStats.d.ts +1 -1
- package/dist/editors/builder-team-admin/components/overview/SubscriptionsStats.d.ts.map +1 -1
- package/dist/editors/service-subscriptions-editor/components/AddCategoryModal.js +1 -1
- package/dist/editors/service-subscriptions-editor/components/AddSubscriptionModal.d.ts +1 -1
- package/dist/editors/service-subscriptions-editor/components/AddSubscriptionModal.d.ts.map +1 -1
- package/dist/editors/service-subscriptions-editor/components/AddSubscriptionModal.js +1 -1
- package/dist/editors/service-subscriptions-editor/components/AddVendorModal.js +1 -1
- package/dist/editors/service-subscriptions-editor/components/CategoriesList.d.ts +1 -1
- package/dist/editors/service-subscriptions-editor/components/CategoriesList.d.ts.map +1 -1
- package/dist/editors/service-subscriptions-editor/components/CategoriesList.js +1 -1
- package/dist/editors/service-subscriptions-editor/components/EditName.js +1 -1
- package/dist/editors/service-subscriptions-editor/components/StatsOverview.d.ts +1 -1
- package/dist/editors/service-subscriptions-editor/components/StatsOverview.d.ts.map +1 -1
- package/dist/editors/service-subscriptions-editor/components/SubscriptionsList.d.ts +1 -1
- package/dist/editors/service-subscriptions-editor/components/SubscriptionsList.d.ts.map +1 -1
- package/dist/editors/service-subscriptions-editor/components/SubscriptionsList.js +1 -1
- package/dist/editors/service-subscriptions-editor/components/VendorsList.d.ts +1 -1
- package/dist/editors/service-subscriptions-editor/components/VendorsList.d.ts.map +1 -1
- package/dist/editors/service-subscriptions-editor/components/VendorsList.js +1 -1
- package/dist/editors/service-subscriptions-editor/editor.js +1 -1
- package/dist/package.json +1 -1
- package/dist/powerhouse.manifest.json +9 -1
- package/dist/subgraphs/service-subscriptions/resolvers.js +1 -1
- package/package.json +1 -1
- package/dist/document-models/builders/actions.d.ts +0 -14
- package/dist/document-models/builders/actions.d.ts.map +0 -1
- package/dist/document-models/builders/actions.js +0 -4
- package/dist/document-models/builders/gen/actions.d.ts +0 -4
- package/dist/document-models/builders/gen/actions.d.ts.map +0 -1
- package/dist/document-models/builders/gen/actions.js +0 -1
- package/dist/document-models/builders/gen/builders/actions.d.ts +0 -12
- package/dist/document-models/builders/gen/builders/actions.d.ts.map +0 -1
- package/dist/document-models/builders/gen/builders/actions.js +0 -1
- package/dist/document-models/builders/gen/builders/creators.d.ts +0 -5
- package/dist/document-models/builders/gen/builders/creators.d.ts.map +0 -1
- package/dist/document-models/builders/gen/builders/creators.js +0 -4
- package/dist/document-models/builders/gen/builders/error.d.ts +0 -2
- package/dist/document-models/builders/gen/builders/error.d.ts.map +0 -1
- package/dist/document-models/builders/gen/builders/error.js +0 -1
- package/dist/document-models/builders/gen/builders/operations.d.ts +0 -8
- package/dist/document-models/builders/gen/builders/operations.d.ts.map +0 -1
- package/dist/document-models/builders/gen/builders/operations.js +0 -3
- package/dist/document-models/builders/gen/creators.d.ts +0 -3
- package/dist/document-models/builders/gen/creators.d.ts.map +0 -1
- package/dist/document-models/builders/gen/creators.js +0 -2
- package/dist/document-models/builders/gen/document-model.d.ts +0 -3
- package/dist/document-models/builders/gen/document-model.d.ts.map +0 -1
- package/dist/document-models/builders/gen/document-model.js +0 -59
- package/dist/document-models/builders/gen/document-schema.d.ts +0 -142
- package/dist/document-models/builders/gen/document-schema.d.ts.map +0 -1
- package/dist/document-models/builders/gen/document-schema.js +0 -33
- package/dist/document-models/builders/gen/document-type.d.ts +0 -2
- package/dist/document-models/builders/gen/document-type.d.ts.map +0 -1
- package/dist/document-models/builders/gen/document-type.js +0 -1
- package/dist/document-models/builders/gen/index.d.ts +0 -12
- package/dist/document-models/builders/gen/index.d.ts.map +0 -1
- package/dist/document-models/builders/gen/index.js +0 -11
- package/dist/document-models/builders/gen/ph-factories.d.ts +0 -23
- package/dist/document-models/builders/gen/ph-factories.d.ts.map +0 -1
- package/dist/document-models/builders/gen/ph-factories.js +0 -47
- package/dist/document-models/builders/gen/reducer.d.ts +0 -3
- package/dist/document-models/builders/gen/reducer.d.ts.map +0 -1
- package/dist/document-models/builders/gen/reducer.js +0 -21
- package/dist/document-models/builders/gen/schema/index.d.ts +0 -3
- package/dist/document-models/builders/gen/schema/index.d.ts.map +0 -1
- package/dist/document-models/builders/gen/schema/index.js +0 -2
- package/dist/document-models/builders/gen/schema/types.d.ts +0 -146
- package/dist/document-models/builders/gen/schema/types.d.ts.map +0 -1
- package/dist/document-models/builders/gen/schema/types.js +0 -1
- package/dist/document-models/builders/gen/schema/zod.d.ts +0 -13
- package/dist/document-models/builders/gen/schema/zod.d.ts.map +0 -1
- package/dist/document-models/builders/gen/schema/zod.js +0 -21
- package/dist/document-models/builders/gen/types.d.ts +0 -12
- package/dist/document-models/builders/gen/types.d.ts.map +0 -1
- package/dist/document-models/builders/gen/types.js +0 -1
- package/dist/document-models/builders/gen/utils.d.ts +0 -15
- package/dist/document-models/builders/gen/utils.d.ts.map +0 -1
- package/dist/document-models/builders/gen/utils.js +0 -51
- package/dist/document-models/builders/hooks.d.ts +0 -11
- package/dist/document-models/builders/hooks.d.ts.map +0 -1
- package/dist/document-models/builders/hooks.js +0 -26
- package/dist/document-models/builders/index.d.ts +0 -10
- package/dist/document-models/builders/index.d.ts.map +0 -1
- package/dist/document-models/builders/index.js +0 -9
- package/dist/document-models/builders/module.d.ts +0 -5
- package/dist/document-models/builders/module.d.ts.map +0 -1
- package/dist/document-models/builders/module.js +0 -10
- package/dist/document-models/builders/src/index.d.ts +0 -2
- package/dist/document-models/builders/src/index.d.ts.map +0 -1
- package/dist/document-models/builders/src/index.js +0 -1
- package/dist/document-models/builders/src/reducers/builders.d.ts +0 -3
- package/dist/document-models/builders/src/reducers/builders.d.ts.map +0 -1
- package/dist/document-models/builders/src/reducers/builders.js +0 -8
- package/dist/document-models/builders/src/tests/builders.test.d.ts +0 -6
- package/dist/document-models/builders/src/tests/builders.test.d.ts.map +0 -1
- package/dist/document-models/builders/src/tests/builders.test.js +0 -29
- package/dist/document-models/builders/src/tests/document-model.test.d.ts +0 -10
- package/dist/document-models/builders/src/tests/document-model.test.d.ts.map +0 -1
- package/dist/document-models/builders/src/tests/document-model.test.js +0 -104
- package/dist/document-models/builders/src/utils.d.ts +0 -2
- package/dist/document-models/builders/src/utils.d.ts.map +0 -1
- package/dist/document-models/builders/src/utils.js +0 -1
- package/dist/document-models/builders/utils.d.ts +0 -14
- package/dist/document-models/builders/utils.d.ts.map +0 -1
- package/dist/document-models/builders/utils.js +0 -7
- package/dist/document-models/expense-report/src/tests/document-model.test.d.ts +0 -10
- package/dist/document-models/expense-report/src/tests/document-model.test.d.ts.map +0 -1
- package/dist/document-models/expense-report/src/tests/document-model.test.js +0 -104
- package/dist/document-models/expense-report/src/tests/wallet.test.d.ts +0 -6
- package/dist/document-models/expense-report/src/tests/wallet.test.d.ts.map +0 -1
- package/dist/document-models/expense-report/src/tests/wallet.test.js +0 -159
- package/dist/editors/builders/editor.d.ts +0 -3
- package/dist/editors/builders/editor.d.ts.map +0 -1
- package/dist/editors/builders/editor.js +0 -204
- package/dist/editors/builders/module.d.ts +0 -4
- package/dist/editors/builders/module.d.ts.map +0 -1
- package/dist/editors/builders/module.js +0 -10
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useDocumentById, useSelectedDocument, } from "@powerhousedao/reactor-browser";
|
|
2
|
-
import { isBuildersDocument } from "./gen/document-schema.js";
|
|
3
|
-
/** Hook to get a Builders document by its id */
|
|
4
|
-
export function useBuildersDocumentById(documentId) {
|
|
5
|
-
const [document, dispatch] = useDocumentById(documentId);
|
|
6
|
-
if (!isBuildersDocument(document))
|
|
7
|
-
return [undefined, undefined];
|
|
8
|
-
return [document, dispatch];
|
|
9
|
-
}
|
|
10
|
-
/** Hook to get the selected Builders document */
|
|
11
|
-
export function useSelectedBuildersDocument() {
|
|
12
|
-
const [document, dispatch] = useSelectedDocument();
|
|
13
|
-
if (!isBuildersDocument(document))
|
|
14
|
-
return [undefined, undefined];
|
|
15
|
-
return [document, dispatch];
|
|
16
|
-
}
|
|
17
|
-
/** Hook to get all Builders documents in the selected drive */
|
|
18
|
-
export function useBuildersDocumentsInSelectedDrive() {
|
|
19
|
-
const documentsInSelectedDrive = useDocumentsInSelectedDrive();
|
|
20
|
-
return documentsInSelectedDrive?.filter(isBuildersDocument);
|
|
21
|
-
}
|
|
22
|
-
/** Hook to get all Builders documents in the selected folder */
|
|
23
|
-
export function useBuildersDocumentsInSelectedFolder() {
|
|
24
|
-
const documentsInSelectedFolder = useDocumentsInSelectedFolder();
|
|
25
|
-
return documentsInSelectedFolder?.filter(isBuildersDocument);
|
|
26
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is a scaffold file meant for customization.
|
|
3
|
-
* Delete the file and run the code generator again to have it reset
|
|
4
|
-
*/
|
|
5
|
-
export * from "./gen/index.js";
|
|
6
|
-
export * from "./src/index.js";
|
|
7
|
-
export * from "./hooks.js";
|
|
8
|
-
export { actions } from "./actions.js";
|
|
9
|
-
export { utils } from "./utils.js";
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../document-models/builders/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is a scaffold file meant for customization.
|
|
3
|
-
* Delete the file and run the code generator again to have it reset
|
|
4
|
-
*/
|
|
5
|
-
export * from "./gen/index.js";
|
|
6
|
-
export * from "./src/index.js";
|
|
7
|
-
export * from "./hooks.js";
|
|
8
|
-
export { actions } from "./actions.js";
|
|
9
|
-
export { utils } from "./utils.js";
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { DocumentModelModule } from "document-model";
|
|
2
|
-
import type { BuildersPHState } from "@powerhousedao/builder-team-admin/document-models/builders";
|
|
3
|
-
/** Document model module for the Todo List document type */
|
|
4
|
-
export declare const Builders: DocumentModelModule<BuildersPHState>;
|
|
5
|
-
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../document-models/builders/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAG1D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4DAA4D,CAAC;AAQlG,4DAA4D;AAC5D,eAAO,MAAM,QAAQ,EAAE,mBAAmB,CAAC,eAAe,CAKzD,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { createState } from "document-model";
|
|
2
|
-
import { defaultBaseState } from "document-model/core";
|
|
3
|
-
import { actions, documentModel, reducer, utils, } from "@powerhousedao/builder-team-admin/document-models/builders";
|
|
4
|
-
/** Document model module for the Todo List document type */
|
|
5
|
-
export const Builders = {
|
|
6
|
-
reducer,
|
|
7
|
-
actions,
|
|
8
|
-
utils,
|
|
9
|
-
documentModel: createState(defaultBaseState(), documentModel),
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../document-models/builders/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./utils.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../../../../document-models/builders/src/reducers/builders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,4DAA4D,CAAC;AAE7G,eAAO,MAAM,0BAA0B,EAAE,0BASxC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export const buildersBuildersOperations = {
|
|
2
|
-
addBuilderOperation(state, action) {
|
|
3
|
-
state.builders.push(action.input.builderPhid);
|
|
4
|
-
},
|
|
5
|
-
removeBuilderOperation(state, action) {
|
|
6
|
-
state.builders = state.builders.filter((builder) => builder !== action.input.builderPhid);
|
|
7
|
-
},
|
|
8
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builders.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/builders/src/tests/builders.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -1,29 +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
|
-
import { describe, it, expect } from "vitest";
|
|
6
|
-
import { generateMock } from "@powerhousedao/codegen";
|
|
7
|
-
import { reducer, utils, isBuildersDocument, addBuilder, AddBuilderInputSchema, removeBuilder, RemoveBuilderInputSchema, } from "@powerhousedao/network-admin/document-models/builders";
|
|
8
|
-
describe("Builders Operations", () => {
|
|
9
|
-
it("should handle addBuilder operation", () => {
|
|
10
|
-
const document = utils.createDocument();
|
|
11
|
-
const input = generateMock(AddBuilderInputSchema());
|
|
12
|
-
const updatedDocument = reducer(document, addBuilder(input));
|
|
13
|
-
expect(isBuildersDocument(updatedDocument)).toBe(true);
|
|
14
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
15
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_BUILDER");
|
|
16
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
17
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
18
|
-
});
|
|
19
|
-
it("should handle removeBuilder operation", () => {
|
|
20
|
-
const document = utils.createDocument();
|
|
21
|
-
const input = generateMock(RemoveBuilderInputSchema());
|
|
22
|
-
const updatedDocument = reducer(document, removeBuilder(input));
|
|
23
|
-
expect(isBuildersDocument(updatedDocument)).toBe(true);
|
|
24
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
25
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_BUILDER");
|
|
26
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
27
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
28
|
-
});
|
|
29
|
-
});
|
|
@@ -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/builders/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, buildersDocumentType, isBuildersDocument, assertIsBuildersDocument, isBuildersState, assertIsBuildersState, } from "@powerhousedao/network-admin/document-models/builders";
|
|
11
|
-
import { ZodError } from "zod";
|
|
12
|
-
describe("Builders Document Model", () => {
|
|
13
|
-
it("should create a new Builders document", () => {
|
|
14
|
-
const document = utils.createDocument();
|
|
15
|
-
expect(document).toBeDefined();
|
|
16
|
-
expect(document.header.documentType).toBe(buildersDocumentType);
|
|
17
|
-
});
|
|
18
|
-
it("should create a new Builders 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(isBuildersDocument(document)).toBe(true);
|
|
23
|
-
expect(isBuildersState(document.state)).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
it("should reject a document that is not a Builders document", () => {
|
|
26
|
-
const wrongDocumentType = utils.createDocument();
|
|
27
|
-
wrongDocumentType.header.documentType = "the-wrong-thing-1234";
|
|
28
|
-
try {
|
|
29
|
-
expect(assertIsBuildersDocument(wrongDocumentType)).toThrow();
|
|
30
|
-
expect(isBuildersDocument(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(isBuildersState(wrongState.state)).toBe(false);
|
|
43
|
-
expect(assertIsBuildersState(wrongState.state)).toThrow();
|
|
44
|
-
expect(isBuildersDocument(wrongState)).toBe(false);
|
|
45
|
-
expect(assertIsBuildersDocument(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(isBuildersState(wrongInitialState.state)).toBe(false);
|
|
57
|
-
expect(assertIsBuildersState(wrongInitialState.state)).toThrow();
|
|
58
|
-
expect(isBuildersDocument(wrongInitialState)).toBe(false);
|
|
59
|
-
expect(assertIsBuildersDocument(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(isBuildersDocument(missingIdInHeader)).toBe(false);
|
|
69
|
-
expect(assertIsBuildersDocument(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(isBuildersDocument(missingNameInHeader)).toBe(false);
|
|
79
|
-
expect(assertIsBuildersDocument(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(isBuildersDocument(missingCreatedAtUtcIsoInHeader)).toBe(false);
|
|
89
|
-
expect(assertIsBuildersDocument(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(isBuildersDocument(missingLastModifiedAtUtcIsoInHeader)).toBe(false);
|
|
99
|
-
expect(assertIsBuildersDocument(missingLastModifiedAtUtcIsoInHeader)).toThrow();
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../document-models/builders/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { BuildersPHState } from "./gen/types.js";
|
|
2
|
-
/** Utils for the Builders document model */
|
|
3
|
-
export declare const utils: {
|
|
4
|
-
fileExtension: string;
|
|
5
|
-
createState: import("document-model").CreateState<BuildersPHState>;
|
|
6
|
-
createDocument: import("document-model").CreateDocument<BuildersPHState>;
|
|
7
|
-
loadFromInput: import("document-model").LoadFromInput<BuildersPHState>;
|
|
8
|
-
saveToFileHandle: import("document-model").SaveToFileHandle;
|
|
9
|
-
isStateOfType: import("document-model").IsStateOfType<BuildersPHState>;
|
|
10
|
-
assertIsStateOfType: import("document-model").AssertIsStateOfType<BuildersPHState>;
|
|
11
|
-
isDocumentOfType: import("document-model").IsDocumentOfType<BuildersPHState>;
|
|
12
|
-
assertIsDocumentOfType: import("document-model").AssertIsDocumentOfType<BuildersPHState>;
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../document-models/builders/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAItD,4CAA4C;AAC5C,eAAO,MAAM,KAAK;;;;;;;;;;CAG6B,CAAC"}
|
|
@@ -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/expense-report/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, expenseReportDocumentType, isExpenseReportDocument, assertIsExpenseReportDocument, isExpenseReportState, assertIsExpenseReportState, } from "@powerhousedao/contributor-billing/document-models/expense-report";
|
|
11
|
-
import { ZodError } from "zod";
|
|
12
|
-
describe("ExpenseReport Document Model", () => {
|
|
13
|
-
it("should create a new ExpenseReport document", () => {
|
|
14
|
-
const document = utils.createDocument();
|
|
15
|
-
expect(document).toBeDefined();
|
|
16
|
-
expect(document.header.documentType).toBe(expenseReportDocumentType);
|
|
17
|
-
});
|
|
18
|
-
it("should create a new ExpenseReport 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(isExpenseReportDocument(document)).toBe(true);
|
|
23
|
-
expect(isExpenseReportState(document.state)).toBe(true);
|
|
24
|
-
});
|
|
25
|
-
it("should reject a document that is not a ExpenseReport document", () => {
|
|
26
|
-
const wrongDocumentType = utils.createDocument();
|
|
27
|
-
wrongDocumentType.header.documentType = "the-wrong-thing-1234";
|
|
28
|
-
try {
|
|
29
|
-
expect(assertIsExpenseReportDocument(wrongDocumentType)).toThrow();
|
|
30
|
-
expect(isExpenseReportDocument(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(isExpenseReportState(wrongState.state)).toBe(false);
|
|
43
|
-
expect(assertIsExpenseReportState(wrongState.state)).toThrow();
|
|
44
|
-
expect(isExpenseReportDocument(wrongState)).toBe(false);
|
|
45
|
-
expect(assertIsExpenseReportDocument(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(isExpenseReportState(wrongInitialState.state)).toBe(false);
|
|
57
|
-
expect(assertIsExpenseReportState(wrongInitialState.state)).toThrow();
|
|
58
|
-
expect(isExpenseReportDocument(wrongInitialState)).toBe(false);
|
|
59
|
-
expect(assertIsExpenseReportDocument(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(isExpenseReportDocument(missingIdInHeader)).toBe(false);
|
|
69
|
-
expect(assertIsExpenseReportDocument(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(isExpenseReportDocument(missingNameInHeader)).toBe(false);
|
|
79
|
-
expect(assertIsExpenseReportDocument(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(isExpenseReportDocument(missingCreatedAtUtcIsoInHeader)).toBe(false);
|
|
89
|
-
expect(assertIsExpenseReportDocument(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(isExpenseReportDocument(missingLastModifiedAtUtcIsoInHeader)).toBe(false);
|
|
99
|
-
expect(assertIsExpenseReportDocument(missingLastModifiedAtUtcIsoInHeader)).toThrow();
|
|
100
|
-
}
|
|
101
|
-
catch (error) {
|
|
102
|
-
expect(error).toBeInstanceOf(ZodError);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.test.d.ts","sourceRoot":"","sources":["../../../../../document-models/expense-report/src/tests/wallet.test.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -1,159 +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
|
-
import { describe, it, expect } from "vitest";
|
|
6
|
-
import { generateMock } from "@powerhousedao/codegen";
|
|
7
|
-
import { reducer, utils, isExpenseReportDocument, addWallet, AddWalletInputSchema, removeWallet, RemoveWalletInputSchema, addBillingStatement, AddBillingStatementInputSchema, removeBillingStatement, RemoveBillingStatementInputSchema, addLineItem, AddLineItemInputSchema, updateLineItem, UpdateLineItemInputSchema, removeLineItem, RemoveLineItemInputSchema, addLineItemGroup, AddLineItemGroupInputSchema, updateLineItemGroup, UpdateLineItemGroupInputSchema, removeLineItemGroup, RemoveLineItemGroupInputSchema, setGroupTotals, SetGroupTotalsInputSchema, removeGroupTotals, RemoveGroupTotalsInputSchema, setPeriodStart, SetPeriodStartInputSchema, setPeriodEnd, SetPeriodEndInputSchema, updateWallet, UpdateWalletInputSchema, } from "@powerhousedao/contributor-billing/document-models/expense-report";
|
|
8
|
-
describe("Wallet Operations", () => {
|
|
9
|
-
it("should handle addWallet operation", () => {
|
|
10
|
-
const document = utils.createDocument();
|
|
11
|
-
const input = generateMock(AddWalletInputSchema());
|
|
12
|
-
const updatedDocument = reducer(document, addWallet(input));
|
|
13
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
14
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
15
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_WALLET");
|
|
16
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
17
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
18
|
-
});
|
|
19
|
-
it("should handle removeWallet operation", () => {
|
|
20
|
-
const document = utils.createDocument();
|
|
21
|
-
const input = generateMock(RemoveWalletInputSchema());
|
|
22
|
-
const updatedDocument = reducer(document, removeWallet(input));
|
|
23
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
24
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
25
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_WALLET");
|
|
26
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
27
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
28
|
-
});
|
|
29
|
-
it("should handle addBillingStatement operation", () => {
|
|
30
|
-
const document = utils.createDocument();
|
|
31
|
-
const input = generateMock(AddBillingStatementInputSchema());
|
|
32
|
-
const updatedDocument = reducer(document, addBillingStatement(input));
|
|
33
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
34
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
35
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_BILLING_STATEMENT");
|
|
36
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
37
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
38
|
-
});
|
|
39
|
-
it("should handle removeBillingStatement operation", () => {
|
|
40
|
-
const document = utils.createDocument();
|
|
41
|
-
const input = generateMock(RemoveBillingStatementInputSchema());
|
|
42
|
-
const updatedDocument = reducer(document, removeBillingStatement(input));
|
|
43
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
44
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
45
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_BILLING_STATEMENT");
|
|
46
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
47
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
48
|
-
});
|
|
49
|
-
it("should handle addLineItem operation", () => {
|
|
50
|
-
const document = utils.createDocument();
|
|
51
|
-
const input = generateMock(AddLineItemInputSchema());
|
|
52
|
-
const updatedDocument = reducer(document, addLineItem(input));
|
|
53
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
54
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
55
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_LINE_ITEM");
|
|
56
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
57
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
58
|
-
});
|
|
59
|
-
it("should handle updateLineItem operation", () => {
|
|
60
|
-
const document = utils.createDocument();
|
|
61
|
-
const input = generateMock(UpdateLineItemInputSchema());
|
|
62
|
-
const updatedDocument = reducer(document, updateLineItem(input));
|
|
63
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
64
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
65
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_LINE_ITEM");
|
|
66
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
67
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
68
|
-
});
|
|
69
|
-
it("should handle removeLineItem operation", () => {
|
|
70
|
-
const document = utils.createDocument();
|
|
71
|
-
const input = generateMock(RemoveLineItemInputSchema());
|
|
72
|
-
const updatedDocument = reducer(document, removeLineItem(input));
|
|
73
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
74
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
75
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_LINE_ITEM");
|
|
76
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
77
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
78
|
-
});
|
|
79
|
-
it("should handle addLineItemGroup operation", () => {
|
|
80
|
-
const document = utils.createDocument();
|
|
81
|
-
const input = generateMock(AddLineItemGroupInputSchema());
|
|
82
|
-
const updatedDocument = reducer(document, addLineItemGroup(input));
|
|
83
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
84
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
85
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("ADD_LINE_ITEM_GROUP");
|
|
86
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
87
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
88
|
-
});
|
|
89
|
-
it("should handle updateLineItemGroup operation", () => {
|
|
90
|
-
const document = utils.createDocument();
|
|
91
|
-
const input = generateMock(UpdateLineItemGroupInputSchema());
|
|
92
|
-
const updatedDocument = reducer(document, updateLineItemGroup(input));
|
|
93
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
94
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
95
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_LINE_ITEM_GROUP");
|
|
96
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
97
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
98
|
-
});
|
|
99
|
-
it("should handle removeLineItemGroup operation", () => {
|
|
100
|
-
const document = utils.createDocument();
|
|
101
|
-
const input = generateMock(RemoveLineItemGroupInputSchema());
|
|
102
|
-
const updatedDocument = reducer(document, removeLineItemGroup(input));
|
|
103
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
104
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
105
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_LINE_ITEM_GROUP");
|
|
106
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
107
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
108
|
-
});
|
|
109
|
-
it("should handle setGroupTotals operation", () => {
|
|
110
|
-
const document = utils.createDocument();
|
|
111
|
-
const input = generateMock(SetGroupTotalsInputSchema());
|
|
112
|
-
const updatedDocument = reducer(document, setGroupTotals(input));
|
|
113
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
114
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
115
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_GROUP_TOTALS");
|
|
116
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
117
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
118
|
-
});
|
|
119
|
-
it("should handle removeGroupTotals operation", () => {
|
|
120
|
-
const document = utils.createDocument();
|
|
121
|
-
const input = generateMock(RemoveGroupTotalsInputSchema());
|
|
122
|
-
const updatedDocument = reducer(document, removeGroupTotals(input));
|
|
123
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
124
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
125
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("REMOVE_GROUP_TOTALS");
|
|
126
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
127
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
128
|
-
});
|
|
129
|
-
it("should handle setPeriodStart operation", () => {
|
|
130
|
-
const document = utils.createDocument();
|
|
131
|
-
const input = generateMock(SetPeriodStartInputSchema());
|
|
132
|
-
const updatedDocument = reducer(document, setPeriodStart(input));
|
|
133
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
134
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
135
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_PERIOD_START");
|
|
136
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
137
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
138
|
-
});
|
|
139
|
-
it("should handle setPeriodEnd operation", () => {
|
|
140
|
-
const document = utils.createDocument();
|
|
141
|
-
const input = generateMock(SetPeriodEndInputSchema());
|
|
142
|
-
const updatedDocument = reducer(document, setPeriodEnd(input));
|
|
143
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
144
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
145
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("SET_PERIOD_END");
|
|
146
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
147
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
148
|
-
});
|
|
149
|
-
it("should handle updateWallet operation", () => {
|
|
150
|
-
const document = utils.createDocument();
|
|
151
|
-
const input = generateMock(UpdateWalletInputSchema());
|
|
152
|
-
const updatedDocument = reducer(document, updateWallet(input));
|
|
153
|
-
expect(isExpenseReportDocument(updatedDocument)).toBe(true);
|
|
154
|
-
expect(updatedDocument.operations.global).toHaveLength(1);
|
|
155
|
-
expect(updatedDocument.operations.global[0].action.type).toBe("UPDATE_WALLET");
|
|
156
|
-
expect(updatedDocument.operations.global[0].action.input).toStrictEqual(input);
|
|
157
|
-
expect(updatedDocument.operations.global[0].index).toEqual(0);
|
|
158
|
-
});
|
|
159
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/builders/editor.tsx"],"names":[],"mappings":"AA4BA,0CAA0C;AAC1C,MAAM,CAAC,OAAO,UAAU,MAAM,4CAsR7B"}
|