@forge/react 11.13.0-next.0 → 11.13.0-next.1
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/CHANGELOG.md
CHANGED
|
@@ -740,6 +740,31 @@ describe('usePermissions', () => {
|
|
|
740
740
|
expect(result.current.missingPermissions?.external?.fetch?.client).toEqual(['http://example.com']);
|
|
741
741
|
});
|
|
742
742
|
});
|
|
743
|
+
describe('Input shape validation', () => {
|
|
744
|
+
beforeEach(() => {
|
|
745
|
+
mockGetContext.mockResolvedValue({
|
|
746
|
+
permissions: { scopes: ['read:confluence-content'] }
|
|
747
|
+
});
|
|
748
|
+
});
|
|
749
|
+
it.each([
|
|
750
|
+
[{ scopes: 'read:confluence-content' }, 'scopes should be an array, not a string'],
|
|
751
|
+
[{ external: 'https://api.example.com' }, 'external should be an object, not a string'],
|
|
752
|
+
[{ external: { fetch: ['https://api.example.com'] } }, 'external.fetch should be an object, not an array'],
|
|
753
|
+
[
|
|
754
|
+
{ external: { fetch: { backend: 'https://api.zoom.com' } } },
|
|
755
|
+
'external.fetch.backend should be an array, not a string'
|
|
756
|
+
]
|
|
757
|
+
])('should set error for invalid input %#', async (requiredPermissions, expectedMessage) => {
|
|
758
|
+
const { result } = (0, react_hooks_1.renderHook)(() => (0, usePermissions_1.usePermissions)(requiredPermissions));
|
|
759
|
+
await (0, react_hooks_1.act)(async () => {
|
|
760
|
+
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
761
|
+
});
|
|
762
|
+
expect(result.current.isLoading).toBe(false);
|
|
763
|
+
expect(result.current.hasPermission).toBe(false);
|
|
764
|
+
expect(result.current.error).toBeInstanceOf(TypeError);
|
|
765
|
+
expect(result.current.error?.message).toBe(expectedMessage);
|
|
766
|
+
});
|
|
767
|
+
});
|
|
743
768
|
describe('Edge cases', () => {
|
|
744
769
|
it('should handle empty required permissions', async () => {
|
|
745
770
|
const mockContext = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/react",
|
|
3
|
-
"version": "11.13.0-next.
|
|
3
|
+
"version": "11.13.0-next.1",
|
|
4
4
|
"description": "Forge React reconciler",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@atlaskit/adf-schema": "^48.0.0",
|
|
33
33
|
"@atlaskit/adf-utils": "^19.19.0",
|
|
34
34
|
"@atlaskit/forge-react-types": "^0.62.0",
|
|
35
|
-
"@forge/bridge": "^5.
|
|
35
|
+
"@forge/bridge": "^5.14.0-next.4",
|
|
36
36
|
"@forge/egress": "^2.3.1",
|
|
37
37
|
"@forge/i18n": "0.0.7",
|
|
38
38
|
"@types/react": "^18.2.64",
|