-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
export class PublicClientApplication { | ||
constructor(configuration: any) { | ||
// Mock constructor | ||
} | ||
|
||
initialize() { | ||
// Mock initialize method | ||
} | ||
|
||
acquireTokenSilent() { | ||
// Mock acquireTokenSilent method | ||
return Promise.resolve({ accessToken: 'mock-access-token' }); | ||
} | ||
|
||
acquireTokenPopup() { | ||
// Mock acquireTokenPopup method | ||
return Promise.resolve({ accessToken: 'mock-access-token' }); | ||
} | ||
|
||
loginPopup() { | ||
// Mock loginPopup method | ||
return Promise.resolve({ account: { username: 'mock-user' } }); | ||
} | ||
|
||
logout() { | ||
// Mock logout method | ||
return Promise.resolve(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,18 @@ | ||
import { GlobalWithFetchMock } from 'jest-fetch-mock'; | ||
import 'jest-canvas-mock'; | ||
import crypto from 'crypto'; | ||
|
||
const customGlobal: GlobalWithFetchMock = global as unknown as GlobalWithFetchMock; | ||
customGlobal.fetch = require('jest-fetch-mock'); // tslint:disable-line | ||
customGlobal.fetchMock = customGlobal.fetch; | ||
customGlobal.fetchMock = customGlobal.fetch; | ||
|
||
Object.defineProperty(global, 'crypto', { | ||
writable: true, | ||
value: { | ||
getRandomValues: (arr: Uint8Array) => crypto.getRandomValues(arr), | ||
subtle: {} | ||
} | ||
}); | ||
|
||
// Mock MSAL | ||
jest.mock('@azure/msal-browser'); |