Skip to content

Commit 1f2f308

Browse files
committed
Add test for warmUp new options
1 parent 700a222 commit 1f2f308

3 files changed

Lines changed: 43 additions & 11 deletions

test/windows-kill-class-instance-options-1.test.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ var WindowsKillClass = require('../lib/windows-kill-class');
55
var test = ava.test;
66

77
var windowsKill = new WindowsKillClass({
8-
replaceNodeKill: true
8+
replaceNodeKill: true,
9+
warmUp: false
910
});
1011

1112
test('instance should be an object', t => {
@@ -18,8 +19,14 @@ test('instance should have kill property which is a function', t => {
1819
t.pass();
1920
});
2021

21-
test('instance should have shouldReplaceNodesKill property and must be true', t => {
22-
t.is(typeof windowsKill.shouldReplaceNodesKill, 'boolean', 'check shouldReplaceNodesKill property is boolean');
23-
t.is(windowsKill.shouldReplaceNodesKill, true, 'check shouldReplaceNodesKill property is boolean');
22+
test('instance should have _shouldReplaceNodesKill property and must be true', t => {
23+
t.is(typeof windowsKill._shouldReplaceNodesKill, 'boolean', 'check _shouldReplaceNodesKill property is boolean');
24+
t.is(windowsKill._shouldReplaceNodesKill, true, 'check _shouldReplaceNodesKill property is boolean');
25+
t.pass();
26+
});
27+
28+
test('instance should have _shouldWarmUp property and must be true', t => {
29+
t.is(typeof windowsKill._shouldWarmUp, 'boolean', 'check _shouldWarmUp property is boolean');
30+
t.is(windowsKill._shouldWarmUp, false, 'check _shouldWarmUp property is boolean');
2431
t.pass();
2532
});

test/windows-kill-class-instance-options-2.test.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,22 @@ var WindowsKillClass = require('../lib/windows-kill-class');
44

55
var test = ava.test;
66

7+
var noop = function () { };
8+
9+
var defaultApplyOptions = WindowsKillClass.prototype._applyOptions;
10+
WindowsKillClass.prototype._applyOptions = noop;
11+
712
var windowsKill = new WindowsKillClass({
8-
replaceNodeKill: false
13+
replaceNodeKill: false,
14+
warmUp: true
915
});
1016

17+
windowsKill._native.warmUp = noop;
18+
WindowsKillClass.prototype._applyOptions = defaultApplyOptions;
19+
20+
windowsKill._applyOptions();
21+
22+
1123
test('instance should be an object', t => {
1224
t.is(typeof windowsKill, 'object');
1325
t.pass();
@@ -18,8 +30,14 @@ test('instance should have kill property which is a function', t => {
1830
t.pass();
1931
});
2032

21-
test('instance should have shouldReplaceNodesKill property and must be false', t => {
22-
t.is(typeof windowsKill.shouldReplaceNodesKill, 'boolean', 'check shouldReplaceNodesKill property is boolean');
23-
t.is(windowsKill.shouldReplaceNodesKill, false, 'check shouldReplaceNodesKill property is boolean');
33+
test('instance should have _shouldReplaceNodesKill property and must be false', t => {
34+
t.is(typeof windowsKill._shouldReplaceNodesKill, 'boolean', 'check _shouldReplaceNodesKill property is boolean');
35+
t.is(windowsKill._shouldReplaceNodesKill, false, 'check _shouldReplaceNodesKill property is boolean');
36+
t.pass();
37+
});
38+
39+
test('instance should have _shouldWarmUp property and must be true', t => {
40+
t.is(typeof windowsKill._shouldWarmUp, 'boolean', 'check _shouldWarmUp property is boolean');
41+
t.is(windowsKill._shouldWarmUp, true, 'check _shouldWarmUp property is boolean');
2442
t.pass();
2543
});

test/windows-kill-class-instance-options-default.test.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,15 @@ test('instance should have kill property which is a function', t => {
1616
t.pass();
1717
});
1818

19-
test('instance should have shouldReplaceNodesKill property and must be true', t => {
20-
t.is(typeof windowsKill.shouldReplaceNodesKill, 'boolean', 'check shouldReplaceNodesKill property is boolean');
21-
t.is(windowsKill.shouldReplaceNodesKill, true, 'check shouldReplaceNodesKill property is boolean');
19+
test('instance should have _shouldReplaceNodesKill property and must be true', t => {
20+
t.is(typeof windowsKill._shouldReplaceNodesKill, 'boolean', 'check _shouldReplaceNodesKill property is boolean');
21+
t.is(windowsKill._shouldReplaceNodesKill, true, 'check _shouldReplaceNodesKill property is boolean');
2222
t.pass();
2323
});
24+
25+
test('instance should have _shouldWarmUp property and must be true', t => {
26+
t.is(typeof windowsKill._shouldWarmUp, 'boolean', 'check _shouldWarmUp property is boolean');
27+
t.is(windowsKill._shouldWarmUp, false, 'check _shouldWarmUp property is boolean');
28+
t.pass();
29+
});
30+

0 commit comments

Comments
 (0)