Skip to content

Commit a20cd6b

Browse files
feat: add SWC support for TypeScript and Jest
- Updated package.json to include @swc/core and @swc/jest as devDependencies. - Modified jest.config.js to use @swc/jest for TypeScript transformation. - Added new tests for IndexedDB backend functionality, including overwriting keys, clearing storage, and handling multiple backends. - Enhanced internal helper tests to include special number serialization and version token generation. - Implemented additional tests for storage APIs, including transaction rollbacks and secure storage behavior. - Introduced cross-tab StorageEvent handling tests for web storage interactions. - Added biometric storage tests to ensure proper handling of secure items.
1 parent 72de42f commit a20cd6b

23 files changed

Lines changed: 1137 additions & 170 deletions

.github/workflows/ci.yml

Lines changed: 22 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,53 @@
11
name: CI
22

33
on:
4-
push:
5-
branches: [main]
64
pull_request:
75
branches: [main]
86

7+
env:
8+
TZ: UTC
9+
BUN_VERSION: "1.3.9"
10+
911
jobs:
1012
quality:
11-
name: Quality Checks
13+
name: Lint, Typecheck & Unit Tests
1214
runs-on: ubuntu-latest
1315

1416
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v4
17+
- uses: actions/checkout@v4
1718

18-
- name: Setup Bun
19-
uses: oven-sh/setup-bun@v2
19+
- uses: oven-sh/setup-bun@v2
2020
with:
21-
bun-version: 1.3.9
21+
bun-version: ${{ env.BUN_VERSION }}
2222

