Skip to content

Commit 943bd18

Browse files
committed
refactor: move db name to constants
1 parent 3730594 commit 943bd18

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

example/src/tests/db.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import { open } from 'react-native-nitro-sqlite'
77

88
const chance = new Chance()
99

10+
export const TEST_DB_NAME = 'test'
11+
1012
export let testDb: NitroSQLiteConnection | undefined
1113
export function resetTestDb() {
1214
try {
@@ -15,13 +17,15 @@ export function resetTestDb() {
1517
testDb.delete()
1618
}
1719
testDb = open({
18-
name: 'test',
20+
name: TEST_DB_NAME,
1921
})
2022
} catch (e) {
2123
console.warn('Error resetting user database', e)
2224
}
2325
}
2426

27+
const LARGE_DB_NAME = 'large'
28+
2529
// Copyright 2024 Oscar Franco
2630
// Taken from "op-sqlite" example project.
2731
// Used to demonstrate the performance of NitroSQLite.
@@ -34,7 +38,7 @@ export function resetLargeDb() {
3438
largeDb.delete()
3539
}
3640
largeDb = open({
37-
name: 'large',
41+
name: LARGE_DB_NAME,
3842
})
3943

4044
largeDb.execute(

0 commit comments

Comments
 (0)