You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

adReducer.test.js 753B

123456789101112131415161718192021222324252627
  1. import reducer from "../../../../store/reducers/ad/adReducer";
  2. import expect from "expect";
  3. import { setAd, setAdError } from "../../../../store/actions/ad/adActions";
  4. import { mockState } from "../../../../mockState";
  5. describe("ad reducer", () => {
  6. it("should return the initial state", () => {
  7. expect(reducer(undefined, {})).toEqual({
  8. ad: null,
  9. errorMessage: "",
  10. });
  11. });
  12. it("should set the state error", () => {
  13. expect(reducer(undefined, setAdError("Error"))).toEqual({
  14. ad: null,
  15. errorMessage: "Error",
  16. });
  17. });
  18. it("should set the state success", () => {
  19. expect(reducer(undefined, setAd(mockState.ads.ads[0]))).toEqual({
  20. ad: mockState.ads.ads[0],
  21. errorMessage: "",
  22. });
  23. });
  24. });