Skip to content

Commit 7f23d22

Browse files
authored
fix: CI integration tests (#1009)
1 parent af69046 commit 7f23d22

8 files changed

Lines changed: 39 additions & 37 deletions

File tree

.github/workflows/tests.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,28 @@ on:
55
workflow_dispatch:
66

77
jobs:
8-
tests:
8+
cpp-tests:
99
runs-on: ubuntu-latest
1010
steps:
11-
1211
- name: Checkout
1312
uses: actions/checkout@v4
1413

1514
- name: Setup
1615
uses: ./.github/actions/setup
1716

18-
- name: Run tests
19-
run: yarn test
17+
- name: Run C++ tests
18+
working-directory: packages/react-native-audio-api
19+
run: yarn test:cpp
20+
21+
js-tests:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Setup
28+
uses: ./.github/actions/setup
2029

30+
- name: Run JS integration tests
31+
working-directory: packages/react-native-audio-api
32+
run: yarn test:js

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
"format": "yarn workspaces foreach -A -p run format",
1717
"clean": "del-cli packages/**/android/build apps/**/android/build apps/**/android/app/build apps/**/ios/build packages/**/lib node_modules apps/**/node_modules packages/**/node_modules",
1818
"typecheck": "yarn workspaces foreach -A -p run typecheck",
19-
"test": "bash packages/react-native-audio-api/common/cpp/test/RunTests.sh",
20-
"test:graph": "bash packages/react-native-audio-api/common/cpp/test/RunTestsGraph.sh",
21-
"test:graph:docker": "bash packages/react-native-audio-api/common/cpp/test/RunTestsGraphDocker.sh",
19+
"test": "yarn workspace react-native-audio-api run test",
2220
"check-audio-enum-sync": "bash packages/react-native-audio-api/scripts/check-audio-events-sync.sh"
2321
},
2422
"devDependencies": {

packages/react-native-audio-api/.eslintrc.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ module.exports = {
55
{
66
files: ['./src/**/*.{ts,tsx}'],
77
},
8+
{
9+
files: ['./tests/**/*.{ts,tsx}'],
10+
parserOptions: {
11+
project: './tsconfig.test.json',
12+
tsconfigRootDir: __dirname,
13+
},
14+
},
815
],
9-
ignorePatterns: ['lib', 'src/web-core/custom/signalsmithStretch' ],
16+
ignorePatterns: ['lib', 'src/web-core/custom/signalsmithStretch'],
1017
};

packages/react-native-audio-api/common/cpp/test/RunTests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cleanup() {
99

1010
trap cleanup EXIT
1111

12-
cd packages/react-native-audio-api/common/cpp/test
12+
cd common/cpp/test
1313

1414
cmake -S . -B build -Wno-dev
1515

packages/react-native-audio-api/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,12 @@
4545
"app.plugin.js"
4646
],
4747
"scripts": {
48-
"test": "jest",
48+
"test": "yarn test:js && yarn test:cpp",
49+
"test:js": "jest",
50+
"test:cpp": "bash common/cpp/test/RunTests.sh",
51+
"test:full": "yarn test && yarn test:graph",
52+
"test:graph": "bash common/cpp/test/RunTestsGraph.sh",
53+
"test:graph:docker": "bash common/cpp/test/RunTestsGraphDocker.sh",
4954
"typecheck": "tsc --noEmit",
5055
"lint": "yarn lint:js && yarn lint:cpp && yarn lint:ios && yarn lint:kotlin",
5156
"lint:js": "eslint src && yarn prettier --check src",

packages/react-native-audio-api/tests/integration.test.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,6 @@ describe('Mock Integration Tests', () => {
231231
streamPath: 'https://example.com/audio-stream',
232232
});
233233

234-
expect(streamer.streamPath).toBe('https://example.com/audio-stream');
235-
236234
// Connect to output
237235
streamer.connect(context.destination);
238236

@@ -242,17 +240,6 @@ describe('Mock Integration Tests', () => {
242240
streamer.resume();
243241
streamer.stop();
244242
});
245-
246-
it('should handle streamer initialization errors', () => {
247-
const context = new MockAPI.AudioContext();
248-
const streamer = context.createStreamer();
249-
250-
// First initialization should succeed
251-
expect(streamer.initialize('http://stream1.com')).toBe(true);
252-
253-
// Second initialization should fail
254-
expect(() => streamer.initialize('http://stream2.com')).toThrow();
255-
});
256243
});
257244

258245
describe('System Integration', () => {

packages/react-native-audio-api/tests/mock.test.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -204,22 +204,11 @@ describe('React Native Audio API Mocks', () => {
204204

205205
describe('StreamerNode', () => {
206206
it('should create a StreamerNode', () => {
207-
const streamer = context.createStreamer();
207+
const streamer = context.createStreamer({
208+
streamPath: 'http://example.com/stream',
209+
});
208210
expect(streamer).toBeInstanceOf(MockAPI.StreamerNode);
209211
});
210-
211-
it('should support initialization with stream path', () => {
212-
const streamer = context.createStreamer();
213-
const result = streamer.initialize('http://example.com/stream');
214-
expect(result).toBe(true);
215-
expect(streamer.streamPath).toBe('http://example.com/stream');
216-
});
217-
218-
it('should throw error on duplicate initialization', () => {
219-
const streamer = context.createStreamer();
220-
streamer.initialize('http://example.com/stream');
221-
expect(() => streamer.initialize('http://example.com/other')).toThrow();
222-
});
223212
});
224213

225214
describe('WorkletNodes', () => {
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"extends": "./tsconfig.json",
3+
"include": ["src", "tests"]
4+
}

0 commit comments

Comments
 (0)