1
+ import { describe , it } from 'mocha' ;
2
+ import { expect } from 'chai' ;
3
+ import { createGraphBetaServiceClient } from '@microsoft/msgraph-beta-sdk' ;
4
+
5
+ // Simple mock request adapter for testing
6
+ class MockRequestAdapter {
7
+ public baseUrl : string | undefined = undefined ;
8
+
9
+ constructor ( baseUrl ?: string ) {
10
+ this . baseUrl = baseUrl ;
11
+ }
12
+ }
13
+
14
+ describe ( "GraphBetaServiceClient Base URL Tests" , ( ) => {
15
+ it ( "should set default base URL to beta endpoint when undefined" , ( ) => {
16
+ const mockAdapter = new MockRequestAdapter ( ) ;
17
+
18
+ // Call the function which should set the default base URL
19
+ createGraphBetaServiceClient ( mockAdapter as any ) ;
20
+
21
+ expect ( mockAdapter . baseUrl ) . to . equal ( "https://graph.microsoft.com/beta" ) ;
22
+ } ) ;
23
+
24
+ it ( "should set default base URL to beta endpoint when empty string" , ( ) => {
25
+ const mockAdapter = new MockRequestAdapter ( "" ) ;
26
+
27
+ // Call the function which should set the default base URL
28
+ createGraphBetaServiceClient ( mockAdapter as any ) ;
29
+
30
+ expect ( mockAdapter . baseUrl ) . to . equal ( "https://graph.microsoft.com/beta" ) ;
31
+ } ) ;
32
+
33
+ it ( "should not override existing base URL" , ( ) => {
34
+ const customUrl = "https://custom.graph.endpoint.com/beta" ;
35
+ const mockAdapter = new MockRequestAdapter ( customUrl ) ;
36
+
37
+ // Call the function which should NOT override the existing URL
38
+ createGraphBetaServiceClient ( mockAdapter as any ) ;
39
+
40
+ expect ( mockAdapter . baseUrl ) . to . equal ( customUrl ) ;
41
+ } ) ;
42
+ } ) ;
0 commit comments