Skip to content

Commit

Permalink
refactor: Use react-native-cookies' provided mock
Browse files Browse the repository at this point in the history
When executed in Jest, react-native-cookies already return a mock so we
don't need to handle it by ourselves
  • Loading branch information
Ldoppea committed Jun 17, 2022
1 parent 678733e commit b421ead
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions src/libs/cozyAppBundle/cozyAppBundleConfiguration.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ import {

import strings from '/strings.json'

jest.mock('@react-native-async-storage/async-storage', () => ({
getItem: jest.fn(),
setItem: jest.fn()
}))

describe('cozyAppBundleConfiguration', () => {
beforeEach(() => {
AsyncStorage.clear()
jest.clearAllMocks()
})

Expand Down
6 changes: 1 addition & 5 deletions src/libs/httpserver/httpCookieManager.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ jest.mock('@react-native-cookies/cookies', () => ({
set: jest.fn()
}))

jest.mock('@react-native-async-storage/async-storage', () => ({
getItem: jest.fn(),
setItem: jest.fn()
}))

jest.mock('cozy-client', () => ({
...jest.requireActual('cozy-client'),
useAppsInMaintenance: jest.fn()
Expand All @@ -25,6 +20,7 @@ describe('httpCookieManager', () => {
const client = createMockClient({})

beforeEach(() => {
AsyncStorage.clear()
jest.clearAllMocks()
})

Expand Down

0 comments on commit b421ead

Please sign in to comment.