-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
618 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
|
||
import Modal from "../../../components/common/Modal"; | ||
|
||
const props = { | ||
title: 'title', | ||
question: 'question', | ||
subText: 'subText', | ||
confirmColor: 'confirmColor', | ||
cancelColor: 'cancelColor', | ||
confirmText: 'confirmText', | ||
cancelText: 'cancelText', | ||
modalAction: jest.fn() | ||
}; | ||
|
||
describe('Modal', () => { | ||
const wrapper = shallow(<Modal { ...props } />); | ||
it('renders without crashing', () => { | ||
expect(wrapper.getElement().type).toBe("div"); | ||
expect(wrapper.find("div").length).toBeGreaterThan(1); | ||
}); | ||
|
||
it("calls modalAction prop function when a confirm button is clicked", () => { | ||
const confirmButton = wrapper.find("button").at(0); | ||
confirmButton.simulate("click"); | ||
expect(wrapper.instance().props.modalAction).toHaveBeenCalled(); | ||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import rootReducer from "../../reducers/rootReducer"; | ||
import initialState from "../../reducers/initialState"; | ||
import { logoutUser } from "../../actions/authActions/logout"; | ||
|
||
|
||
describe("Root Reducer", () => { | ||
it("should return initial state for unkwon action types", () => { | ||
const action = { type: null }; | ||
const newState = rootReducer(initialState, action); | ||
expect(newState).toEqual(initialState); | ||
}); | ||
|
||
it("handles action of type LOGOUT", () => { | ||
const action = logoutUser(); | ||
const newState = rootReducer(initialState, action); | ||
expect(newState).toEqual(initialState); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import requestImageUrl from '../../utils/requestImageUrl'; | ||
|
||
describe('requestImageUrl', () => { | ||
it('returns the url if no configuration object is passed', () => { | ||
const baseUrl = "localhost:300"; | ||
const result = requestImageUrl(baseUrl); | ||
expect(result).toEqual(baseUrl); | ||
}); | ||
|
||
it('adds width and height configuration the url', () => { | ||
const baseUrl = "localhost:300"; | ||
const result = requestImageUrl(baseUrl, {width: 10, height: 10 }); | ||
expect(result).not.toEqual(baseUrl); | ||
expect(result).toContain('w_10'); | ||
expect(result).toContain("h_10"); | ||
}); | ||
}); | ||
|
Oops, something went wrong.