From 52133bd9687d660ebe7a3b592a5a2fa85f0c6d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Rebours?= Date: Thu, 28 Oct 2021 18:53:03 +0200 Subject: [PATCH] error with default import --- __mocks__/@react-native-async-storage/async-storage.js | 2 +- browser-version/lib/storage.react-native.js | 3 ++- test/react-native/persistence.test.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/__mocks__/@react-native-async-storage/async-storage.js b/__mocks__/@react-native-async-storage/async-storage.js index e312481..21cd2ec 100644 --- a/__mocks__/@react-native-async-storage/async-storage.js +++ b/__mocks__/@react-native-async-storage/async-storage.js @@ -1 +1 @@ -module.exports = require('@react-native-async-storage/async-storage/jest/async-storage-mock') +module.exports.default = require('@react-native-async-storage/async-storage/jest/async-storage-mock') diff --git a/browser-version/lib/storage.react-native.js b/browser-version/lib/storage.react-native.js index 977d232..11a0af7 100755 --- a/browser-version/lib/storage.react-native.js +++ b/browser-version/lib/storage.react-native.js @@ -6,7 +6,8 @@ * * This version is the react-native version */ -const AsyncStorage = require('@react-native-async-storage/async-storage') +const AsyncStorage = require('@react-native-async-storage/async-storage').default + const exists = (filename, cback) => { // eslint-disable-next-line node/handle-callback-err AsyncStorage.getItem(filename, (err, value) => { diff --git a/test/react-native/persistence.test.js b/test/react-native/persistence.test.js index 69b4735..7349a85 100644 --- a/test/react-native/persistence.test.js +++ b/test/react-native/persistence.test.js @@ -1,7 +1,7 @@ /* eslint-env jest */ // Forked from https://github.com/antoniopresto/react-native-local-mongodb/blob/93acbc8a9aaca86aed1d632855cd8b984501147b/test/persistence.test.js const { promisify } = require('util') -const AsyncStorage = require('@react-native-async-storage/async-storage') +const AsyncStorage = require('@react-native-async-storage/async-storage').default const DataStore = require('../../') const getDb = async () => {