Skip to content

Commit a5ccc96

Browse files
committed
add state travel default
Signed-off-by: Tobias Gurtzick <[email protected]>
1 parent bb842e0 commit a5ccc96

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

lib/methods/v2/statetravel.js

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,32 @@ class StateTravel {
2424
this.driver = driver;
2525
this._counter = 0;
2626
}
27-
}
2827

29-
Object.keys(DEFAULT).forEach(m => {
30-
StateTravel.prototype[m] = async function (...args) {
31-
await State.step(this.driver, ++this._counter, this.internals);
32-
const res = await State.update(
28+
async step () {
29+
return State.step(this.driver, ++this._counter, this.internals);
30+
}
31+
32+
async update () {
33+
return State.update(
3334
this.driver,
3435
this.file,
3536
this.internals.modSchema,
3637
this.internals
3738
);
39+
}
40+
41+
async default () {
42+
await this.step();
43+
const res = await this.update();
44+
45+
return res;
46+
}
47+
}
48+
49+
Object.keys(DEFAULT).forEach(m => {
50+
StateTravel.prototype[m] = async function (...args) {
51+
await this.step();
52+
const res = await this.update();
3853

3954
return res;
4055
};

0 commit comments

Comments
 (0)