Skip to content

Commit

Permalink
use @jest/globals
Browse files Browse the repository at this point in the history
  • Loading branch information
trajano committed Dec 4, 2023
1 parent a16ed2e commit 1fee950
Show file tree
Hide file tree
Showing 3 changed files with 256 additions and 15 deletions.
5 changes: 3 additions & 2 deletions jest/mock.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* global jest */
import { jest } from '@jest/globals';
import React, { useContext } from 'react';
import type { Metrics } from '../src/SafeArea.types';
import type { SafeAreaProviderProps } from '../src/SafeAreaContext';
import type { SafeAreaProviderProps, SafeAreaInsetsContext, SafeAreaFrameContext } from '../src/SafeAreaContext';

const MOCK_INITIAL_METRICS: Metrics = {
frame: {
Expand All @@ -18,7 +19,7 @@ const MOCK_INITIAL_METRICS: Metrics = {
},
};

const RNSafeAreaContext = jest.requireActual('react-native-safe-area-context');
const RNSafeAreaContext = jest.requireActual<{SafeAreaInsetsContext:typeof SafeAreaInsetsContext, SafeAreaFrameContext: typeof SafeAreaFrameContext}>('react-native-safe-area-context');

export default {
...RNSafeAreaContext,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@
},
"devDependencies": {
"@commitlint/config-conventional": "^17.6.1",
"@jest/globals": "^29.7.0",
"@react-native-community/eslint-config": "^3.2.0",
"@react-native/eslint-plugin-specs": "^0.73.0",
"@release-it/conventional-changelog": "^5.1.1",
"@types/jest": "^29.5.1",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.1",
"@types/react-test-renderer": "^18.0.0",
Expand Down
Loading

0 comments on commit 1fee950

Please sign in to comment.