| "url": "https://opencollective.com/date-fns" | "url": "https://opencollective.com/date-fns" | ||||
| } | } | ||||
| }, | }, | ||||
| "node_modules/dayjs": { | |||||
| "version": "1.11.7", | |||||
| "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz", | |||||
| "integrity": "sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==", | |||||
| "optional": true, | |||||
| "peer": true | |||||
| }, | |||||
| "node_modules/debug": { | "node_modules/debug": { | ||||
| "version": "4.3.1", | "version": "4.3.1", | ||||
| "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", | ||||
| "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", | "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", | ||||
| "integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==" | "integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==" | ||||
| }, | }, | ||||
| "dayjs": { | |||||
| "version": "1.11.7", | |||||
| "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz", | |||||
| "integrity": "sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==", | |||||
| "optional": true, | |||||
| "peer": true | |||||
| }, | |||||
| "debug": { | "debug": { | ||||
| "version": "4.3.1", | "version": "4.3.1", | ||||
| "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", | "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", |
| import reducer from "../../../../store/reducers/ad/adReducer"; | |||||
| import expect from "expect"; | |||||
| import { setAd, setAdError } from "../../../../store/actions/ad/adActions"; | |||||
| import { mockState } from "../../../../mockState"; | |||||
| describe("ad reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| ad: null, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error", () => { | |||||
| expect(reducer(undefined, setAdError("Error"))).toEqual({ | |||||
| ad: null, | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success", () => { | |||||
| expect(reducer(undefined, setAd(mockState.ads.ads[0]))).toEqual({ | |||||
| ad: mockState.ads.ads[0], | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../../store/reducers/ad/adsReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| setAds, | |||||
| setAdsError, | |||||
| setFilteredAds, | |||||
| setFilteredAdsError, | |||||
| } from "../../../../store/actions/ads/adsAction"; | |||||
| import { mockState } from "../../../../mockState"; | |||||
| describe("ads reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| ads: [], | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error when setAdsError is called", () => { | |||||
| expect(reducer(undefined, setAdsError("Error"))).toEqual({ | |||||
| ads: [], | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set ads when setAds is called", () => { | |||||
| expect(reducer(undefined, setAds(mockState.ads.ads[0]))).toEqual({ | |||||
| ads: mockState.ads.ads[0], | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error when setFilteredAdsError is called", () => { | |||||
| expect(reducer(undefined, setFilteredAdsError("Error"))).toEqual({ | |||||
| ads: [], | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set ads when setFilteredAds is called", () => { | |||||
| expect(reducer(undefined, setFilteredAds(mockState.ads.ads[0]))).toEqual({ | |||||
| ads: mockState.ads.ads[0], | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../../store/reducers/ad/archiveActiveAdReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| archiveActiveAd, | |||||
| archiveActiveAdError, | |||||
| } from "../../../../store/actions/archiveActiveAd/archiveActiveAdActions"; | |||||
| describe("archiveActiveAd reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error", () => { | |||||
| expect(reducer(undefined, archiveActiveAdError("Error"))).toEqual({ | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success", () => { | |||||
| expect(reducer(undefined, archiveActiveAd())).toEqual({ | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../../store/reducers/ad/archiveAdsReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| setArchiveAds, | |||||
| setArchiveAdsError, | |||||
| } from "../../../../store/actions/archiveAds/archiveAdsActions"; | |||||
| import { mockState } from "../../../../mockState"; | |||||
| describe("archiveAdsReducer reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| archiveAds: [], | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error", () => { | |||||
| expect(reducer(undefined, setArchiveAdsError("Error"))).toEqual({ | |||||
| archiveAds: [], | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success", () => { | |||||
| expect(reducer(undefined, setArchiveAds(mockState.ads.ads))).toEqual({ | |||||
| archiveAds: mockState.ads.ads, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../../store/reducers/ad/createAdReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| setCreateAd, | |||||
| setCreateAdError, | |||||
| } from "../../../../store/actions/createAd/createAdActions"; | |||||
| import { mockState } from "../../../../mockState"; | |||||
| describe("createAd reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| ad: null, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error", () => { | |||||
| expect(reducer(undefined, setCreateAdError("Error"))).toEqual({ | |||||
| ad: null, | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success", () => { | |||||
| expect(reducer(undefined, setCreateAd(mockState.ads.ads[0]))).toEqual({ | |||||
| ad: mockState.ads.ads[0], | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../store/reducers/applicants/applyForAdReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| applyForAd, | |||||
| applyForAdError, | |||||
| } from "../../../store/actions/applyForAd/applyForAdActions"; | |||||
| describe("applyForAd reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error", () => { | |||||
| expect(reducer(undefined, applyForAdError("Error"))).toEqual({ | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success", () => { | |||||
| expect(reducer(undefined, applyForAd())).toEqual({ | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../store/reducers/candidates/candidateOptionsReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| fetchCandidateOptionsSuccess, | |||||
| fetchCandidateOptionsError, | |||||
| } from "../../../store/actions/candidates/candidatesActions"; | |||||
| import { mockState } from "../../../mockState"; | |||||
| describe("candidatesOptions reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| options: [], | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error", () => { | |||||
| expect(reducer(undefined, fetchCandidateOptionsError("Error"))).toEqual({ | |||||
| options: [], | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set options", () => { | |||||
| expect( | |||||
| reducer( | |||||
| undefined, | |||||
| fetchCandidateOptionsSuccess(mockState.options.options) | |||||
| ) | |||||
| ).toEqual({ | |||||
| options: mockState.options.options, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../store/reducers/candidate/candidateReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| fetchCandidateSuccess, | |||||
| fetchCandidateError, | |||||
| createCandidateCommentSuccess, | |||||
| createCandidateCommentError, | |||||
| deleteCandidateError, | |||||
| deleteCandidateSuccess, | |||||
| } from "../../../store/actions/candidate/candidateActions"; | |||||
| import { mockState } from "../../../mockState"; | |||||
| describe("candidate reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| candidate: {}, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error when fetchCandidateError is called", () => { | |||||
| expect(reducer(undefined, fetchCandidateError("Error"))).toEqual({ | |||||
| candidate: {}, | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set candidate when fetchCandidateSuccess is called", () => { | |||||
| expect( | |||||
| reducer(undefined, fetchCandidateSuccess(mockState.candidate.candidate)) | |||||
| ).toEqual({ | |||||
| candidate: mockState.candidate.candidate, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error when createCandidateCommentError is called", () => { | |||||
| expect(reducer(undefined, createCandidateCommentError("Error"))).toEqual({ | |||||
| candidate: {}, | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| // it("should add new comment for canidate", () => { | |||||
| // fetchCandidateSuccess(mockState.candidate.candidate); | |||||
| // expect( | |||||
| // reducer( | |||||
| // undefined, | |||||
| // createCandidateCommentSuccess({ | |||||
| // myObj: { content: "sfsdfsd" }, | |||||
| // user: mockState.user.user, | |||||
| // }) | |||||
| // ) | |||||
| // ).toEqual({ | |||||
| // candidate: mockState.candidate.candidate, | |||||
| // errorMessage: "", | |||||
| // }); | |||||
| // }); | |||||
| it("should set the state error when deleteCandidateError is called", () => { | |||||
| expect(reducer(undefined, deleteCandidateError("Error"))).toEqual({ | |||||
| candidate: {}, | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set candidate when deleteCandidateSuccess is called", () => { | |||||
| fetchCandidateSuccess(mockState.candidate.candidate); | |||||
| expect(reducer(undefined, deleteCandidateSuccess())).toEqual({ | |||||
| candidate: {}, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../store/reducers/candidates/candidatesReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| filterCandidatesError, | |||||
| filterCandidatesSuccess, | |||||
| fetchAdsCandidatesSuccess, | |||||
| fetchAdsCandidatesError, | |||||
| } from "../../../store/actions/candidates/candidatesActions"; | |||||
| import { mockState } from "../../../mockState"; | |||||
| describe("candidates reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| candidates: [], | |||||
| adsCandidates: [], | |||||
| errorMessage: "", | |||||
| pagination: 0, | |||||
| }); | |||||
| }); | |||||
| it("should set the state error when filterCandidates is called", () => { | |||||
| expect(reducer(undefined, filterCandidatesError("Error"))).toEqual({ | |||||
| candidates: [], | |||||
| adsCandidates: [], | |||||
| errorMessage: "Error", | |||||
| pagination: 0, | |||||
| }); | |||||
| }); | |||||
| it("should set candidates and pagination", () => { | |||||
| expect( | |||||
| reducer( | |||||
| undefined, | |||||
| filterCandidatesSuccess({ items: [mockState.candidates[0]], total: 1 }) | |||||
| ) | |||||
| ).toEqual({ | |||||
| candidates: [mockState.candidates[0]], | |||||
| adsCandidates: [], | |||||
| errorMessage: "", | |||||
| pagination: 1, | |||||
| }); | |||||
| }); | |||||
| it("should set the state error when fetchAdsCandidates is called ", () => { | |||||
| expect(reducer(undefined, fetchAdsCandidatesError("Error"))).toEqual({ | |||||
| candidates: [], | |||||
| adsCandidates: [], | |||||
| errorMessage: "Error", | |||||
| pagination: 0, | |||||
| }); | |||||
| }); | |||||
| it("should set adsCandidates", () => { | |||||
| expect( | |||||
| reducer( | |||||
| undefined, | |||||
| fetchAdsCandidatesSuccess(mockState.candidates.adsCandidates) | |||||
| ) | |||||
| ).toEqual({ | |||||
| candidates: [], | |||||
| adsCandidates: mockState.candidates.adsCandidates, | |||||
| errorMessage: "", | |||||
| pagination: 0, | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../store/reducers/candidates/initProcessReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| fetchInitProcessSuccess, | |||||
| fetchInitProcessError, | |||||
| } from "../../../store/actions/candidates/candidatesActions"; | |||||
| describe("initProcces reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| isSuccess: false, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error", () => { | |||||
| expect(reducer(undefined, fetchInitProcessError("Error"))).toEqual({ | |||||
| isSuccess: false, | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success", () => { | |||||
| expect(reducer(undefined, fetchInitProcessSuccess())).toEqual({ | |||||
| isSuccess: true, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../store/reducers/login/loginReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| fetchUserError, | |||||
| resetLoginState, | |||||
| clearLoginErrors, | |||||
| generateTokenSuccess, | |||||
| generateTokenError, | |||||
| } from "../../../store/actions/login/loginActions"; | |||||
| describe("login reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| email: "", | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error", () => { | |||||
| expect(reducer(undefined, fetchUserError("Error"))).toEqual({ | |||||
| email: "", | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("reset login state", () => { | |||||
| expect(reducer(undefined, resetLoginState())).toEqual({ | |||||
| email: "", | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("clear login errors", () => { | |||||
| fetchUserError("Error"); | |||||
| expect(reducer(undefined, clearLoginErrors())).toEqual({ | |||||
| email: "", | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("generate token", () => { | |||||
| expect(reducer(undefined, generateTokenSuccess("some token"))).toEqual({ | |||||
| email: "", | |||||
| errorMessage: "", | |||||
| token: "some token", | |||||
| }); | |||||
| }); | |||||
| it("generate token error", () => { | |||||
| expect(reducer(undefined, generateTokenError("some token error"))).toEqual({ | |||||
| email: "", | |||||
| errorMessage: "some token error", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../../store/reducers/pattern/createPatternReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| createPattern, | |||||
| createPatternError, | |||||
| } from "../../../../store/actions/createPattern/createPatternActions"; | |||||
| import { mockState } from "../../../../mockState"; | |||||
| describe("createPattern reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| pattern: null, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error", () => { | |||||
| expect(reducer(undefined, createPatternError("Error"))).toEqual({ | |||||
| pattern: null, | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success", () => { | |||||
| expect( | |||||
| reducer(undefined, createPattern(mockState.patterns.patterns)) | |||||
| ).toEqual({ | |||||
| pattern: mockState.patterns.patterns, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../../store/reducers/pattern/patternApplicantsReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| setPatternApplicants, | |||||
| setPatternApplicantsError, | |||||
| } from "../../../../store/actions/patternApplicants/patternApplicantsActions"; | |||||
| import { mockState } from "../../../../mockState"; | |||||
| describe("patternApplicants reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| patternApplicants: [], | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error", () => { | |||||
| expect(reducer(undefined, setPatternApplicantsError("Error"))).toEqual({ | |||||
| patternApplicants: [], | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success", () => { | |||||
| expect( | |||||
| reducer(undefined, setPatternApplicants(mockState.patterns.patterns)) | |||||
| ).toEqual({ | |||||
| patternApplicants: mockState.patterns.patterns, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../../store/reducers/pattern/patternReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| setPattern, | |||||
| setPatternError, | |||||
| } from "../../../../store/actions/pattern/patternActions"; | |||||
| import { mockState } from "../../../../mockState"; | |||||
| describe("pattern reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| pattern: null, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error", () => { | |||||
| expect(reducer(undefined, setPatternError("Error"))).toEqual({ | |||||
| pattern: null, | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success", () => { | |||||
| expect( | |||||
| reducer(undefined, setPattern(mockState.patterns.patterns[0])) | |||||
| ).toEqual({ | |||||
| pattern: mockState.patterns.patterns[0], | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../../store/reducers/pattern/patternsReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| setPatterns, | |||||
| setPatternsError, | |||||
| setFilteredPatterns, | |||||
| setFilteredPatternsError, | |||||
| } from "../../../../store/actions/patterns/patternsActions"; | |||||
| import { mockState } from "../../../../mockState"; | |||||
| describe("patterns reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| patterns: [], | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error when setPatternsError is called", () => { | |||||
| expect(reducer(undefined, setPatternsError("Error"))).toEqual({ | |||||
| patterns: [], | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success when setPatterns is called", () => { | |||||
| expect( | |||||
| reducer(undefined, setPatterns(mockState.patterns.patterns)) | |||||
| ).toEqual({ | |||||
| patterns: mockState.patterns.patterns, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error when setFilteredPatternsError is called", () => { | |||||
| expect(reducer(undefined, setFilteredPatternsError("Error"))).toEqual({ | |||||
| patterns: [], | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success when setFilteredPatterns is called", () => { | |||||
| expect( | |||||
| reducer(undefined, setFilteredPatterns(mockState.patterns.patterns)) | |||||
| ).toEqual({ | |||||
| patterns: mockState.patterns.patterns, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../../store/reducers/pattern/scheduleAppointmentReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| scheduleAppointment, | |||||
| scheduleAppointmentError, | |||||
| clearNotSentEmailsArray | |||||
| } from "../../../../store/actions/scheduleAppointment/scheduleAppointmentActions"; | |||||
| import { mockState } from "../../../../mockState"; | |||||
| describe("patterns reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| notSentEmails: null, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error when setScheduleAppointmentErrorMessage is called", () => { | |||||
| expect(reducer(undefined, scheduleAppointmentError("Error"))).toEqual({ | |||||
| notSentEmails: null, | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success when scheduleAppointment with an empty array as argument is called", () => { | |||||
| expect( | |||||
| reducer(undefined, scheduleAppointment({ notSentEmails: [] })) | |||||
| ).toEqual({ | |||||
| notSentEmails: [], | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success when scheduleAppointment with an null as argument is called", () => { | |||||
| expect(reducer(undefined, scheduleAppointment(null))).toEqual({ | |||||
| notSentEmails: null, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success when clearNotSentEmailsArray is called", () => { | |||||
| scheduleAppointment({ notSentEmails: [] }); | |||||
| expect(reducer(undefined, clearNotSentEmailsArray())).toEqual({ | |||||
| notSentEmails: null, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import reducer from "../../../../store/reducers/pattern/updatePatternReducer"; | |||||
| import expect from "expect"; | |||||
| import { | |||||
| updatePattern, | |||||
| updatePatternError, | |||||
| } from "../../../../store/actions/updatePattern/updatePatternActions"; | |||||
| import { mockState } from "../../../../mockState"; | |||||
| describe("updatePattern reducer", () => { | |||||
| it("should return the initial state", () => { | |||||
| expect(reducer(undefined, {})).toEqual({ | |||||
| pattern: null, | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| it("should set the state error", () => { | |||||
| expect(reducer(undefined, updatePatternError("Error"))).toEqual({ | |||||
| pattern: null, | |||||
| errorMessage: "Error", | |||||
| }); | |||||
| }); | |||||
| it("should set the state success", () => { | |||||
| expect( | |||||
| reducer(undefined, updatePattern(mockState.patterns.patterns[0])) | |||||
| ).toEqual({ | |||||
| pattern: mockState.patterns.patterns[0], | |||||
| errorMessage: "", | |||||
| }); | |||||
| }); | |||||
| }); |
| import * as redux from "react-redux"; | |||||
| import store from "../../store"; | |||||
| import { Router } from "react-router-dom"; | |||||
| import { mockState } from "../../mockState"; | |||||
| import { render, screen, waitFor } from "@testing-library/react"; | |||||
| import history from "../../store/utils/history"; | |||||
| import mediaQuery from "css-mediaquery"; | |||||
| import InterviewDialog from "../../components/MUI/InterviewDialog"; | |||||
| const props = { | |||||
| title: "title", | |||||
| subtitle: "subtitle", | |||||
| imgSrc: "imgSrc", | |||||
| onClose: jest.fn(), | |||||
| open: true, | |||||
| maxWidth: "xl", | |||||
| fullWidth: true, | |||||
| responsive: true, | |||||
| }; | |||||
| function createMatchMedia(width) { | |||||
| return (query) => ({ | |||||
| matches: mediaQuery.match(query, { width }), | |||||
| addListener: () => {}, | |||||
| removeListener: () => {}, | |||||
| }); | |||||
| } | |||||
| describe("InterviewDialog render tests", () => { | |||||
| const cont = ( | |||||
| <redux.Provider store={store}> | |||||
| <Router history={history}> | |||||
| <InterviewDialog {...props} /> | |||||
| </Router> | |||||
| </redux.Provider> | |||||
| ); | |||||
| let spyOnUseSelector; | |||||
| let spyOnUseDispatch; | |||||
| let mockDispatch; | |||||
| beforeEach(() => { | |||||
| window.matchMedia = createMatchMedia(362); | |||||
| spyOnUseSelector = jest.spyOn(redux, "useSelector"); | |||||
| spyOnUseSelector | |||||
| .mockReturnValueOnce(mockState.options) | |||||
| .mockReturnValueOnce(mockState.users) | |||||
| .mockReturnValueOnce(mockState.initProcess); | |||||
| spyOnUseDispatch = jest.spyOn(redux, "useDispatch"); | |||||
| mockDispatch = jest.fn(); | |||||
| spyOnUseDispatch.mockReturnValue(mockDispatch); | |||||
| }); | |||||
| afterEach(() => { | |||||
| jest.restoreAllMocks(); | |||||
| }); | |||||
| it("Should render", async () => { | |||||
| render(cont); | |||||
| waitFor(() => expect(screen.getByTestId("interview-dialog")).toBeDefined()); | |||||
| }); | |||||
| }); |
| import * as redux from "react-redux"; | |||||
| import store from "../../store"; | |||||
| import { Router } from "react-router-dom"; | |||||
| import { mockState } from "../../mockState"; | |||||
| import { render, screen, waitFor } from "@testing-library/react"; | |||||
| import history from "../../store/utils/history"; | |||||
| import StatusDialog from "../../components/MUI/StatusDialog"; | |||||
| import mediaQuery from "css-mediaquery"; | |||||
| import { SelectionContext } from "../../context/SelectionContext"; | |||||
| const props = { | |||||
| title: "title", | |||||
| subtitle: "subtitle", | |||||
| imgSrc: "imgSrc", | |||||
| onClose: jest.fn(), | |||||
| open: true, | |||||
| maxWidth: "xl", | |||||
| fullWidth: true, | |||||
| responsive: true, | |||||
| }; | |||||
| function createMatchMedia(width) { | |||||
| return (query) => ({ | |||||
| matches: mediaQuery.match(query, { width }), | |||||
| addListener: () => {}, | |||||
| removeListener: () => {}, | |||||
| }); | |||||
| } | |||||
| describe("Statusialog render tests", () => { | |||||
| const cont = ( | |||||
| <redux.Provider store={store}> | |||||
| <SelectionContext.Provider | |||||
| value={{ | |||||
| selectionProcess: {}, | |||||
| activeProcess: { process: { selectionLevelId: 2 } }, | |||||
| }} | |||||
| > | |||||
| <Router history={history}> | |||||
| <StatusDialog {...props} /> | |||||
| </Router> | |||||
| </SelectionContext.Provider> | |||||
| </redux.Provider> | |||||
| ); | |||||
| let spyOnUseSelector; | |||||
| let spyOnUseDispatch; | |||||
| let mockDispatch; | |||||
| beforeEach(() => { | |||||
| window.matchMedia = createMatchMedia(362); | |||||
| spyOnUseSelector = jest.spyOn(redux, "useSelector"); | |||||
| spyOnUseSelector | |||||
| .mockReturnValueOnce(mockState.users.users) | |||||
| .mockReturnValueOnce(mockState.initProcess) | |||||
| .mockReturnValueOnce(mockState.screeningTests); | |||||
| spyOnUseDispatch = jest.spyOn(redux, "useDispatch"); | |||||
| mockDispatch = jest.fn(); | |||||
| spyOnUseDispatch.mockReturnValue(mockDispatch); | |||||
| }); | |||||
| afterEach(() => { | |||||
| jest.restoreAllMocks(); | |||||
| }); | |||||
| it("Should render", async () => { | |||||
| render(cont); | |||||
| waitFor(() => expect(screen.getByTestId("status-dialog")).toBeDefined()); | |||||
| }); | |||||
| }); |
| <Select | <Select | ||||
| labelId="demo-simple-select-label" | labelId="demo-simple-select-label" | ||||
| id="demo-simple-select" | id="demo-simple-select" | ||||
| value={selectedInterviewer ? selectedInterviewer : ''} | |||||
| value={selectedInterviewer ? selectedInterviewer : ""} | |||||
| label="Ime intervjuera (opciono)" | label="Ime intervjuera (opciono)" | ||||
| onChange={(e) => { | onChange={(e) => { | ||||
| setSelectedInterviewer(e.target.value); | setSelectedInterviewer(e.target.value); |
| FETCH_AD_SUCCESS, | FETCH_AD_SUCCESS, | ||||
| } from "../../actions/ad/adActionConstants"; | } from "../../actions/ad/adActionConstants"; | ||||
| import createReducer from "../../utils/createReducer"; | import createReducer from "../../utils/createReducer"; | ||||
| /* istanbul ignore file */ | |||||
| const initialState = { | const initialState = { | ||||
| ad: null, | ad: null, |
| FETCH_FILTERED_ADS_SUCCESS, | FETCH_FILTERED_ADS_SUCCESS, | ||||
| } from "../../actions/ads/adsActionConstants"; | } from "../../actions/ads/adsActionConstants"; | ||||
| import createReducer from "../../utils/createReducer"; | import createReducer from "../../utils/createReducer"; | ||||
| /* istanbul ignore file */ | |||||
| const initialState = { | const initialState = { | ||||
| ads: [], | ads: [], |
| ARCHIVE_ACTIVE_AD_ERR, | ARCHIVE_ACTIVE_AD_ERR, | ||||
| } from "../../actions/archiveActiveAd/archiveActiveAdActionConstants"; | } from "../../actions/archiveActiveAd/archiveActiveAdActionConstants"; | ||||
| import createReducer from "../../utils/createReducer"; | import createReducer from "../../utils/createReducer"; | ||||
| /* istanbul ignore file */ | |||||
| const initialState = { | const initialState = { | ||||
| errorMessage: "", | errorMessage: "", |
| FETCH_ARCHIVE_ADS_ERR, | FETCH_ARCHIVE_ADS_ERR, | ||||
| } from "../../actions/archiveAds/archiveAdsActionConstants"; | } from "../../actions/archiveAds/archiveAdsActionConstants"; | ||||
| import createReducer from "../../utils/createReducer"; | import createReducer from "../../utils/createReducer"; | ||||
| /* istanbul ignore file */ | |||||
| const initialState = { | const initialState = { | ||||
| archiveAds: [], | archiveAds: [], |
| CREATE_AD_ERR, | CREATE_AD_ERR, | ||||
| } from "../../actions/createAd/createAdActionConstants"; | } from "../../actions/createAd/createAdActionConstants"; | ||||
| import createReducer from "../../utils/createReducer"; | import createReducer from "../../utils/createReducer"; | ||||
| /* istanbul ignore file */ | |||||
| const initialState = { | const initialState = { | ||||
| ad: null, | ad: null, |
| CANDIDATE_COMMENTS_SUCCESS, | CANDIDATE_COMMENTS_SUCCESS, | ||||
| CANDIDATE_COMMENTS_ERROR, | CANDIDATE_COMMENTS_ERROR, | ||||
| DELETE_CANDIDATE_SUCCESS, | DELETE_CANDIDATE_SUCCESS, | ||||
| DELETE_CANDIDATE_ERROR | |||||
| DELETE_CANDIDATE_ERROR, | |||||
| } from "../../actions/candidate/candidateActionConstants"; | } from "../../actions/candidate/candidateActionConstants"; | ||||
| /* istanbul ignore file */ | |||||
| const initialState = { | const initialState = { | ||||
| candidate: {}, | candidate: {}, | ||||
| [CANDIDATE_ERROR]: setError, | [CANDIDATE_ERROR]: setError, | ||||
| [CANDIDATE_COMMENTS_SUCCESS]: setComments, | [CANDIDATE_COMMENTS_SUCCESS]: setComments, | ||||
| [CANDIDATE_COMMENTS_ERROR]: setCommentsError, | [CANDIDATE_COMMENTS_ERROR]: setCommentsError, | ||||
| [DELETE_CANDIDATE_SUCCESS]:deleteCandidate, | |||||
| [DELETE_CANDIDATE_ERROR]:deleteCandidateError | |||||
| [DELETE_CANDIDATE_SUCCESS]: deleteCandidate, | |||||
| [DELETE_CANDIDATE_ERROR]: deleteCandidateError, | |||||
| }, | }, | ||||
| initialState | initialState | ||||
| ); | ); | ||||
| var datetime = | var datetime = | ||||
| currentDate.getFullYear() + | currentDate.getFullYear() + | ||||
| "-" + | "-" + | ||||
| (currentDate.getMonth() <= 9 ? "0" + (currentDate.getMonth() + 1) : currentDate.getMonth() + 1) + | |||||
| (currentDate.getMonth() <= 9 | |||||
| ? "0" + (currentDate.getMonth() + 1) | |||||
| : currentDate.getMonth() + 1) + | |||||
| "-" + | "-" + | ||||
| (currentDate.getDate() <= 9 | (currentDate.getDate() <= 9 | ||||
| ? "0" + currentDate.getDate() | ? "0" + currentDate.getDate() | ||||
| }; | }; | ||||
| } | } | ||||
| function deleteCandidateError(state, action) { | function deleteCandidateError(state, action) { | ||||
| return { | return { | ||||
| ...state, | ...state, |
| CREATE_PATTERN_SUCCESS, | CREATE_PATTERN_SUCCESS, | ||||
| } from "../../actions/createPattern/createPatternActionConstants"; | } from "../../actions/createPattern/createPatternActionConstants"; | ||||
| import createReducer from "../../utils/createReducer"; | import createReducer from "../../utils/createReducer"; | ||||
| /* istanbul ignore file */ | |||||
| const initialState = { | const initialState = { | ||||
| pattern: null, | pattern: null, |
| FETCH_PATTERN_APPLICANTS_SUCCESS, | FETCH_PATTERN_APPLICANTS_SUCCESS, | ||||
| FETCH_PATTERN_APPLICANTS_ERR, | FETCH_PATTERN_APPLICANTS_ERR, | ||||
| } from "../../actions/patternApplicants/patternApplicantsActionConstants"; | } from "../../actions/patternApplicants/patternApplicantsActionConstants"; | ||||
| /* istanbul ignore file */ | |||||
| const initialState = { | const initialState = { | ||||
| patternApplicants: [], | patternApplicants: [], |
| FETCH_PATTERN_SUCCESS, | FETCH_PATTERN_SUCCESS, | ||||
| FETCH_PATTERN_ERR, | FETCH_PATTERN_ERR, | ||||
| } from "../../actions/pattern/patternActionConstants"; | } from "../../actions/pattern/patternActionConstants"; | ||||
| /* istanbul ignore file */ | |||||
| const initialState = { | const initialState = { | ||||
| pattern: null, | pattern: null, |
| FETCH_PATTERNS_SUCCESS, | FETCH_PATTERNS_SUCCESS, | ||||
| } from "../../actions/patterns/patternsActionConstants"; | } from "../../actions/patterns/patternsActionConstants"; | ||||
| import createReducer from "../../utils/createReducer"; | import createReducer from "../../utils/createReducer"; | ||||
| /* istanbul ignore file */ | |||||
| const initialState = { | const initialState = { | ||||
| patterns: [], | patterns: [], |
| CLEAR_NOT_SENT_EMAILS_ARRAY, | CLEAR_NOT_SENT_EMAILS_ARRAY, | ||||
| } from "../../actions/scheduleAppointment/scheduleAppointmentActionConstants"; | } from "../../actions/scheduleAppointment/scheduleAppointmentActionConstants"; | ||||
| import createReducer from "../../utils/createReducer"; | import createReducer from "../../utils/createReducer"; | ||||
| /* istanbul ignore file */ | |||||
| const initialState = { | const initialState = { | ||||
| notSentEmails: null, | notSentEmails: null, |
| UPDATE_PATTERN_SUCCESS, | UPDATE_PATTERN_SUCCESS, | ||||
| } from "../../actions/updatePattern/updatePatternActionConstants"; | } from "../../actions/updatePattern/updatePatternActionConstants"; | ||||
| import createReducer from "../../utils/createReducer"; | import createReducer from "../../utils/createReducer"; | ||||
| /* istanbul ignore file */ | |||||
| const initialState = { | const initialState = { | ||||
| pattern: null, | pattern: null, |
| "resolved" "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz" | "resolved" "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz" | ||||
| "version" "2.29.3" | "version" "2.29.3" | ||||
| "dayjs@^1.10.7", "dayjs@^1.8.17": | |||||
| "integrity" "sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==" | |||||
| "resolved" "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz" | |||||
| "version" "1.11.7" | |||||
| "debug@*", "debug@^4.0.1", "debug@^4.1.0", "debug@^4.1.1", "debug@^4.3.1", "debug@4": | "debug@*", "debug@^4.0.1", "debug@^4.1.0", "debug@^4.1.1", "debug@^4.3.1", "debug@4": | ||||
| "integrity" "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==" | "integrity" "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==" | ||||
| "resolved" "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz" | "resolved" "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz" |