19
19
return test.done();
22
this["Should handle extra slashes on query params"] = function(test) {
23
var type = 'application/xhtml+xml;profile="http://www.wapforum.org/xhtml"'
24
test.deepEqual(preferredMediaTypes(type, ['application/xhtml+xml;profile="http://www.wapforum.org/xhtml"']), ['application/xhtml+xml;profile="http://www.wapforum.org/xhtml"']);
22
29
testCorrectType = function(c) {
23
30
return _this["Should return " + c.selected + " for access header " + c.accept + " with provided types " + c.provided] = function(test) {
24
31
test.deepEqual(preferredMediaTypes(c.accept, c.provided), c.selected);
59
66
accept: 'application/json;q=0.2, text/html',
61
68
selected: ['text/html', 'application/json']
70
accept: 'text/*, text/html;q=0',
71
provided: ['text/html', 'text/plain'],
72
selected: ['text/plain']
74
accept: 'text/*, text/html;q=0.5',
75
provided: ['text/html', 'text/plain'],
76
selected: ['text/plain', 'text/html']
78
accept: 'application/json, */*; q=0.01',
79
provided: ['text/html', 'application/json'],
80
selected: ['application/json', 'text/html']
82
accept: 'application/vnd.example;attribute=value',
83
provided: ['application/vnd.example;attribute=other', 'application/vnd.example;attribute=value'],
84
selected: ['application/vnd.example;attribute=value']
86
accept: 'application/vnd.example;attribute=other',
87
provided: ['application/vnd.example', 'application/vnd.example;attribute=other'],
88
selected: ['application/vnd.example;attribute=other']
90
accept: 'text/html;level=1',
91
provided: ['text/html;level=1;foo=bar'],
92
selected: ['text/html;level=1;foo=bar']
94
accept: 'text/html;level=1;foo=bar',
95
provided: ['text/html;level=1'],
98
accept: 'text/html;level=2',
99
provided: ['text/html;level=1'],
102
accept : 'text/html, text/html;level=1;q=0.1',
103
provided : ['text/html', 'text/html;level=1'],
104
selected : ['text/html', 'text/html;level=1']
106
accept : 'text/*;q=0.3, text/html;q=0.7, text/html;level=1, text/html;level=2;q=0.4, */*;q=0.5',
107
provided : ['text/html;level=1', 'text/html', 'text/html;level=3', 'image/jpeg', 'text/html;level=2', 'text/plain'],
108
selected : ['text/html;level=1', 'text/html', 'text/html;level=3', 'image/jpeg', 'text/html;level=2', 'text/plain']
65
113
for (_i = 0, _len = testConfigurations.length; _i < _len; _i++) {