Skip to content

Commit 0c5f8ec

Browse files
committed
Preparing for easy switch between RNQS/OPSQLITE for tests.
1 parent d1fca4a commit 0c5f8ec

File tree

3 files changed

+18
-76
lines changed

3 files changed

+18
-76
lines changed

tools/powersynctests/src/App.tsx

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,12 @@
66
*/
77

88
import React from 'react';
9-
import {ScrollView, StatusBar, Text, useColorScheme, View} from 'react-native';
9+
import { SafeAreaView, ScrollView, StatusBar, useColorScheme } from 'react-native';
1010

11-
import {useQuery} from '@powersync/react';
12-
import {Colors} from 'react-native/Libraries/NewAppScreen';
13-
import {rootSuite} from './mocha/MochaRNAdapter';
14-
import {WithPowerSync} from './powersync/PowerSyncProvider';
15-
import {registerBaseTests} from './tests/queries.test';
16-
import {SuitWidget} from './widgets/SuitWidget';
17-
18-
function PowerSyncIndicator() {
19-
const {
20-
data: [versionResult],
21-
isLoading,
22-
} = useQuery<{version: string}>(
23-
/* sql */ `SELECT powersync_rs_version() as version;`,
24-
);
25-
return (
26-
<Text>
27-
PowerSync version: {isLoading ? 'Loading' : versionResult?.version}
28-
</Text>
29-
);
30-
}
11+
import { Colors } from 'react-native/Libraries/NewAppScreen';
12+
import { rootSuite } from './mocha/MochaRNAdapter';
13+
import { registerBaseTests } from './tests/queries.test';
14+
import { SuitWidget } from './widgets/SuitWidget';
3115

3216
function App(): React.JSX.Element {
3317
const isDarkMode = useColorScheme() === 'dark';
@@ -49,20 +33,18 @@ function App(): React.JSX.Element {
4933
const safePadding = '5%';
5034

5135
return (
52-
<WithPowerSync>
53-
<View style={backgroundStyle}>
54-
<StatusBar
55-
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
56-
backgroundColor={backgroundStyle.backgroundColor}
57-
/>
58-
<ScrollView style={backgroundStyle}>
59-
<PowerSyncIndicator />
60-
{rootSuite.suites.map(suite => (
61-
<SuitWidget key={suite.title} suit={suite} />
62-
))}
63-
</ScrollView>
64-
</View>
65-
</WithPowerSync>
36+
<SafeAreaView style={backgroundStyle}>
37+
<StatusBar
38+
barStyle={isDarkMode ? 'light-content' : 'dark-content'}
39+
backgroundColor={backgroundStyle.backgroundColor}
40+
/>
41+
<ScrollView style={backgroundStyle}>
42+
{/* <PowerSyncIndicator /> */}
43+
{rootSuite.suites.map(suite => (
44+
<SuitWidget key={suite.title} suit={suite} />
45+
))}
46+
</ScrollView>
47+
</SafeAreaView>
6648
);
6749
}
6850

tools/powersynctests/src/powersync/PowerSyncProvider.tsx

Lines changed: 0 additions & 40 deletions
This file was deleted.

tools/powersynctests/src/tests/queries.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,7 @@ export function registerBaseTests() {
621621
expect(duration).lessThan(2000);
622622
});
623623

624+
// // TODO: Behaviour differs between RNQS and OP-sqlite. Might need to fix this one in the OP-sqlite package
624625
// it('Should handle multiple closes', async () => {
625626
// // // Bulk insert 50000 rows without using a transaction
626627
// const bulkInsertCommands = [];
@@ -651,7 +652,6 @@ export function registerBaseTests() {
651652

652653
// await db.close();
653654

654-
// // TODO: Might need to fix this one in the package
655655
// // const results = await Promise.allSettled(tests);
656656
// // expect(results.map(r => r.status)).deep.equal(
657657
// // Array(tests.length).fill('rejected'),

0 commit comments

Comments
 (0)