Skip to content

Commit

Permalink
fix: sonar fixes (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
mccarthytyler authored and GitHub Enterprise committed Jan 20, 2022
1 parent a1de883 commit 6e7ce8a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/media.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('ensureDevicePermissions', () => {
.mockReturnValueOnce(Promise.resolve(createPermissionStatus('granted')));

const testCallbackResponse = 'Test Callback Response';
const mockCallback = jest.fn(() => testCallbackResponse);
const mockCallback = jest.fn(async () => testCallbackResponse);

const callbackResponse = await media.ensureDevicePermissions(
[media.DeviceKind.AudioInput, media.DeviceKind.VideoInput],
Expand All @@ -97,7 +97,7 @@ describe('ensureDevicePermissions', () => {

await media.ensureDevicePermissions(
[media.DeviceKind.AudioInput, media.DeviceKind.VideoInput],
() => true
() => Promise.resolve(true)
);

expect(mockedNavigatorStub.mediaDevices.enumerateDevices).toHaveBeenCalledTimes(1);
Expand All @@ -121,7 +121,7 @@ describe('ensureDevicePermissions2', () => {

await media.ensureDevicePermissions(
[media.DeviceKind.AudioInput, media.DeviceKind.VideoInput],
() => true
() => Promise.resolve(true)
);

expect(mockedNavigatorStub.mediaDevices.getUserMedia.mock.calls).toHaveLength(1);
Expand Down
2 changes: 1 addition & 1 deletion src/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ async function checkDevicePermissions(deviceKinds: DeviceKind[]): Promise<boolea
*/
export async function ensureDevicePermissions<T>(
deviceKinds: DeviceKind[],
callback: () => T
callback: () => Promise<T>
): Promise<T> {
try {
const hasDevicePermissions = await checkDevicePermissions(deviceKinds);
Expand Down

0 comments on commit 6e7ce8a

Please sign in to comment.