Skip to content

Commit

Permalink
feat: upgrade to expo-sqlite@^14.0.3
Browse files Browse the repository at this point in the history
* feat: 🎸 upgrade to expo-sqlite@^14.0.3
* test: πŸ’ fixed tests
* fix: πŸ› downgrade eslint version
* fix: πŸ› downgrade eslint version
  • Loading branch information
FelipeBohnertPaetzold authored May 16, 2024
1 parent aff0a09 commit 9a60592
Show file tree
Hide file tree
Showing 9 changed files with 1,395 additions and 1,654 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ animalRepository.databaseLayer.bulkInsertOrReplace(itens).then(response => {
### Execute the migrations

```typescript
import * as SQLite from 'expo-sqlite'
import * as SQLite from 'expo-sqlite/legacy'
import { Migrations, sql } from 'expo-sqlite-orm'

const statements: IStatement = {
Expand Down
3 changes: 2 additions & 1 deletion __tests__/DatabaseLayer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jest.mock('../src/query_builder', () => {
}, {})
})

import { openDatabase } from "expo-sqlite"
import { openDatabase } from "expo-sqlite/legacy"
import { Database } from '../src/Database'
import { DatabaseLayer } from '../src/DatabaseLayer'
import Qb from '../src/query_builder'
Expand All @@ -31,6 +31,7 @@ interface ITests {
teste3: string
}

jest.mock('expo-sqlite/legacy')

const databaseName = 'databaseName'
const executeSql = jest.fn((sql, params, cb, errorCb) => {
Expand Down
3 changes: 2 additions & 1 deletion __tests__/Migrations.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
jest.mock('../src/DatabaseLayer')
import { openDatabase, SQLiteDatabase } from 'expo-sqlite'
import { openDatabase, SQLiteDatabase } from 'expo-sqlite/legacy'
import { IStatement, Migrations, sql } from '../src/Migrations'

jest.mock('expo-sqlite/legacy')

const databasenName = 'databaseName'

Expand Down
17 changes: 12 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
globals: {
'ts-jest': {
isolatedModules: true
}
}
setupFiles: [
"./setupTests.js"
],
transformIgnorePatterns: [],
transform: {
"\\.[jt]sx?$": [
"ts-jest",
{
isolatedModules: true
}
]
},
}
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
"lib/"
],
"devDependencies": {
"@types/jest": "^26.0.24",
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^5.33.1",
"@typescript-eslint/parser": "^5.33.1",
"babel-eslint": "^9.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^5.6.0",
"eslint-plugin-jest": "^21.22.0",
"expo-sqlite": "^11.6.0",
"jest": "^27.0.6",
"ts-jest": "^27.0.3",
"typescript": "^4.3.5"
"expo-sqlite": "^14.0.3",
"jest": "^29.7.0",
"ts-jest": "^29.1.2",
"typescript": "^5.4.5"
},
"peerDependencies": {
"expo-sqlite": "^11.6.0"
"expo-sqlite": "^14.0.3"
}
}
}
2 changes: 2 additions & 0 deletions setupTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
jest.mock('expo-modules-core', () => ({ requireNativeModule: jest.fn() }), { virtual: true })
jest.mock('react-native', () => ({}), { virtual: true })
4 changes: 2 additions & 2 deletions src/Database.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as SQLite from 'expo-sqlite'
import { SQLTransactionCallback, SQLTransactionErrorCallback, SQLiteDatabase } from 'expo-sqlite'
import * as SQLite from 'expo-sqlite/legacy'
import { SQLTransactionCallback, SQLTransactionErrorCallback, SQLiteDatabase } from 'expo-sqlite/legacy'

export class Database {
private databaseName: string
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"compilerOptions": {
"allowJs": true,
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
Expand Down
Loading

0 comments on commit 9a60592

Please sign in to comment.