mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-22 11:45:59 +01:00
Fix web vault lock throwing an error (#10833)
This commit is contained in:
parent
d5cbc19187
commit
1b75261f68
@ -24,5 +24,16 @@ describe("CollectionUtils Service", () => {
|
|||||||
expect(result[0].node.name).toBe("Parent");
|
expect(result[0].node.name).toBe("Parent");
|
||||||
expect(result[0].children[0].node.name).toBe("Child");
|
expect(result[0].children[0].node.name).toBe("Child");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should return an empty array if no collections are provided", () => {
|
||||||
|
// Arrange
|
||||||
|
const collections: CollectionView[] = [];
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const result = getNestedCollectionTree(collections);
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(result).toEqual([]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -14,6 +14,10 @@ export function getNestedCollectionTree(collections: CollectionView[]): TreeNode
|
|||||||
export function getNestedCollectionTree(
|
export function getNestedCollectionTree(
|
||||||
collections: (CollectionView | CollectionAdminView)[],
|
collections: (CollectionView | CollectionAdminView)[],
|
||||||
): TreeNode<CollectionView | CollectionAdminView>[] {
|
): TreeNode<CollectionView | CollectionAdminView>[] {
|
||||||
|
if (!collections) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
// Collections need to be cloned because ServiceUtils.nestedTraverse actively
|
// Collections need to be cloned because ServiceUtils.nestedTraverse actively
|
||||||
// modifies the names of collections.
|
// modifies the names of collections.
|
||||||
// These changes risk affecting collections store in StateService.
|
// These changes risk affecting collections store in StateService.
|
||||||
|
Loading…
Reference in New Issue
Block a user