Skip to content

Commit

Permalink
add a test for location()
Browse files Browse the repository at this point in the history
  • Loading branch information
technoweenie committed Mar 15, 2010
1 parent 974518c commit f304d10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ TwitterNode.prototype.buildParams = function() {
options.follow = this.following.join(",")
if(this.locations.length > 0)
options.locations = this.locations.join(",")
if(options.track || options.follow)
if(options.track || options.follow || options.locations)
return "?" + query.stringify(options)
else
return ""
Expand Down
10 changes: 8 additions & 2 deletions test/twitter_node_config_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,24 @@ describe("default TwitterNode instance")
assert.equal('stream.twitter.com', this.twit.host)
})

it("can add tracking keywords", function() {
it("adds tracking keywords", function() {
this.twit.track('abc+def')
this.twit.track('ghi')
assert.equal('?track=abc%2Bdef%2Cghi', this.twit.buildParams())
})

it("can add following users", function() {
it("adds following users", function() {
this.twit.follow(123)
this.twit.follow(456)
assert.equal('?follow=123%2C456', this.twit.buildParams())
})

it("adds locations", function() {
this.twit.location(122.75, 36.8, -121.75, 37.8) // SF
this.twit.location(-74,40, -73,41) // NYC
assert.equal('?locations=122.75%2C36.8%2C-121.75%2C37.8%2C-74%2C40%2C-73%2C41', this.twit.buildParams())
})

describe("custom TwitterNode instance")
before(function() {
this.options = {
Expand Down

0 comments on commit f304d10

Please sign in to comment.