Skip to content

Commit f70d2c4

Browse files
Merge branch 'develop' into feature/auth0-RS256-Idtoken
2 parents 0e94dd3 + 3a3feee commit f70d2c4

File tree

188 files changed

+10633
-3574
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

188 files changed

+10633
-3574
lines changed

.circleci/config.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,16 +238,14 @@ workflows:
238238
filters:
239239
branches:
240240
only:
241-
- hot-fix-ad-code
242-
- feature-contentful
241+
- hot-fix
243242
# This is alternate dev env for parallel testing
244243
- "build-qa":
245244
context : org-global
246245
filters:
247246
branches:
248247
only:
249-
- hot-fix
250-
- community-app-tests-poc
248+
- listing-develop-sync
251249
# This is beta env for production soft releases
252250
- "build-prod-beta":
253251
context : org-global
@@ -263,7 +261,6 @@ workflows:
263261
branches:
264262
only:
265263
- develop
266-
- feature/auth0-RS256-Idtoken
267264
# Production builds are exectuted
268265
# when PR is merged to the master
269266
# Don't change anything in this configuration
Lines changed: 3 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,3 @@
1-
import sidebarActions from 'actions/challenge-listing/sidebar';
2-
3-
const actions = sidebarActions.challengeListing.sidebar;
4-
5-
const mockFetch = (ok, resolvesTo) => jest.fn(
6-
() => Promise.resolve({ ok, json: () => resolvesTo }),
7-
);
8-
9-
const createXHRmock = () => {
10-
const open = jest.fn();
11-
// be aware we use *function* because we need to get *this*
12-
// from *new XmlHttpRequest()* call
13-
const send = jest.fn().mockImplementation(() => {
14-
this.onload();
15-
});
16-
const xhrMockClass = {
17-
open,
18-
send,
19-
setRequestHeader: jest.fn(),
20-
getAllResponseHeaders: jest.fn(),
21-
};
22-
23-
window.XMLHttpRequest = jest.fn().mockImplementation(xhrMockClass);
24-
};
25-
261
let originalFetch;
272

