forked from mongodb/node-mongodb-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompression.test.ts
More file actions
61 lines (56 loc) · 1.65 KB
/
compression.test.ts
File metadata and controls
61 lines (56 loc) · 1.65 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import { expect } from 'chai';
import * as process from 'process';
describe('compression configuration tests', function () {
describe('process.env.COMPRESSOR is set', function () {
it(
'enables compression when set in the environment',
{
requires: {
predicate: () => !!process.env.COMPRESSOR || 'compression must be enabled.'
}
},
function () {
const client = this.configuration.newClient();
expect(client.s.options.compressors).to.deep.equal([process.env.COMPRESSOR]);
}
);
it(
'enables compression when set in the environment',
{
requires: {
predicate: () => !!process.env.COMPRESSOR || 'compression must be enabled.'
}
},
function () {
const url = this.configuration.url();
expect(url).to.include(`compressors=${process.env.COMPRESSOR}`);
}
);
});
describe('process.env.COMPRESSOR is unset', function () {
it(
'enables compression when set in the environment',
{
requires: {
predicate: () => !process.env.COMPRESSOR || 'compression cannot be enabled.'
}
},
function () {
const client = this.configuration.newClient();
expect(client.s.options.compressors).to.deep.equal(['none']);
}
);
it(
'enables compression when set in the environment',
{
requires: {
predicate: () => !process.env.COMPRESSOR || 'compression cannot be enabled.'
}
},
function () {
const url = this.configuration.url();
expect(url).to.not.include(`compressors=none`);
}
);
});
});