~ubuntu-branches/ubuntu/utopic/node-negotiator/utopic

« back to all changes in this revision

Viewing changes to test/encoding.js

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2014-04-27 17:11:18 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140427171118-yemum1gkn7agxx4b
Tags: 0.4.3-1
* New upstream release.
* Bump Standards-Version to 3.9.5.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    return test.done();
20
20
  };
21
21
 
 
22
  this["Should not return identity encoding if * has q = 0"] = function(test) {
 
23
    test.ok(preferredEncodings('*;q=0').indexOf('identity') === -1);
 
24
    return test.done();
 
25
  };
 
26
 
 
27
  this["Should not return identity encoding if * has q = 0 but identity explicitly has q > 0"] = function(test) {
 
28
    test.ok(preferredEncodings('*;q=0, identity;q=0.5').indexOf('identity') !== -1);
 
29
    return test.done();
 
30
  };
 
31
 
22
32
  testCorrectEncoding = function(c) {
23
33
    return _this["Should return " + c.selected + " for accept-encoding header " + c.accept + " with provided encoding " + c.provided] = function(test) {
24
34
      test.deepEqual(preferredEncodings(c.accept, c.provided), c.selected);
56
66
      provided: ['gzip', 'compress'],
57
67
      selected: ['compress', 'gzip']
58
68
    }, {
 
69
      accept: '*, compress;q=0',
 
70
      provided: ['gzip', 'compress'],
 
71
      selected: ['gzip']
 
72
    }, {
59
73
      accept: 'gzip;q=0.8, compress',
60
74
      provided: null,
61
75
      selected: ['compress', 'gzip', 'identity']