283
beforeAll(() => {
@@ -34,145 +9,8 @@ afterAll(() => {
349
jest.clearAllMocks();
3510
});
3611

37-
describe('challengeListing.sidebar.changeFilterName', () => {
38-
const a = actions.changeFilterName('index', 'name');
39-
40-
test('has expected type', () => {
41-
expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/CHANGE_FILTER_NAME');
42-
});
43-
44-
test('payload is expected object', () => expect(a.payload).toEqual({
45-
index: 'index',
46-
name: 'name',
47-
}));
48-
});
49-
50-
describe('challengeListing.sidebar.deleteSavedFilter', () => {
51-
global.fetch = mockFetch(true, 'dummy');
52-
createXHRmock();
53-
54-
const a = actions.deleteSavedFilter('id', 'token');
55-
56-
test('has expected type', () => {
57-
expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/DELETE_SAVED_FILTER');
58-
});
59-
60-
// FIXME: Broken in topcoder-react-lib v1000.8.0
61-
// test('payload is a promise which resolves to the expected object', () =>
62-
// a.payload.then(res => expect(res).toEqual('id')));
63-
});
64-
65-
describe('challengeListing.sidebar.dragSavedFilterMove', () => {
66-
const a = actions.dragSavedFilterMove(
67-
{ target: { offsetHeight: 10 } },
68-
{ y: 0, startIndex: 0, index: 10 },
69-
);
70-
71-
test('has expected type', () => {
72-
expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/DRAG_SAVED_FILTER_MOVE');
73-
});
74-
75-
test('payload is expected object', () => expect(a.payload).toEqual({ y: 0, startIndex: 0, index: 10 }));
76-
});
77-
78-
describe('challengeListing.sidebar.dragSavedFilterMove with screenY', () => {
79-
const a = actions.dragSavedFilterMove(
80-
{ screenY: 10, target: { offsetHeight: 10 } },
81-
{ y: 0, startIndex: 0, index: 10 },
82-
);
83-
84-
test('has expected type', () => {
85-
expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/DRAG_SAVED_FILTER_MOVE');
86-
});
87-
88-
test('payload is expected object', () => expect(a.payload).toEqual({
89-
y: 0, startIndex: 0, index: 10, currentIndex: 1,
90-
}));
91-
});
92-
93-
describe('challengeListing.sidebar.dragSavedFilterMove same index', () => {
94-
const a = actions.dragSavedFilterMove(
95-
{ screenY: 10, target: { offsetHeight: 10 } },
96-
{ y: 0, startIndex: 9, index: 10 },
97-
);
98-
99-
test('has expected type', () => {
100-
expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/DRAG_SAVED_FILTER_MOVE');
12+
describe('challengeListing.sidebar', () => {
13+
test('not needed', () => {
14+
expect(true).toBe(true);
10115
});
102-
103-
test('payload is expected object', () => expect(a.payload).toEqual({ y: 0, startIndex: 9, index: 10 }));
104-
});
105-
106-
describe('challengeListing.sidebar.dragSavedFilterStart', () => {
107-
const a = actions.dragSavedFilterStart(10, { screenY: 5 });
108-
109-
test('has expected type', () => {
110-
expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/DRAG_SAVED_FILTER_START');
111-
});
112-
113-
test('payload is expected object', () => expect(a.payload).toEqual({ y: 5, startIndex: 10, currentIndex: 10 }));
114-
});
115-
116-
describe('challengeListing.sidebar.getSavedFilters', () => {
117-
global.fetch = mockFetch(true, []);
118-
119-
const a = actions.getSavedFilters('id', 'token');
120-
121-
test('has expected type', () => {
122-
expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/GET_SAVED_FILTERS');
123-
});
124-
125-
// FIXME: Broken in topcoder-react-lib v0.3.0
126-
// test('payload is a promise which resolves to the expected object', () =>
127-
// a.payload.then(res => expect(res).toEqual([])));
128-
});
129-
130-
describe('challengeListing.sidebar.resetFilterName', () => {
131-
const a = actions.resetFilterName(1);
132-
133-
test('has expected type', () => {
134-
expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/RESET_FILTER_NAME');
135-
});
136-
137-
test('payload is expected object', () => expect(a.payload).toEqual(1));
138-
});
139-
140-
describe('challengeListing.sidebar.saveFilter', () => {
141-
global.fetch = mockFetch(true, 'dummy');
142-
143-
const a = actions.saveFilterDone('name', {}, 'token');
144-
145-
test('has expected type', () => {
146-
expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/SAVE_FILTER_DONE');
147-
});
148-
149-
// FIXME: Broken in topcoder-react-lib v0.3.0
150-
// test('payload is a promise which resolves to the expected object', () =>
151-
// a.payload.then(res => expect(res).toEqual('dummy')));
152-
});
153-
154-
describe('challengeListing.sidebar.updateAllSavedFilters', () => {
155-
global.fetch = mockFetch(true, 'dummy');
156-
157-
const a = actions.updateAllSavedFilters([{ filter: {} }], 'token');
158-
159-
test('has expected type', () => {
160-
expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/UPDATE_ALL_SAVED_FILTERS');
161-
});
162-
163-
test('payload is undefined', () => expect(a.payload).toBeUndefined());
164-
});
165-
166-
describe('challengeListing.sidebar.updateSavedFilter', () => {
167-
global.fetch = mockFetch(true, 'dummy');
168-
169-
const a = actions.updateSavedFilter({}, 'token');
170-
171-
test('has expected type', () => {
172-
expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/UPDATE_SAVED_FILTER');
173-
});
174-
175-
// FIXME: Broken in topcoder-react-lib v0.3.0
176-
// test('payload is a promise which resolves to the expected object', () =>
177-
// a.payload.then(res => expect(res).toEqual('dummy')));
17816
});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Default render 1`] = `
4+
<label
5+
className="src-shared-components-GUIKit-Checkbox-___style__container___2a1GZ src-shared-components-GUIKit-Checkbox-___style__smSize___3aux-"
6+
>
7+
<input
8+
checked={false}
9+
onChange={[Function]}
10+
type="checkbox"
11+
/>
12+
<div
13+
className="src-shared-components-GUIKit-Checkbox-___style__checkmark___1xdsj"
14+
>
15+
<img
16+
alt="checkmark-icon"
17+
className="src-shared-components-GUIKit-Checkbox-___style__after___2rEBg"
18+
src="/community-app-assets/images/07507a04e0986d806cbd3ec73c724143.png"
19+
/>
20+
</div>
21+
</label>
22+
`;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react';
2+
import Renderer from 'react-test-renderer/shallow';
3+
4+
import Checkbox from 'components/GUIKit/Checkbox';
5+
6+
7+
const rnd = new Renderer();
8+
9+
it('Default render', () => {
10+
rnd.render((<Checkbox />));
11+
expect(rnd.getRenderOutput()).toMatchSnapshot();
12+
});
Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Default render 1`] = `
4+
<div
5+
className="src-shared-components-GUIKit-Datepicker-___style__container___Sl58X"
6+
>
7+
<withStyles(SingleDatePicker)
8+
anchorDirection="left"
9+
appendToBody={false}
10+
block={false}
11+
calendarInfoPosition="bottom"
12+
customCloseIcon={null}
13+
customInputIcon={
14+
<IconCalendar
15+
height="16"
16+
viewBox="0 0 16 16"
17+
width="16"
18+
xmlns="http://www.w3.org/2000/svg"
19+
/>
20+
}
21+
date={null}
22+
daySize={47}
23+
disableScroll={false}
24+
disabled={false}
25+
displayFormat="MMM DD, YYYY"
26+
enableOutsideDays={true}
27+
firstDayOfWeek={1}
28+
focused={false}
29+
hideKeyboardShortcutsPanel={true}
30+
horizontalMargin={0}
31+
horizontalMonthPadding={13}
32+
id="null----false"
33+
initialVisibleMonth={null}
34+
inputIconPosition="after"
35+
isDayBlocked={[Function]}
36+
isDayHighlighted={[Function]}
37+
isOutsideRange={[Function]}
38+
isRTL={false}
39+
keepFocusOnInput={false}
40+
keepOpenOnDateSelect={false}
41+
monthFormat="MMMM YYYY"
42+
navNext={
43+
<IconNext
44+
height="16"
45+
viewBox="0 0 10 16"
46+
width="10"
47+
xmlns="http://www.w3.org/2000/svg"
48+
/>
49+
}
50+
navPrev={
51+
<IconPrev
52+
height="16"
53+
viewBox="0 0 10 16"
54+
width="10"
55+
xmlns="http://www.w3.org/2000/svg"
56+
/>
57+
}
58+
noBorder={false}
59+
numberOfMonths={1}
60+
onClose={[Function]}
61+
onDateChange={[Function]}
62+
onFocusChange={[Function]}
63+
onNextMonthClick={[Function]}
64+
onPrevMonthClick={[Function]}
65+
openDirection="down"
66+
orientation="horizontal"
67+
phrases={
68+
Object {
69+
"calendarLabel": "Calendar",
70+
"chooseAvailableDate": [Function],
71+
"clearDate": "Clear Date",
72+
"closeDatePicker": "Close",
73+
"dateIsSelected": [Function],
74+
"dateIsUnavailable": [Function],
75+
"enterKey": "Enter key",
76+
"escape": "Escape key",
77+
"hideKeyboardShortcutsPanel": "Close the shortcuts panel.",
78+
"homeEnd": "Home and end keys",
79+
"jumpToNextMonth": "Move forward to switch to the next month.",
80+
"jumpToPrevMonth": "Move backward to switch to the previous month.",
81+
"keyboardNavigationInstructions": "Press the down arrow key to interact with the calendar and
82+
select a date. Press the question mark key to get the keyboard shortcuts for changing dates.",
83+
"keyboardShortcuts": "Keyboard Shortcuts",
84+
"leftArrowRightArrow": "Right and left arrow keys",
85+
"moveFocusByOneDay": "Move backward (left) and forward (right) by one day.",
86+
"moveFocusByOneMonth": "Switch months.",
87+
"moveFocusByOneWeek": "Move backward (up) and forward (down) by one week.",
88+
"moveFocustoStartAndEndOfWeek": "Go to the first or last day of a week.",
89+
"openThisPanel": "Open this panel.",
90+
"pageUpPageDown": "page up and page down keys",
91+
"questionMark": "Question mark",
92+
"returnFocusToInput": "Return to the date input field.",
93+
"selectFocusedDate": "Select the date in focus.",
94+
"showKeyboardShortcutsPanel": "Open the keyboard shortcuts panel.",
95+
"upArrowDownArrow": "up and down arrow keys",
96+
}
97+
}
98+
placeholder=""
99+
readOnly={false}
100+
regular={false}
101+
renderCalendarInfo={null}
102+
renderDayContents={[Function]}
103+
renderMonthElement={null}
104+
renderMonthText={null}
105+
reopenPickerOnClearDate={false}
106+
required={false}
107+
screenReaderInputMessage=""
108+
showClearDate={false}
109+
showDefaultInputIcon={false}
110+
small={false}
111+
verticalHeight={null}
112+
verticalSpacing={22}
113+
weekDayFormat="ddd"
114+
withFullScreenPortal={false}
115+
withPortal={false}
116+
/>
117+
</div>
118+
`;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import React from 'react';
2+
import Renderer from 'react-test-renderer/shallow';
3+
4+
import Datepicker from 'components/GUIKit/Datepicker';
5+
6+
7+
const rnd = new Renderer();
8+
9+
it('Default render', () => {
10+
rnd.render((<Datepicker />));
11+
expect(rnd.getRenderOutput()).toMatchSnapshot();
12+
});

0 commit comments

Comments
 (0)