Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(client): Make
chatMessages
and sendChatMessage
always available
This change makes sure the chat fields on the client class are always present, so consumers don’t have to double check whether they are there before using them. This commit also moves the dummy transport logic out of the client and into a dedicated `DummyTransport`.
- Loading branch information
Showing
6 changed files
with
57 additions
and
46 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
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
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,21 @@ | ||
import { Transport } from './transport'; | ||
import type { TransportOpts } from './transport'; | ||
|
||
/** | ||
* This class doesn’t do anything, but simplifies the client class by providing | ||
* dummy functions to call, so we don’t need to mock them in the client. | ||
*/ | ||
class DummyImpl extends Transport { | ||
connect() {} | ||
disconnect() {} | ||
onAction() {} | ||
onChatMessage() {} | ||
subscribe() {} | ||
subscribeChatMessage() {} | ||
subscribeMatchData() {} | ||
updateCredentials() {} | ||
updateMatchID() {} | ||
updatePlayerID() {} | ||
} | ||
|
||
export const DummyTransport = (opts: TransportOpts) => new DummyImpl(opts); |