-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw error on unsupported broadcaster (#396)
* Throw error on unsupported broadcaster * update CS * fix CS * fix cs * fix eslint * Removed return * fix CS * Update echo.ts * Update echo.test.ts --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
- Loading branch information
1 parent
786f814
commit b2931dc
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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,26 @@ | ||
import Echo from '../src/echo'; | ||
|
||
describe('Echo', () => { | ||
test('it will not throw error for supported driver', () => { | ||
expect(() => new Echo({ broadcaster: 'reverb' })).not.toThrowError( | ||
'Broadcaster string reverb is not supported.' | ||
); | ||
|
||
expect(() => new Echo({ broadcaster: 'pusher' })).not.toThrowError( | ||
'Broadcaster string pusher is not supported.' | ||
); | ||
|
||
expect(() => new Echo({ broadcaster: 'socket.io' })).not.toThrowError( | ||
'Broadcaster string socket.io is not supported.' | ||
); | ||
|
||
expect(() => new Echo({ broadcaster: 'null' })).not.toThrowError('Broadcaster string null is not supported.'); | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
expect(() => new Echo({ broadcaster: () => {} })).not.toThrowError('Broadcaster function is not supported.'); | ||
}); | ||
|
||
test('it will throw error for unsupported driver', () => { | ||
expect(() => new Echo({ broadcaster: 'foo' })).toThrowError('Broadcaster string foo is not supported.'); | ||
}); | ||
}); |