|
@@ -417,8 +417,8 @@ describe('Page', () => {
|
|
|
expect(pagePaths).toContainEqual('/grant');
|
|
expect(pagePaths).toContainEqual('/grant');
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- test('can retrieve all pages with testUser0', async() => {
|
|
|
|
|
- const result = await Page.findListWithDescendants('/grant', testUser1);
|
|
|
|
|
|
|
+ test('can retrieve all pages with testUser2', async() => {
|
|
|
|
|
+ const result = await Page.findListWithDescendants('/grant', testUser2);
|
|
|
const { pages } = result;
|
|
const { pages } = result;
|
|
|
|
|
|
|
|
// assert totalCount
|
|
// assert totalCount
|
|
@@ -433,4 +433,48 @@ describe('Page', () => {
|
|
|
expect(pagePaths).toContainEqual('/grant');
|
|
expect(pagePaths).toContainEqual('/grant');
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
+
|
|
|
|
|
+ describe('.findManageableListWithDescendants', () => {
|
|
|
|
|
+ test('can retrieve all pages with testUser0', async() => {
|
|
|
|
|
+ const pages = await Page.findManageableListWithDescendants(parentPage, testUser0);
|
|
|
|
|
+
|
|
|
|
|
+ // assert totalCount
|
|
|
|
|
+ expect(pages.length).toEqual(5);
|
|
|
|
|
+
|
|
|
|
|
+ // assert paths
|
|
|
|
|
+ const pagePaths = await pages.map((page) => { return page.path });
|
|
|
|
|
+ expect(pagePaths).toContainEqual('/grant/groupacl');
|
|
|
|
|
+ expect(pagePaths).toContainEqual('/grant/specified');
|
|
|
|
|
+ expect(pagePaths).toContainEqual('/grant/owner');
|
|
|
|
|
+ expect(pagePaths).toContainEqual('/grant/public');
|
|
|
|
|
+ expect(pagePaths).toContainEqual('/grant');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ test('can retrieve group page and public page which starts with testUser1', async() => {
|
|
|
|
|
+ const pages = await Page.findManageableListWithDescendants(parentPage, testUser1);
|
|
|
|
|
+
|
|
|
|
|
+ // assert totalCount
|
|
|
|
|
+ expect(pages.length).toEqual(3);
|
|
|
|
|
+
|
|
|
|
|
+ // assert paths
|
|
|
|
|
+ const pagePaths = await pages.map((page) => { return page.path });
|
|
|
|
|
+ expect(pagePaths).toContainEqual('/grant/groupacl');
|
|
|
|
|
+ expect(pagePaths).toContainEqual('/grant/public');
|
|
|
|
|
+ expect(pagePaths).toContainEqual('/grant');
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ test('can retrieve only public page which starts with testUser2', async() => {
|
|
|
|
|
+ const pages = await Page.findManageableListWithDescendants(parentPage, testUser2);
|
|
|
|
|
+
|
|
|
|
|
+ // assert totalCount
|
|
|
|
|
+ expect(pages.length).toEqual(2);
|
|
|
|
|
+
|
|
|
|
|
+ // assert paths
|
|
|
|
|
+ const pagePaths = await pages.map((page) => { return page.path });
|
|
|
|
|
+ expect(pagePaths).toContainEqual('/grant/public');
|
|
|
|
|
+ expect(pagePaths).toContainEqual('/grant');
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
});
|
|
});
|