Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Commit

Permalink
add test config
Browse files Browse the repository at this point in the history
  • Loading branch information
ungoldman committed Dec 5, 2013
1 parent 4d01cc5 commit 56624f4
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -37,4 +37,6 @@ tmp
# YARD artifacts
.yardoc
_yardoc
doc/
doc/

spec/config.js
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -274,6 +274,7 @@ A Node.js proxy is supplied in the `proxy` folder. To create your own proxy to s
1. `cd` into the `geotrigger-js` folder
1. Install dependencies with `npm install`
1. Run tests with `npm test` or `grunt test`
* first `cp spec/config.js.example spec/config.js` and add valid `clientId` & `clientSecret`
1. Make your changes and create a [pull request](https://help.github.com/articles/creating-a-pull-request)

## Resources
Expand Down
1 change: 1 addition & 0 deletions karma.conf.js
Expand Up @@ -9,6 +9,7 @@ files = [
JASMINE,
JASMINE_ADAPTER,
{pattern: 'geotrigger.js'},
{pattern: 'spec/config.js'},
{pattern: 'spec/SpecHelpers.js'},
{pattern: 'spec/GeotriggerSpec.js'}
];
Expand Down
13 changes: 7 additions & 6 deletions spec/GeotriggerSpec.js
@@ -1,19 +1,20 @@
if(typeof module === "object"){
var Geotrigger = require("../geotrigger");
var config = require("./config");
}

var ClientId = "ABC";
var ClientSecret = "XYZ";
var ClientId = config.clientId;
var ClientSecret = config.clientSecret;

describe("geotrigger.js", function() {

it("should throw an error if initialized without an application_id or session", function(){
it("should throw an error if initialized without a client id or session", function(){
expect(function(){
var geotriggers = new Geotrigger.Session();
}).toThrow();
});

it("should fire an `authenticated` event after the initializes successfully with an application id and secret", function(){
it("should fire an `authenticated` event after initializing successfully with a client id and secret", function(){

var spy = jasmine.createSpy();
var geotriggers;
Expand All @@ -37,7 +38,7 @@ describe("geotrigger.js", function() {
});
});

it("should fire an `authenticated` event after the initializes successfully with an application id", function(){
it("should fire an `authenticated` event after initializing successfully with a client id", function(){
var spy = jasmine.createSpy();
var geotriggers;

Expand Down Expand Up @@ -93,7 +94,7 @@ describe("geotrigger.js", function() {
});
});

it("should update a device and use a deferred", function(){
it("should be able to update a device", function(){
var spy = jasmine.createSpy();

runs(function(){
Expand Down
22 changes: 22 additions & 0 deletions spec/config.js.example
@@ -0,0 +1,22 @@
(function (root, factory) {

// Node.
if (typeof module === 'object' && typeof module.exports === 'object') {
exports = module.exports = factory();
}

// Browser Global.
if (typeof window === 'object') {
root.config = factory();
}

}(this, function() {

// add your clientId and clientSecret here
var config = {
"clientId": "ABC",
"clientSecret": "XYZ"
};

return config;
}));

0 comments on commit 56624f4

Please sign in to comment.