DispatchingStore.spec.js (hoppscotch-2.2.1) | : | DispatchingStore.spec.js (hoppscotch-3.0.0) | ||
---|---|---|---|---|
import { BehaviorSubject, Subject } from "rxjs" | import { BehaviorSubject, Subject } from "rxjs" | |||
import isEqual from "lodash/isEqual" | import { isEqual } from "lodash-es" | |||
import DispatchingStore from "~/newstore/DispatchingStore" | import DispatchingStore from "~/newstore/DispatchingStore" | |||
describe("DispatchingStore", () => { | describe("DispatchingStore", () => { | |||
test("'subject$' property properly returns an BehaviorSubject", () => { | test("'subject$' property properly returns an BehaviorSubject", () => { | |||
const store = new DispatchingStore({}, {}) | const store = new DispatchingStore({}, {}) | |||
expect(store.subject$ instanceof BehaviorSubject).toEqual(true) | expect(store.subject$ instanceof BehaviorSubject).toEqual(true) | |||
}) | }) | |||
test("'value' property properly returns the current state value", () => { | test("'value' property properly returns the current state value", () => { | |||
skipping to change at line 39 | skipping to change at line 39 | |||
dispatcher: "non-existent", | dispatcher: "non-existent", | |||
payload: {}, | payload: {}, | |||
}) | }) | |||
}).toThrow() | }).toThrow() | |||
}) | }) | |||
test("valid dispatcher calls run without throwing", () => { | test("valid dispatcher calls run without throwing", () => { | |||
const store = new DispatchingStore( | const store = new DispatchingStore( | |||
{}, | {}, | |||
{ | { | |||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||||
testDispatcher(_currentValue, _payload) { | testDispatcher(_currentValue, _payload) { | |||
// Nothing here | // Nothing here | |||
}, | }, | |||
} | } | |||
) | ) | |||
expect(() => { | expect(() => { | |||
store.dispatch({ | store.dispatch({ | |||
dispatcher: "testDispatcher", | dispatcher: "testDispatcher", | |||
payload: {}, | payload: {}, | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added |