expo-sqlite-mock 2.2.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -7,7 +7,8 @@ Use [expo-sqlite](https://docs.expo.dev/versions/latest/sdk/sqlite/) with jest.
7
7
 
8
8
  ## Notice
9
9
 
10
- - **~2.0.0** is for expo-sqlite >=52.
10
+ - **~3.0.0** is for expo-sqlite ~53.
11
+ - **~2.0.0** is for expo-sqlite ~52.
11
12
  - **~1.0.0** is for expo-sqlite ~51.
12
13
 
13
14
  ## Usage
@@ -52,6 +53,9 @@ it("test", async () => {
52
53
 
53
54
  ## Changelog
54
55
 
56
+ - **3.0.0**
57
+ - Compatible with expo-sqlite ~15 and expo ~53.
58
+
55
59
  - **2.2.0**
56
60
  - Compatible with drizzle
57
61
  - Clean up the code
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-sqlite-mock",
3
- "version": "2.2.0",
3
+ "version": "3.0.1",
4
4
  "license": "MIT",
5
5
  "homepage": "https://github.com/zfben/expo-sqlite-mock",
6
6
  "repository": {
@@ -16,7 +16,11 @@
16
16
  "jest": {
17
17
  "preset": "jest-expo",
18
18
  "testEnvironment": "node",
19
- "testRegex": "/*\\.test\\.tsx?$"
19
+ "testRegex": "/*\\.test\\.tsx?$",
20
+ "maxWorkers": 1,
21
+ "setupFilesAfterEnv": [
22
+ "<rootDir>/src/__tests__/setup.ts"
23
+ ]
20
24
  },
21
25
  "files": [
22
26
  "src/ExpoSQLiteNext.ts",
@@ -24,9 +28,9 @@
24
28
  ],
25
29
  "peerDependencies": {
26
30
  "better-sqlite3": "*",
27
- "jest": "*",
31
+ "jest": "~29",
28
32
  "expo-sqlite": "*",
29
- "expo": ">=52"
33
+ "expo": ">=53"
30
34
  },
31
35
  "devDependencies": {
32
36
  "typescript": "*",
@@ -34,14 +38,14 @@
34
38
  "expo-sqlite": "*",
35
39
  "better-sqlite3": "*",
36
40
  "@types/better-sqlite3": "*",
37
- "@types/react": "^18",
38
- "react": "^18",
39
- "react-test-renderer": "^18",
40
- "react-native": "~0.77",
41
- "@testing-library/react-native": "*",
42
- "jest-expo": "~52",
43
- "@types/jest": "*",
44
- "jest": "*",
41
+ "@types/react": "*",
42
+ "react": "*",
43
+ "react-test-renderer": "*",
44
+ "react-native": "~0.80",
45
+ "@testing-library/react-native": "~13",
46
+ "jest-expo": "~53",
47
+ "@types/jest": "~29",
48
+ "jest": "~29",
45
49
  "drizzle-orm": "*"
46
50
  }
47
51
  }
@@ -1,14 +1,19 @@
1
1
  import sqlite3 from 'better-sqlite3'
2
2
 
3
- import type { SQLiteOpenOptions } from 'expo-sqlite/src/NativeDatabase'
4
3
  import type {
5
- SQLiteBindBlobParams,
6
4
  SQLiteBindParams,
7
- SQLiteBindPrimitiveParams,
8
- SQLiteColumnNames,
9
- SQLiteColumnValues,
5
+ SQLiteBindValue,
6
+ SQLiteOpenOptions,
10
7
  SQLiteRunResult,
11
- } from 'expo-sqlite/src/NativeStatement'
8
+ } from 'expo-sqlite'
9
+
10
+ type SQLiteBindBlobParams = Record<string, Uint8Array>
11
+ type SQLiteBindPrimitiveParams = Record<
12
+ string,
13
+ Exclude<SQLiteBindValue, Uint8Array>
14
+ >
15
+ type SQLiteColumnNames = string[]
16
+ type SQLiteColumnValues = any[]
12
17
 
13
18
  const dbs: NativeDatabase[] = []
14
19
 
@@ -90,16 +95,14 @@ class NativeStatement {
90
95
 
91
96
  //#region Asynchronous API
92
97
 
93
- public runAsync = (
98
+ public runAsync = async (
94
99
  _database: NativeDatabase,
95
100
  bindParams: SQLiteBindPrimitiveParams,
96
101
  bindBlobParams: SQLiteBindBlobParams,
97
102
  shouldPassAsArray: boolean
98
103
  ): Promise<SQLiteRunResult & { firstRowValues: SQLiteColumnValues }> =>
99
- Promise.resolve(
100
- this._run(
101
- normalizeSQLite3Args(bindParams, bindBlobParams, shouldPassAsArray)
102
- )
104
+ this._run(
105
+ normalizeSQLite3Args(bindParams, bindBlobParams, shouldPassAsArray)
103
106
  )
104
107
  public stepAsync = (_database: NativeDatabase): Promise<any> => {
105
108
  if (this.iterator == null) {