Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/switcher.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ export class Switcher {
*/
restrictRelay(restrict: boolean): Switcher;

/**
* Resets all strategy inputs
*/
resetInputs(): Switcher;

/**
* Adds a strategy for validation
*/
Expand Down
5 changes: 5 additions & 0 deletions src/switcherBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ export class SwitcherBuilder {
return this;
}

resetInputs() {
this._input = undefined;
return this;
}

check(startegyType, input) {
if (!this._input) {
this._input = [];
Expand Down
16 changes: 16 additions & 0 deletions tests/switcher-client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,22 @@ describe('E2E test - Client local #1:', function () {
'Group disabled');
});

it('should clear strategy inputs', async function () {
// when
await switcher
.checkValue('Japan')
.checkNetwork('10.0.0.2')
.prepare('FF2FOR2020');

assert.exists(switcher.input);
assert.isTrue(await switcher.isItOn());

// test
switcher.resetInputs();
assert.equal(switcher.input, undefined);
assert.isFalse(await switcher.isItOn());
});

it('should be valid - Local mode', async function () {
this.timeout(3000);

Expand Down