aboutsummaryrefslogtreecommitdiff
path: root/test/actions
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-09-11 21:37:32 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-09-11 21:37:32 +0900
commit2190a525b40a102851121c40654dcde2bb5ac6b3 (patch)
tree88915e03b3cc022eb43ef814cce18dab0b8b510e /test/actions
parentbf890a6d9d793b581a44ee267616ed589f429bef (diff)
add command actions test
Diffstat (limited to 'test/actions')
-rw-r--r--test/actions/command.test.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/test/actions/command.test.js b/test/actions/command.test.js
new file mode 100644
index 0000000..01a67f2
--- /dev/null
+++ b/test/actions/command.test.js
@@ -0,0 +1,51 @@
+import { expect } from "chai";
+import actions from '../../src/actions';
+import * as commandActions from '../../src/actions/command';
+
+describe("command actions", () => {
+ describe("exec", () => {
+ context("open command", () => {
+ it('create COMMAND_OPEN_URL acion with a full url', () => {
+ let action = commandActions.exec("open https://github.com/")
+ expect(action.type).to.equal(actions.COMMAND_OPEN_URL);
+ expect(action.url).to.equal('https://github.com/');
+ });
+
+ it('create COMMAND_OPEN_URL acion with a domain name', () => {
+ let action = commandActions.exec("open github.com")
+ expect(action.type).to.equal(actions.COMMAND_OPEN_URL);
+ expect(action.url).to.equal('http://github.com');
+ });
+ });
+
+ context("tabopen command", () => {
+ it('create COMMAND_TABOPEN_URL acion with a full url', () => {
+ let action = commandActions.exec("tabopen https://github.com/")
+ expect(action.type).to.equal(actions.COMMAND_TABOPEN_URL);
+ expect(action.url).to.equal('https://github.com/');
+ });
+
+ it('create COMMAND_TABOPEN_URL acion with a domain name', () => {
+ let action = commandActions.exec("tabopen github.com")
+ expect(action.type).to.equal(actions.COMMAND_TABOPEN_URL);
+ expect(action.url).to.equal('http://github.com');
+ });
+ });
+
+ context("buffer command", () => {
+ it('create COMMAND_BUFFER acion with a keywords', () => {
+ let action = commandActions.exec("buffer foo bar")
+ expect(action.type).to.equal(actions.COMMAND_BUFFER);
+ expect(action.keywords).to.equal('foo bar');
+ });
+ });
+
+ context("b command", () => {
+ it('create COMMAND_BUFFER acion with a keywords', () => {
+ let action = commandActions.exec("b foo bar")
+ expect(action.type).to.equal(actions.COMMAND_BUFFER);
+ expect(action.keywords).to.equal('foo bar');
+ });
+ });
+ });
+});