@@ -16,14 +16,15 @@ limitations under the License.
16
16
17
17
import { mocked } from "jest-mock" ;
18
18
import { MatrixClient } from "matrix-js-sdk/src/matrix" ;
19
- import { Widget , WidgetKind } from "matrix-widget-api" ;
19
+ import { MatrixWidgetType , Widget , WidgetKind } from "matrix-widget-api" ;
20
20
21
21
import { OIDCState , WidgetPermissionStore } from "../../../src/stores/widgets/WidgetPermissionStore" ;
22
22
import SettingsStore from "../../../src/settings/SettingsStore" ;
23
23
import { TestSdkContext } from "../../TestSdkContext" ;
24
24
import { SettingLevel } from "../../../src/settings/SettingLevel" ;
25
25
import { SdkContextClass } from "../../../src/contexts/SDKContext" ;
26
26
import { stubClient } from "../../test-utils" ;
27
+ import { StopGapWidgetDriver } from "../../../src/stores/widgets/StopGapWidgetDriver" ;
27
28
28
29
jest . mock ( "../../../src/settings/SettingsStore" ) ;
29
30
@@ -38,6 +39,12 @@ describe("WidgetPermissionStore", () => {
38
39
type : "m.custom" ,
39
40
url : "https://invalid.address.here" ,
40
41
} ) ;
42
+ const elementCallWidget = new Widget ( {
43
+ id : "group_call" ,
44
+ creatorUserId : "@alice:example.org" ,
45
+ type : MatrixWidgetType . Custom ,
46
+ url : "https://call.element.io" ,
47
+ } ) ;
41
48
let settings : Record < string , any > = { } ; // key value store
42
49
43
50
beforeEach ( ( ) => {
@@ -92,4 +99,10 @@ describe("WidgetPermissionStore", () => {
92
99
const store2 = context . widgetPermissionStore ;
93
100
expect ( store2 ) . toStrictEqual ( store ) ;
94
101
} ) ;
102
+ it ( "auto-approves OIDC requests for element-call" , async ( ) => {
103
+ new StopGapWidgetDriver ( [ ] , elementCallWidget , WidgetKind . Room , true , roomId ) ;
104
+ expect ( widgetPermissionStore . getOIDCState ( elementCallWidget , WidgetKind . Room , roomId ) ) . toEqual (
105
+ OIDCState . Allowed ,
106
+ ) ;
107
+ } ) ;
95
108
} ) ;
0 commit comments