Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 🎸 upgrade to expo-sqlite@^14.0.3 #72

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading