Skip to content

Commit fdf42e4

Browse files
committed
feat(TestWireAdapter): expose a resetLastConfig method
1 parent 127d975 commit fdf42e4

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/adapters/TestWireAdapter.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ export class TestWireAdapterTemplate {
2222
return this._lastConfig;
2323
}
2424

25+
static resetLastConfig() {
26+
this._lastConfig = null;
27+
}
28+
2529
_dataCallback;
2630
config = {};
2731

test/modules/example/generic/__tests__/test-adapter.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,28 @@ describe('TestWireAdapter', () => {
101101
});
102102
});
103103

104+
describe('resetLastConfig', () => {
105+
test('getLastConfig() should return the last available config despite we run a new set of test', () => {
106+
//Arrange
107+
const actual = adapter.getLastConfig();
108+
109+
// Assert
110+
expect(actual).not.toBeNull();
111+
});
112+
113+
it('should reset the last available', () => {
114+
// Arrange
115+
let actual;
116+
117+
//Act
118+
adapter.resetLastConfig();
119+
actual = adapter.getLastConfig();
120+
121+
// Assert
122+
expect(actual).toBeNull();
123+
});
124+
});
125+
104126
describe('emit()', () => {
105127
it('should emit value when component is created but not connected', () => {
106128
const element = createElement('example-generic', { is: Generic });

0 commit comments

Comments
 (0)