Skip to content

Commit

Permalink
Wrote a couple of tests. They hit actual goog api tho - so kinda slow.
Browse files Browse the repository at this point in the history
  • Loading branch information
samcday committed Feb 9, 2013
1 parent edde04e commit 56bde4a
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@
"request": ">= 2.0.2",
"xml2js": ">= 0.1.9"
},
"devDependencies": {}
"devDependencies": {
"mocha": "~1.8.1",
"should": "~1.2.1"
},
"scripts": {
"test": "mocha"
}
}
32 changes: 32 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
var assert = require("assert");
var GoogleSpreadsheets = require("google-spreadsheets");
require("should");

describe("google-spreadsheets", function() {
this.timeout(0);
it("can load a spreadsheet", function(done) {
GoogleSpreadsheets({
key: "0ApDvWFF4RPZBdEFucnJya1hxVG9wZzhJQWZUWkpfekE"
}, function(err, spreadsheet) {
if(err) return done(err);
spreadsheet.title.should.equal("Example Spreadsheet");
spreadsheet.author.name.should.equal("sam.c.day");
spreadsheet.author.email.should.equal("sam.c.day@gmail.com");
done();
});
});
it("can load spreadsheet cells", function(done) {
GoogleSpreadsheets({
key: "0ApDvWFF4RPZBdEFucnJya1hxVG9wZzhJQWZUWkpfekE"
}, function(err, spreadsheet) {
if(err) return done(err);
spreadsheet.worksheets[0].cells({
range: "R1C1:R1C2"
}, function(err, result) {
result.cells[1][1].value.should.equal("Hello,");
result.cells[1][2].value.should.equal("World!");
done();
});
});
});
});

0 comments on commit 56bde4a

Please sign in to comment.