Repository navigation
chore: Update media-signaling to 0.2.0 #7153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
100cc4e
slice: Test comments on DDP code
diegolmello de2d2f3
slice: Add mediaCallsStateSignals REST function
diegolmello b8107f9
slice: Upgrade @rocket.chat/media-signaling to 0.2.0-rc.0
diegolmello 66e1b55
slice: Add requestInitialStateSignals: false to MediaSessionStore
diegolmello 30a6f84
slice: Orchestrate REST stateSignals + DDP register(false) in init()
diegolmello 946ad98
fix(voip): null guard instance and add as any casts for removed libra…
diegolmello c150713
chore(voip): remove old media-signaling 0.1.3 tarball
diegolmello 026c563
slice: useCallStore participant model migration
diegolmello b700b46
slice: MediaSessionInstance participant model + cleanup
diegolmello 2143aba
slice: test mocks participant model restructure
diegolmello 87c7f83
Update media-signaling
diegolmello 4814629
lint
diegolmello 0f63304
update lib
diegolmello File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import type { ServerMediaSignal } from '@rocket.chat/media-signaling'; | ||
|
|
||
| import { mediaCallsStateSignals } from './restApi'; | ||
|
|
||
| const mockSdkGet = jest.fn(); | ||
| jest.mock('./sdk', () => ({ | ||
| __esModule: true, | ||
| default: { | ||
| get: (...args: unknown[]) => mockSdkGet(...args) | ||
| } | ||
| })); | ||
|
|
||
| describe('mediaCallsStateSignals', () => { | ||
| beforeEach(() => { | ||
| jest.clearAllMocks(); | ||
| }); | ||
|
|
||
| it('calls sdk.get with media-calls.stateSignals and the contractId', async () => { | ||
| mockSdkGet.mockResolvedValueOnce({ signals: [], success: true }); | ||
|
|
||
| const result = await mediaCallsStateSignals('device-contract-id-123'); | ||
|
|
||
| expect(mockSdkGet).toHaveBeenCalledWith('media-calls.stateSignals', { contractId: 'device-contract-id-123' }); | ||
| expect(result).toEqual({ signals: [], success: true }); | ||
| }); | ||
|
|
||
| it('returns signals and success from the API response', async () => { | ||
| const mockSignals = [ | ||
| { type: 'new', callId: 'call-1' } as unknown as ServerMediaSignal, | ||
| { type: 'notification', notification: 'ringing' } as unknown as ServerMediaSignal | ||
| ]; | ||
| mockSdkGet.mockResolvedValueOnce({ signals: mockSignals, success: true }); | ||
|
|
||
| const result = await mediaCallsStateSignals('device-id'); | ||
|
|
||
| expect(result.signals).toHaveLength(2); | ||
| expect(result.success).toBe(true); | ||
| }); | ||
|
|
||
| it('returns empty signals and success false when sdk.get throws', async () => { | ||
| mockSdkGet.mockRejectedValueOnce(new Error('Network error')); | ||
|
|
||
| const result = await mediaCallsStateSignals('device-id'); | ||
|
|
||
| expect(result.signals).toEqual([]); | ||
| expect(result.success).toBe(false); | ||
| }); | ||
|
|
||
| it('returns empty signals and success false when sdk.get returns an error response', async () => { | ||
| mockSdkGet.mockResolvedValueOnce({ signals: [], success: false }); | ||
|
|
||
| const result = await mediaCallsStateSignals('device-id'); | ||
|
|
||
| expect(result.signals).toEqual([]); | ||
| expect(result.success).toBe(false); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.