debugger
debugger copied to clipboard
[stepping] add some unit tests
It would be great to boost our coverage of src/actions/pause
diff --git a/src/actions/tests/pause.spec.js b/src/actions/tests/pause.spec.js
index 46c5b3c..58708e3 100644
--- a/src/actions/tests/pause.spec.js
+++ b/src/actions/tests/pause.spec.js
@@ -22,15 +22,15 @@ const mockThreadClient = {
}
};
+const mockPauseInfo = {
+ frames: [{ id: 1, scope: [], location: { sourceId: "foo1", line: 4 } }],
+ loadedObjects: [],
+ why: {}
+};
+
describe("pause", () => {
it("should set and clear the command", async () => {
const { dispatch, getState } = createStore(mockThreadClient);
- const mockPauseInfo = {
- frames: [{ id: 1, scope: [], location: { sourceId: "foo1", line: 4 } }],
- loadedObjects: [],
- why: {}
- };
-
await dispatch(actions.paused(mockPauseInfo));
dispatch(actions.stepIn());
expect(isStepping(getState())).toBeTruthy();
@@ -46,4 +46,21 @@ describe("pause", () => {
await dispatch(actions.resumed());
expect(client.evaluate.mock.calls.length).toEqual(0);
});
+
+ it("should only step when paused", async () => {
+ const client = { stepIn: jest.fn() };
+ const { dispatch } = createStore(client);
+
+ dispatch(actions.stepIn());
+ expect(client.stepIn.calls.length).toEqual(0);
+ });
+
+ it("should step when paused", async () => {
+ const client = { stepIn: jest.fn() };
+ const { dispatch } = createStore(client);
+
+ await dispatch(actions.paused(mockPauseInfo));
+ dispatch(actions.stepIn());
+ expect(client.stepIn.calls.length).toEqual(1);
+ });
/claim
Thanks for claiming the issue! :wave:
Here are some links for getting setup, contributing, and developing. We're always happy to answer questions in slack! If you become busy, feel free to /unclaim it.
:fox_face: Debugger team!