Skip to content

Commit 492a2cb

Browse files
fix: tests
1 parent a5f4ed5 commit 492a2cb

File tree

3 files changed

+22
-15
lines changed

3 files changed

+22
-15
lines changed

e2e/config.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"maxWorkers": 1,
3-
"testEnvironment": "./environment",
4-
"testRunner": "jest-circus/runner",
5-
"testTimeout": 120000,
6-
"testRegex": "\\.e2e\\.js$",
7-
"reporters": ["detox/runners/jest/streamlineReporter"],
8-
"verbose": true
2+
"maxWorkers": 1,
3+
"testEnvironment": "./environment",
4+
"testRunner": "jest-circus/runner",
5+
"testTimeout": 120000,
6+
"testRegex": "\\.e2e\\.js$",
7+
"reporters": ["detox/runners/jest/streamlineReporter"],
8+
"verbose": true
99
}

example/README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,29 @@ This repository contains example app which use the Amazon IVS iOS and Android br
44

55
## Setting up and running application
66

7-
1. Add `rtmpsUrl` and `streamKey` values to [`./app.json`](app.json) file
7+
1. Add `rtmpsUrl` and `streamKey` values to [`./app.json`](app.json) file
88

99
2. Install modules
10+
1011
```sh
1112
$ yarn
1213
$ cd ios && pod install && cd ..
1314
```
1415

1516
3. Start `Metro Bundler`
17+
1618
```sh
1719
$ yarn start
1820
```
1921

2022
4. Run the example app on Android platform
23+
2124
```sh
2225
$ yarn android
2326
```
2427

2528
or on iOS platform
29+
2630
```sh
2731
$ yarn ios
2832
```

src/IVSBroadcastCameraView/__tests__/index.test.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async function testEventHandler<TName extends keyof IEventHandlers>(
5353
nativeSyntheticEvent: Partial<
5454
Parameters<NonNullable<INativeEventHandlers[TName]>>[number]
5555
>,
56-
nativeEvent: Parameters<NonNullable<IEventHandlers[TName]>>[number]
56+
nativeEvent?: Parameters<NonNullable<IEventHandlers[TName]>>[number][]
5757
) {
5858
const mockEventHandler = jest.fn();
5959
const ivsBroadcastCameraViewInstance = await getIVSBroadcastCameraView({
@@ -66,7 +66,7 @@ async function testEventHandler<TName extends keyof IEventHandlers>(
6666
nativeSyntheticEvent
6767
);
6868
nativeEvent
69-
? expect(mockEventHandler).toHaveBeenCalledWith(nativeEvent)
69+
? expect(mockEventHandler).toHaveBeenCalledWith(...nativeEvent)
7070
: expect(mockEventHandler).toHaveBeenCalled();
7171
}
7272

@@ -135,6 +135,7 @@ describe('Event handlers work as expected', () => {
135135
eventHandlerName: 'onBroadcastStateChanged' as const,
136136
...nativeSyntheticEventFactory<'onBroadcastStateChanged'>({
137137
stateStatus: 'CONNECTED',
138+
metadata: { sessionId: 'sessionId' },
138139
}),
139140
},
140141
{
@@ -173,7 +174,7 @@ describe('Event handlers work as expected', () => {
173174
await testEventHandler(
174175
eventHandlerName,
175176
nativeSyntheticEvent,
176-
nativeEvent ? Object.values(nativeEvent)[0] : undefined
177+
nativeEvent ? Object.values(nativeEvent) : undefined
177178
);
178179
}
179180
);
@@ -198,10 +199,12 @@ describe('Event handlers work as expected', () => {
198199
},
199200
},
200201
},
201-
{
202-
code: String(errorCode),
203-
...errorBasePayload,
204-
}
202+
[
203+
{
204+
code: String(errorCode),
205+
...errorBasePayload,
206+
},
207+
]
205208
);
206209
});
207210
});

0 commit comments

Comments
 (0)