From a0cdb899cda604bdc44cb379ccb2bd71b946df5e Mon Sep 17 00:00:00 2001 From: Bryan Date: Tue, 30 May 2017 22:15:26 +0100 Subject: [PATCH] travis testing --- LICENSE | 20 ++++++++++++++++++ package.json | 39 +++++++++++++++++++++++++++++++++++ script/bootstrap | 18 ++++++++++++++++ script/test | 6 ++++++ test/hubot-strave_test.coffee | 22 ++++++++++++++++++++ 5 files changed, 105 insertions(+) create mode 100644 LICENSE create mode 100644 package.json create mode 100644 script/bootstrap create mode 100644 script/test create mode 100644 test/hubot-strave_test.coffee diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7391871 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2015 stephenyeargin + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/package.json b/package.json new file mode 100644 index 0000000..29e6114 --- /dev/null +++ b/package.json @@ -0,0 +1,39 @@ +{ + "name": "hubot-strava", + "description": "Get the latest activities from your Strava friends.", + "version": "0.0.1", + "author": "liquidstate", + "license": "MIT", + "keywords": [ + "hubot", + "hubot-scripts", + "strava" + ], + "repository": { + "type": "git", + "url": "git@github.com:liquidstate/hubot-strava.git" + }, + "bugs": { + "url": "https://github.com/liquidstate/hubot-strava/issues" + }, + "dependencies": { + }, + "devDependencies": { + "chai": "^3.5.0", + "coffee-script": "1.12.5", + "grunt": "^1.0.1", + "grunt-cli": "^1.2.0", + "grunt-contrib-watch": "~1.0.0", + "grunt-mocha-test": "~0.13.2", + "grunt-release": "~0.14.0", + "hubot": "2.x", + "matchdep": "~1.0.1", + "mocha": "^3.3.0", + "sinon": "^2.2.0", + "sinon-chai": "^2.10.0" + }, + "main": "index.coffee", + "scripts": { + "test": "grunt test" + } +} diff --git a/script/bootstrap b/script/bootstrap new file mode 100644 index 0000000..30e87e1 --- /dev/null +++ b/script/bootstrap @@ -0,0 +1,18 @@ +#!/bin/bash + +# Make sure everything is development forever +export NODE_ENV=development + +# Load environment specific environment variables +if [ -f .env ]; then + source .env +fi + +if [ -f .env.${NODE_ENV} ]; then + source .env.${NODE_ENV} +fi + +npm install + +# Make sure coffee and mocha are on the path +export PATH="node_modules/.bin:$PATH" diff --git a/script/test b/script/test new file mode 100644 index 0000000..bd23cb9 --- /dev/null +++ b/script/test @@ -0,0 +1,6 @@ +#!/bin/bash + +# bootstrap environment +source script/bootstrap + +mocha --compilers coffee:coffee-script diff --git a/test/hubot-strave_test.coffee b/test/hubot-strave_test.coffee new file mode 100644 index 0000000..7fb629b --- /dev/null +++ b/test/hubot-strave_test.coffee @@ -0,0 +1,22 @@ +chai = require 'chai' +sinon = require 'sinon' +chai.use require 'sinon-chai' + +expect = chai.expect + +describe 'hubot-strava', -> + beforeEach -> + @robot = + respond: sinon.spy() + hear: sinon.spy() + + require('../src/hubot-strava')(@robot) + + it 'registers a respond listener for Strava', -> + expect(@robot.respond).to.have.been.calledWith(/strava$/i) + + it 'registers a respond listener for Strava friend listing', -> + expect(@robot.respond).to.have.been.calledWith(/strava friends$/i) + + it 'registers a respond listener for Strava user search', -> + expect(@robot.respond).to.have.been.calledWith(/strava user (.+)$/i)