-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
29 lines (19 loc) · 1.16 KB
/
test.js
File metadata and controls
29 lines (19 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var removeUrlGarbage = require('.');
require('chai/register-assert');
describe('removeUrlGarbage()', function() {
it('Should remove utm_* params', function() {
var url = 'https://developers.google.com/web/updates/2016/10/navigator-share?foo=bar&utm_source=feed&utm_medium=feed&utm_campaign=updates_feed';
var res = removeUrlGarbage(url);
assert.equal(res, 'https://developers.google.com/web/updates/2016/10/navigator-share?foo=bar')
});
it('Should remove from=rss', function() {
var url = 'https://developers.google.com/web/updates/2016/10/navigator-share?foo=bar&utm_source=feed&utm_medium=feed&utm_campaign=updates_feed&from=rss';
var res = removeUrlGarbage(url);
assert.equal(res, 'https://developers.google.com/web/updates/2016/10/navigator-share?foo=bar')
});
it('Should remove trailing "?"', function() {
var url = 'https://developers.google.com/web/updates/2016/10/navigator-share?utm_source=feed&utm_medium=feed&utm_campaign=updates_feed&from=rss';
var res = removeUrlGarbage(url);
assert.equal(res, 'https://developers.google.com/web/updates/2016/10/navigator-share')
});
});