Skip to content

Commit

Permalink
test(example): add equal to tests to example
Browse files Browse the repository at this point in the history
  • Loading branch information
eknowles committed Feb 19, 2016
1 parent 1bd7a52 commit 264b5e8
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
6 changes: 6 additions & 0 deletions examples/data.json
Original file line number Diff line number Diff line change
@@ -1,40 +1,46 @@
[{
"name": "Solrenningen",
"visits": 40,
"geojson": {
"type": "Point",
"coordinates": [6.13037, 61.00607]
},
"tags": ["Ved", "Mat", "Båt"]
},{
"name": "Norddalshytten",
"visits": 5571,
"geojson": {
"type": "Point",
"coordinates": [5.99579, 61.01340]
},
"tags": ["Ved", "Mat", "Tåke"]
},{
"name": "Åsedalen",
"visits": 10000,
"geojson": {
"type": "Point",
"coordinates": [6.22032, 60.96244]
},
"tags": ["Ved", "Mat", "Stekeovn"]
},{
"name": "Vatnane",
"visits": 9290,
"geojson": {
"type": "Point",
"coordinates": [6.32607, 61.02105]
},
"tags": ["Ved"]
},{
"name": "Selhamar",
"visits": 301,
"geojson": {
"type": "Point",
"coordinates": [6.26495, 60.91275]
},
"tags": ["Ved", "Mat", "Stekeovn", "Båt"]
},{
"name": "Vardadalsbu",
"visits": 30149,
"geojson": {
"type": "Point",
"coordinates": [5.89279, 60.94477]
Expand Down
42 changes: 41 additions & 1 deletion examples/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('Example App', function() {
.end(done);
});

it('returns palces with any of the following tags', function(done) {
it('returns places with any of the following tags', function(done) {
app.get(url + '?tags[]=Båt&tags[]=Stekeovn')
.expect(200)
.expect(function(res) {
Expand All @@ -87,4 +87,44 @@ describe('Example App', function() {
})
.end(done);
});

it('returns places with visits less than 40', function(done) {
app.get(url + '?visits=<40')
.expect(200)
.expect(function(res) {
assert.equal(res.body.length, 0);
})
.end(done);
});

it('returns places with visits less than or equal to 40', function(done) {
app.get(url + '?visits=<=40')
.expect(200)
.expect(function(res) {
assert.equal(res.body.length, 1);
assert.equal(res.body[0].name, 'Solrenningen');
})
.end(done);
});

it('returns places with visits greater than 10,000', function(done) {
app.get(url + '?visits=>10000')
.expect(200)
.expect(function(res) {
assert.equal(res.body.length, 1);
assert.equal(res.body[0].name, 'Vardadalsbu');
})
.end(done);
});

it('returns places with visits greater than or equal to 10,000', function(done) {
app.get(url + '?visits=>=10000')
.expect(200)
.expect(function(res) {
assert.equal(res.body.length, 2);
assert.equal(res.body[0].name, 'Åsedalen');
assert.equal(res.body[1].name, 'Vardadalsbu');
})
.end(done);
});
});

0 comments on commit 264b5e8

Please sign in to comment.