Skip to content

Commit

Permalink
test enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
nfriedly committed Dec 11, 2014
1 parent e91ea3f commit daf69f9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .travis.yml
@@ -1,8 +1,8 @@
language: node_js
node_js:
- '0.10'

before_script:
- npm install grunt-cli -g

# travis automatically runs `npm test` for the main script
env:
matrix:
- SAUCE_USERNAME=jsfc
global:
secure: RXiNhz5ga4fIaXYfs7UfSH6FHdo3yPm1KMvrY82Ra5qhVmPNDTBEVDAHZOKGHW61Fiso5xZhkVMMSJtBhDIspMgvRGrKzbTGaHnDjufEC2Lm4vu67nDt1zgyoNt9zqv3RRzxh+kTZl/FzWvv0JJUnURtx6CqJThXGcjFAs3W3/Y=
4 changes: 3 additions & 1 deletion Gruntfile.js
Expand Up @@ -29,10 +29,10 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-saucelabs');
grunt.loadNpmTasks('grunt-contrib-connect');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-jsbeautifier');
grunt.loadNpmTasks('grunt-newer');
grunt.loadNpmTasks('grunt-swf');

// Project configuration.
grunt.initConfig({
Expand Down Expand Up @@ -128,4 +128,6 @@ module.exports = function(grunt) {
grunt.registerTask('beautify', ['jsbeautifier:rewrite']);
grunt.registerTask('pre-commit', ['quick-test', 'build']);

grunt.registerTask('default', ['beautify', 'build', 'test']);

};
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -18,6 +18,7 @@
"homepage": "https://github.com/nfriedly/Javascript-Flash-Cookies",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-cli": "^0.1.13",
"grunt-contrib-connect": "^0.9.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.6.0",
Expand Down
18 changes: 15 additions & 3 deletions tests/spec/flashcookies-spec.js
Expand Up @@ -69,12 +69,12 @@ describe("SwfStore()", function() {
});

it("should fire the error callback if the SWF fails to load", function(done) {
var onload = jasmine.createSpy("onload");
var onready = jasmine.createSpy("onready");
var config = {
swf_url: "example_invalid_swf_url",
onload: onload,
onready: onready,
onerror: function() {
expect(onload).not.toHaveBeenCalled();
expect(onready).not.toHaveBeenCalled();
instance = null; // so that we don't try to call clearAll() on it in the afterEach()
done();
},
Expand All @@ -85,6 +85,17 @@ describe("SwfStore()", function() {
instance = new SwfStore(config);
});

it("should allow namespaces to contain forward slashes (/)", function(done) {
config.onready = function() {
expect(onerror).not.toHaveBeenCalled();
instance.set("myKey", "myValue");
expect(instance.get("myKey")).toBe("myValue");
done();
};
config.namespace = "foo/bar";
instance = new SwfStore(config);
});

describe('.set()', function() {
it("should store values", function(done) {
getInstanceAndFinishTest(done, function() {
Expand Down Expand Up @@ -189,4 +200,5 @@ describe("SwfStore()", function() {
});
});
});

});

0 comments on commit daf69f9

Please sign in to comment.