forked from zingolabs/zingo-mobile
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests(scanner): Update Jest snapshot file for `react-native-vision-ca…
…mera`
- Loading branch information
Showing
3 changed files
with
34 additions
and
4 deletions.
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,21 @@ | ||
// Simple mock for Camera | ||
export const Camera = () => null; | ||
|
||
// Mock that returns a mocked camera object | ||
export const useCameraDevice = jest.fn(() => ({ | ||
id: 'mocked-camera', | ||
name: 'Mock Camera', | ||
position: 'back', | ||
})); | ||
|
||
// Mock that returns permission status and a request function | ||
export const useCameraPermission = jest.fn(() => ({ | ||
hasPermission: true, | ||
requestPermission: jest.fn(), | ||
})); | ||
|
||
// Mock that provides a mocked scanner function | ||
export const useCodeScanner = jest.fn(() => ({ | ||
codeTypes: ['qr', 'ean-13'], | ||
onCodeScanned: jest.fn(), | ||
})); |
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,11 +1,22 @@ | ||
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); | ||
|
||
const { resolver: defaultResolver } = getDefaultConfig.getDefaultValues(); | ||
|
||
/** | ||
* Metro configuration | ||
* https://reactnative.dev/docs/metro | ||
* | ||
* @type {import('metro-config').MetroConfig} | ||
*/ | ||
const config = {}; | ||
|
||
/** | ||
* See https://react-native-vision-camera.com/docs/guides/mocking for more information. | ||
*/ | ||
const config = { | ||
resolver: { | ||
...defaultResolver, | ||
sourceExts: [process.env.RN_SRC_EXT && process.env.RN_SRC_EXT.split(','), ...defaultResolver.sourceExts], | ||
}, | ||
}; | ||
|
||
module.exports = mergeConfig(getDefaultConfig(__dirname), config); |