Skip to content

Commit

Permalink
fix: stripped functions off of returned object
Browse files Browse the repository at this point in the history
  • Loading branch information
AEmberson committed Oct 14, 2024
1 parent 5b2a66f commit 10f8a51
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/lib/ContentClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ describe('ContentClient', () => {
const response = await client.getByHierarchy({
rootId: ROOT.content._meta.deliveryId,
});
expect(response).to.deep.eq(expectedContent);
expect(response).to.deep.eq(JSON.parse(JSON.stringify(expectedContent)));
});

it(`getByHierarchy should apply filter when building a tree with a filter`, async () => {
Expand Down Expand Up @@ -526,7 +526,7 @@ describe('ContentClient', () => {
return contentBody['propertyName1'] === 'C';
}
);
expect(response).to.deep.eq(expectedContent);
expect(response).to.deep.eq(JSON.parse(JSON.stringify(expectedContent)));
});

it(`getByHierarchy should apply a mutation when building a tree with a mutator`, async () => {
Expand Down Expand Up @@ -580,7 +580,7 @@ describe('ContentClient', () => {
return contentBody;
}
);
expect(response).to.deep.eq(expectedContent);
expect(response).to.deep.eq(JSON.parse(JSON.stringify(expectedContent)));
});

it(`getByHierarchy should apply a filter and mutation when building a tree with a mutator`, async () => {
Expand Down Expand Up @@ -640,7 +640,7 @@ describe('ContentClient', () => {
return contentBody;
}
);
expect(response).to.deep.eq(expectedContent);
expect(response).to.deep.eq(JSON.parse(JSON.stringify(expectedContent)));
});

it(`getByHierarchy should throw an error if the root item is not found`, async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class FilteringAndMutatingHierarchyAssembler<Body extends ContentBody>
content: HierarchyContentResponse<Body>[]
): HierarchyContentItem<Body> {
const rootHierarchyItem: HierarchyContentItem<Body> = {
content: this.mutationFunction(rootItem.body),
content: this.mutationFunction(rootItem.toJSON()),
children: [],
};
rootHierarchyItem.children = content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class FilteringHierachyAssemblerImpl<Body extends ContentBody>
content: HierarchyContentResponse<Body>[]
): HierarchyContentItem<Body> {
const rootHierarchyItem: HierarchyContentItem<Body> = {
content: rootItem.body,
content: rootItem.toJSON(),
children: [],
};
rootHierarchyItem.children = content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class HierarchyAssemblerImpl<Body extends ContentBody>
content: HierarchyContentResponse<Body>[]
): HierarchyContentItem<Body> {
const rootHierarchyItem: HierarchyContentItem<Body> = {
content: rootItem.body,
content: rootItem.toJSON(),
children: [],
};
rootHierarchyItem.children = content
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class MutatingHierachyAssemblerImpl<Body extends ContentBody>
content: HierarchyContentResponse<Body>[]
): HierarchyContentItem<Body> {
const rootHierarchyItem: HierarchyContentItem<Body> = {
content: this.mutationFunction(rootItem.body),
content: this.mutationFunction(rootItem.toJSON()),
children: [],
};
rootHierarchyItem.children = content
Expand Down

0 comments on commit 10f8a51

Please sign in to comment.