From 0e973602813358ac27ad02b2b4874247e8516aff Mon Sep 17 00:00:00 2001 From: Gautam Jethwani Date: Tue, 1 Aug 2023 03:37:55 +0800 Subject: [PATCH] feat: add option to disable snapshots add tests --- test/status-test.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/test/status-test.js b/test/status-test.js index ee58f86a..e4ee4c5a 100644 --- a/test/status-test.js +++ b/test/status-test.js @@ -157,3 +157,40 @@ test('CircuitBreaker status - import stats,but not a status object', t => { t.fail(); } }); + +test('CircuitBreaker status - enableSnapshots defaults to true', t => { + t.plan(1); + + const breaker = new CircuitBreaker(passFail); + + t.equal(breaker.status.enableSnapshots, true, 'enableSnapshots defaults to true'); + + breaker.shutdown(); + t.end(); +}); + +test('CircuitBreaker status - enableSnapshots is true in Status when set to true', t => { + t.plan(1); + + const breaker = new CircuitBreaker(passFail, { + enableSnapshots: true + }); + + t.equal(breaker.status.enableSnapshots, true, 'enableSnapshots propagates as true'); + + breaker.shutdown(); + t.end(); +}); + +test('CircuitBreaker status - enableSnapshots is false in Status when set to false', t => { + t.plan(1); + + const breaker = new CircuitBreaker(passFail, { + enableSnapshots: false + }); + + t.equal(breaker.status.enableSnapshots, false, 'enableSnapshots propagates as false'); + + breaker.shutdown(); + t.end(); +});