Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
samogot committed Nov 13, 2018
1 parent 46dce80 commit 7f3b714
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,26 @@ module.exports.multiple = function (assert) {
}, 5000);
}

module.exports.function_url = function (assert) {
osmosis.get(url + '/xml-auto')
.then(function (context, data) {
assert.equal(context.get('link').text(), 'http://example.com');
})
.get(url + '/xml')
.then(function (context, data) {
// In html mode <link> tag treated as singleton tag and can't have any body
assert.notEqual(context.get('link').text(), 'http://example.com');
})
.get(url + '/xml')
.config('parse_as', 'xml')
.then(function (context, data) {
assert.equal(context.get('link').text(), 'http://example.com');
})
.done(function () {
assert.done();
});
};

module.exports.absentQueryString = function (assert) {
var found = false;
osmosis.get(url + '/test-query-string')
Expand Down Expand Up @@ -202,6 +222,17 @@ server('/error-parse', function (url, req, res) {
res.end();
});

server('/xml-auto', function (url, req, res) {
res.setHeader('Content-Type', 'application/xml');
res.write('<rss><link>http://example.com</link></rss>');
res.end();
});

server('/xml', function (url, req, res) {
res.write('<rss><link>http://example.com</link></rss>');
res.end();
});


server('/redirect', function (url, req, res) {
res.write('<div>/redirect</div>');
Expand Down

0 comments on commit 7f3b714

Please sign in to comment.