Skip to content

Commit b421ead

Browse files
committed
refactor: Use react-native-cookies' provided mock
When executed in Jest, react-native-cookies already return a mock so we don't need to handle it by ourselves
1 parent 678733e commit b421ead

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

src/libs/cozyAppBundle/cozyAppBundleConfiguration.spec.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,9 @@ import {
77

88
import strings from '/strings.json'
99

10-
jest.mock('@react-native-async-storage/async-storage', () => ({
11-
getItem: jest.fn(),
12-
setItem: jest.fn()
13-
}))
14-
1510
describe('cozyAppBundleConfiguration', () => {
1611
beforeEach(() => {
12+
AsyncStorage.clear()
1713
jest.clearAllMocks()
1814
})
1915

src/libs/httpserver/httpCookieManager.spec.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ jest.mock('@react-native-cookies/cookies', () => ({
1111
set: jest.fn()
1212
}))
1313

14-
jest.mock('@react-native-async-storage/async-storage', () => ({
15-
getItem: jest.fn(),
16-
setItem: jest.fn()
17-
}))
18-
1914
jest.mock('cozy-client', () => ({
2015
...jest.requireActual('cozy-client'),
2116
useAppsInMaintenance: jest.fn()
@@ -25,6 +20,7 @@ describe('httpCookieManager', () => {
2520
const client = createMockClient({})
2621

2722
beforeEach(() => {
23+
AsyncStorage.clear()
2824
jest.clearAllMocks()
2925
})
3026

0 commit comments

Comments
 (0)