-
-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
services/chat: add Chatterino preset
Resolves #607
- Loading branch information
1 parent
a6aa5ed
commit 127a7a9
Showing
10 changed files
with
142 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
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,23 @@ | ||
import ChatProviderBasic from "./-basic"; | ||
import Parameter from "utils/parameters/Parameter"; | ||
|
||
|
||
/** | ||
* @class ChatProviderChatterino | ||
* @implements ChatProviderBasic | ||
*/ | ||
export default class ChatProviderChatterino extends ChatProviderBasic { | ||
// noinspection JSCheckFunctionSignatures | ||
async _getParameters() { | ||
return [ | ||
new Parameter( "--channels", null, "channel" ) | ||
]; | ||
} | ||
|
||
// noinspection JSCheckFunctionSignatures | ||
_getRuntimeContext({ name: channel }) { | ||
return Object.assign( {}, this.context, { | ||
channel: `t:${channel}` | ||
}); | ||
} | ||
} |
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,50 @@ | ||
import { module, test } from "qunit"; | ||
import sinon from "sinon"; | ||
|
||
import chatProviderInjector | ||
from "inject-loader?../launch!services/chat/providers/-provider"; | ||
import chatProviderBasicInjector | ||
from "inject-loader?./-provider!services/chat/providers/-basic"; | ||
import chatProviderChatterinoInjector | ||
from "inject-loader?./-provider!services/chat/providers/chatterino"; | ||
|
||
|
||
module( "services/chat/providers/chatterino", function( hooks ) { | ||
/** @typedef {Object} TestContextChatProviderChatterino */ | ||
hooks.beforeEach( /** @this {TestContextChatProviderChatterino} */ function() { | ||
this.launch = sinon.stub(); | ||
|
||
const { default: ChatProvider } = chatProviderInjector({ | ||
"../launch": this.launch | ||
}); | ||
|
||
const { default: ChatProviderBasic } = chatProviderBasicInjector({ | ||
"./-provider": ChatProvider | ||
}); | ||
|
||
const { default: ChatProviderChatterino } = chatProviderChatterinoInjector({ | ||
"./-basic": ChatProviderBasic | ||
}); | ||
|
||
this.subject = ChatProviderChatterino; | ||
}); | ||
|
||
|
||
test( "Default attributes", async function( assert ) { | ||
/** @this {TestContextChatProviderChatterino} */ | ||
const provider = new this.subject(); | ||
sinon.stub( provider, "_getExec" ).resolves( "/path/to/chatterino" ); | ||
|
||
await provider.setup( {}, {} ); | ||
await provider.launch( { name: "foo" }, {} ); | ||
|
||
assert.propEqual( | ||
this.launch.args, | ||
[[ | ||
"/path/to/chatterino", | ||
[ "--channels", "t:foo" ] | ||
]], | ||
"Spawns child process and uses the correct params" | ||
); | ||
}); | ||
}); |