23-
- name: Cache dependencies
24-
uses: actions/cache@v4
23+
- uses: actions/cache@v4
2524
with:
2625
path: |
2726
~/.bun/install/cache
2827
node_modules
2928
packages/*/node_modules
3029
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
31-
restore-keys: |
32-
${{ runner.os }}-bun-
30+
restore-keys: ${{ runner.os }}-bun-
31+
32+
- run: bun install
3333

34-
- name: Install dependencies
35-
run: bun install
34+
- name: Lint
35+
run: bun run lint
3636

37-
- name: Run type checking
37+
- name: Format check
38+
run: bun run format:check
39+
40+
- name: Typecheck
3841
run: bun run typecheck
3942

40-
- name: Run type-level API tests
43+
- name: Type-level API tests
4144
run: bun run test:types
4245

43-
- name: Run JavaScript tests
44-
run: bun run test
45-
46-
- name: Run JavaScript tests with coverage
46+
- name: Unit tests with coverage
4747
run: bun run test:coverage
4848

49-
- name: Run benchmark regression checks
49+
- name: Benchmark regression checks
5050
run: bun run benchmark
5151

52-
- name: Setup CMake (for C++ tests)
53-
run: |
54-
cmake --version
55-
gcc --version || clang --version || echo "C++ compiler available"
56-
57-
- name: Run C++ tests
52+
- name: C++ tests
5853
run: bun run test:cpp
59-
60-
- name: Build packages
61-
run: bun run build
62-
63-
- name: Verify build artifacts
64-
run: |
65-
# Check that lib directories were created
66-
[ -d "packages/react-native-nitro-storage/lib" ] || exit 1
67-
# Check that TypeScript definitions exist
68-
[ -f "packages/react-native-nitro-storage/lib/typescript/index.d.ts" ] || exit 1
69-
# Check that all build targets exist
70-
[ -d "packages/react-native-nitro-storage/lib/commonjs" ] || exit 1
71-
[ -d "packages/react-native-nitro-storage/lib/module" ] || exit 1
72-
echo "✅ Build artifacts verified"
73-
74-
- name: Test package packaging
75-
run: |
76-
cd packages/react-native-nitro-storage
77-
bun run check:pack
78-
79-
build-example-android:
80-
name: Android Example Build
81-
runs-on: ubuntu-latest
82-
needs: quality
83-
84-
steps:
85-
- name: Checkout code
86-
uses: actions/checkout@v4
87-
88-
- name: Setup Bun
89-
uses: oven-sh/setup-bun@v2
90-
with:
91-
bun-version: 1.3.9
92-
93-
- name: Setup Java
94-
uses: actions/setup-java@v4
95-
with:
96-
distribution: temurin
97-
java-version: "17"
98-
99-
- name: Install dependencies
100-
run: bun install
101-
102-
- name: Expo prebuild (Android)
103-
run: bun run example:prebuild:clean -- -- --platform android --non-interactive
104-
env:
105-
EXPO_NO_TELEMETRY: 1
106-
107-
- name: Gradle build check
108-
working-directory: apps/example/android
109-
run: ./gradlew assembleDebug --no-daemon -q
110-

apps/example/.maestro/02_disk.yaml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ name: "Disk Scope"
66
- waitForAnimationToEnd:
77
timeout: 5000
88

9-
# Scroll to disk name input
9+
# Scroll to make disk card fully visible
1010
- scrollUntilVisible:
1111
element:
12-
id: "disk-name-input"
12+
id: "disk-has-value"
1313
direction: DOWN
14-
timeout: 10000
14+
timeout: 30000
1515
centerElement: true
1616

17-
# Enter name
17+
# Enter name — tap input, erase, type, then dismiss keyboard
1818
- tapOn:
1919
id: "disk-name-input"
2020
- eraseText: 50
@@ -23,16 +23,11 @@ name: "Disk Scope"
2323
- hideKeyboard
2424
- waitForAnimationToEnd
2525

26-
# Scroll to save button and tap
27-
- scrollUntilVisible:
28-
element:
29-
id: "disk-save"
30-
direction: DOWN
31-
timeout: 10000
32-
centerElement: true
26+
# Save
3327
- tapOn:
3428
id: "disk-save"
35-
- waitForAnimationToEnd
29+
- waitForAnimationToEnd:
30+
timeout: 2000
3631

3732
# Assert stored value and has value
3833
- assertVisible:

apps/example/.maestro/07_ns_auth.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: "Namespaced Auth Storage"
1111
element:
1212
id: "ns-auth-set-tokens"
1313
direction: DOWN
14-
timeout: 10000
14+
timeout: 30000
1515
centerElement: true
1616

1717
# Verify initial state is empty for both tokens

apps/example/.maestro/08_utils.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: "Storage Utils"
1111
element:
1212
id: "util-disk-size"
1313
direction: DOWN
14-
timeout: 10000
14+
timeout: 30000
1515
centerElement: true
1616

1717
# Verify disk and memory size elements are visible

apps/example/.maestro/09_hooks.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: "Hooks"
1111
element:
1212
id: "hook-count-increment"
1313
direction: DOWN
14-
timeout: 10000
14+
timeout: 30000
1515
centerElement: true
1616

1717
# Tap increment 3 times
@@ -47,7 +47,7 @@ name: "Hooks"
4747
element:
4848
id: "hook-selected-theme"
4949
direction: DOWN
50-
timeout: 10000
50+
timeout: 30000
5151
centerElement: true
5252

5353
# Assert theme is dark

apps/example/.maestro/10_validation.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: "Validation"
1111
element:
1212
id: "val-age-input"
1313
direction: DOWN
14-
timeout: 10000
14+
timeout: 30000
1515
centerElement: true
1616

1717
# Enter valid age 25
@@ -28,7 +28,7 @@ name: "Validation"
2828
element:
2929
id: "val-save"
3030
direction: DOWN
31-
timeout: 10000
31+
timeout: 30000
3232
centerElement: true
3333
- tapOn:
3434
id: "val-save"
@@ -44,7 +44,7 @@ name: "Validation"
4444
element:
4545
id: "val-age-input"
4646
direction: DOWN
47-
timeout: 10000
47+
timeout: 30000
4848
centerElement: true
4949

5050
# Enter invalid age 999
@@ -61,7 +61,7 @@ name: "Validation"
6161
element:
6262
id: "val-save"
6363
direction: DOWN
64-
timeout: 10000
64+
timeout: 30000
6565
centerElement: true
6666
- tapOn:
6767
id: "val-save"
@@ -77,7 +77,7 @@ name: "Validation"
7777
element:
7878
id: "val-inject"
7979
direction: DOWN
80-
timeout: 10000
80+
timeout: 30000
8181
centerElement: true
8282
- tapOn:
8383
id: "val-inject"

apps/example/.maestro/11_ttl.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: "TTL Expiration"
1111
element:
1212
id: "ttl-seed"
1313
direction: DOWN
14-
timeout: 10000
14+
timeout: 30000
1515
centerElement: true
1616

1717
# Tap seed
@@ -38,7 +38,7 @@ name: "TTL Expiration"
3838
element:
3939
id: "ttl-refresh"
4040
direction: DOWN
41-
timeout: 10000
41+
timeout: 30000
4242
centerElement: true
4343

4444
# Tap refresh to re-read value after TTL expired

apps/example/.maestro/12_transactions.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: "Transactions"
1111
element:
1212
id: "tx-commit"
1313
direction: DOWN
14-
timeout: 10000
14+
timeout: 30000
1515
centerElement: true
1616

1717
# Assert initial balance is 0
@@ -36,7 +36,7 @@ name: "Transactions"
3636
element:
3737
id: "tx-rollback"
3838
direction: DOWN
39-
timeout: 10000
39+
timeout: 30000
4040
centerElement: true
4141

4242
# Tap rollback — balance should remain 10 (rollback reverts the -25)
@@ -53,7 +53,7 @@ name: "Transactions"
5353
element:
5454
id: "tx-clear"
5555
direction: DOWN
56-
timeout: 10000
56+
timeout: 30000
5757
centerElement: true
5858
- tapOn:
5959
id: "tx-clear"

apps/example/.maestro/13_migrations.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: "Migrations"
1111
element:
1212
id: "mig-seed"
1313
direction: DOWN
14-
timeout: 10000
14+
timeout: 30000
1515
centerElement: true
1616
- tapOn:
1717
id: "mig-seed"
@@ -22,7 +22,7 @@ name: "Migrations"
2222
element:
2323
id: "mig-run"
2424
direction: DOWN
25-
timeout: 10000
25+
timeout: 30000
2626
centerElement: true
2727
- tapOn:
2828
id: "mig-run"

apps/example/.maestro/14_batch.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: "Batch Operations"
1111
element:
1212
id: "batch-v1"
1313
direction: DOWN
14-
timeout: 10000
14+
timeout: 30000
1515
centerElement: true
1616
- assertVisible:
1717
id: "batch-v1"
@@ -28,7 +28,7 @@ name: "Batch Operations"
2828
element:
2929
id: "batch-set"
3030
direction: DOWN
31-
timeout: 10000
31+
timeout: 30000
3232
centerElement: true
3333
- tapOn:
3434
id: "batch-set"

0 commit comments

Comments
 (0)