File tree Expand file tree Collapse file tree 3 files changed +56
-1
lines changed
Expand file tree Collapse file tree 3 files changed +56
-1
lines changed Original file line number Diff line number Diff line change 1+ export class PublicClientApplication {
2+ constructor(configuration: any) {
3+ // Mock constructor
4+ }
5+
6+ initialize() {
7+ // Mock initialize method
8+ }
9+
10+ acquireTokenSilent() {
11+ // Mock acquireTokenSilent method
12+ return Promise.resolve({ accessToken: 'mock-access-token' });
13+ }
14+
15+ acquireTokenPopup() {
16+ // Mock acquireTokenPopup method
17+ return Promise.resolve({ accessToken: 'mock-access-token' });
18+ }
19+
20+ loginPopup() {
21+ // Mock loginPopup method
22+ return Promise.resolve({ account: { username: 'mock-user' } });
23+ }
24+
25+ logout() {
26+ // Mock logout method
27+ return Promise.resolve();
28+ }
29+ }
Original file line number Diff line number Diff line change @@ -27,6 +27,20 @@ export const configuration: Configuration = {
2727 if ( containsPii ) {
2828 return ;
2929 }
30+ switch ( level ) {
31+ case LogLevel . Error :
32+ console . error ( message ) ;
33+ return ;
34+ case LogLevel . Info :
35+ console . info ( message ) ;
36+ return ;
37+ case LogLevel . Verbose :
38+ console . debug ( message ) ;
39+ return ;
40+ case LogLevel . Warning :
41+ console . warn ( message ) ;
42+ return ;
43+ }
3044 } ,
3145 piiLoggingEnabled : false
3246 }
Original file line number Diff line number Diff line change 11import { GlobalWithFetchMock } from 'jest-fetch-mock' ;
22import 'jest-canvas-mock' ;
3+ import crypto from 'crypto' ;
34
45const customGlobal : GlobalWithFetchMock = global as unknown as GlobalWithFetchMock ;
56customGlobal . fetch = require ( 'jest-fetch-mock' ) ; // tslint:disable-line
6- customGlobal . fetchMock = customGlobal . fetch ;
7+ customGlobal . fetchMock = customGlobal . fetch ;
8+
9+ Object . defineProperty ( global , 'crypto' , {
10+ writable : true ,
11+ value : {
12+ getRandomValues : ( arr : Uint8Array ) => crypto . getRandomValues ( arr ) ,
13+ subtle : { }
14+ }
15+ } ) ;
16+
17+ // Mock MSAL
18+ jest . mock ( '@azure/msal-browser' ) ;
You can’t perform that action at this time.
0 commit comments