diff --git a/.circleci/config.yml b/.circleci/config.yml index 74ed1356ae..1e58d6ae06 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -230,23 +230,21 @@ workflows: filters: branches: only: - - milestone-20200924 - - develop + - hot-fix # This is alternate dev env for parallel testing - "build-test": context : org-global filters: branches: only: - - hot-fix-ad-code - - feature-contentful + - hot-fix # This is alternate dev env for parallel testing - "build-qa": context : org-global filters: branches: only: - - community-app-tests-poc + - listing-develop-sync # This is beta env for production soft releases - "build-prod-beta": context : org-global @@ -262,6 +260,7 @@ workflows: branches: only: - develop + - listing-develop-sync # Production builds are exectuted # when PR is merged to the master # Don't change anything in this configuration diff --git a/__tests__/shared/actions/challenge-listing/sidebar.js b/__tests__/shared/actions/challenge-listing/sidebar.js index 58dab24e45..9531d3cb80 100644 --- a/__tests__/shared/actions/challenge-listing/sidebar.js +++ b/__tests__/shared/actions/challenge-listing/sidebar.js @@ -1,28 +1,3 @@ -import sidebarActions from 'actions/challenge-listing/sidebar'; - -const actions = sidebarActions.challengeListing.sidebar; - -const mockFetch = (ok, resolvesTo) => jest.fn( - () => Promise.resolve({ ok, json: () => resolvesTo }), -); - -const createXHRmock = () => { - const open = jest.fn(); - // be aware we use *function* because we need to get *this* - // from *new XmlHttpRequest()* call - const send = jest.fn().mockImplementation(() => { - this.onload(); - }); - const xhrMockClass = { - open, - send, - setRequestHeader: jest.fn(), - getAllResponseHeaders: jest.fn(), - }; - - window.XMLHttpRequest = jest.fn().mockImplementation(xhrMockClass); -}; - let originalFetch; beforeAll(() => { @@ -34,145 +9,8 @@ afterAll(() => { jest.clearAllMocks(); }); -describe('challengeListing.sidebar.changeFilterName', () => { - const a = actions.changeFilterName('index', 'name'); - - test('has expected type', () => { - expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/CHANGE_FILTER_NAME'); - }); - - test('payload is expected object', () => expect(a.payload).toEqual({ - index: 'index', - name: 'name', - })); -}); - -describe('challengeListing.sidebar.deleteSavedFilter', () => { - global.fetch = mockFetch(true, 'dummy'); - createXHRmock(); - - const a = actions.deleteSavedFilter('id', 'token'); - - test('has expected type', () => { - expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/DELETE_SAVED_FILTER'); - }); - - // FIXME: Broken in topcoder-react-lib v1000.8.0 - // test('payload is a promise which resolves to the expected object', () => - // a.payload.then(res => expect(res).toEqual('id'))); -}); - -describe('challengeListing.sidebar.dragSavedFilterMove', () => { - const a = actions.dragSavedFilterMove( - { target: { offsetHeight: 10 } }, - { y: 0, startIndex: 0, index: 10 }, - ); - - test('has expected type', () => { - expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/DRAG_SAVED_FILTER_MOVE'); - }); - - test('payload is expected object', () => expect(a.payload).toEqual({ y: 0, startIndex: 0, index: 10 })); -}); - -describe('challengeListing.sidebar.dragSavedFilterMove with screenY', () => { - const a = actions.dragSavedFilterMove( - { screenY: 10, target: { offsetHeight: 10 } }, - { y: 0, startIndex: 0, index: 10 }, - ); - - test('has expected type', () => { - expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/DRAG_SAVED_FILTER_MOVE'); - }); - - test('payload is expected object', () => expect(a.payload).toEqual({ - y: 0, startIndex: 0, index: 10, currentIndex: 1, - })); -}); - -describe('challengeListing.sidebar.dragSavedFilterMove same index', () => { - const a = actions.dragSavedFilterMove( - { screenY: 10, target: { offsetHeight: 10 } }, - { y: 0, startIndex: 9, index: 10 }, - ); - - test('has expected type', () => { - expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/DRAG_SAVED_FILTER_MOVE'); +describe('challengeListing.sidebar', () => { + test('not needed', () => { + expect(true).toBe(true); }); - - test('payload is expected object', () => expect(a.payload).toEqual({ y: 0, startIndex: 9, index: 10 })); -}); - -describe('challengeListing.sidebar.dragSavedFilterStart', () => { - const a = actions.dragSavedFilterStart(10, { screenY: 5 }); - - test('has expected type', () => { - expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/DRAG_SAVED_FILTER_START'); - }); - - test('payload is expected object', () => expect(a.payload).toEqual({ y: 5, startIndex: 10, currentIndex: 10 })); -}); - -describe('challengeListing.sidebar.getSavedFilters', () => { - global.fetch = mockFetch(true, []); - - const a = actions.getSavedFilters('id', 'token'); - - test('has expected type', () => { - expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/GET_SAVED_FILTERS'); - }); - - // FIXME: Broken in topcoder-react-lib v0.3.0 - // test('payload is a promise which resolves to the expected object', () => - // a.payload.then(res => expect(res).toEqual([]))); -}); - -describe('challengeListing.sidebar.resetFilterName', () => { - const a = actions.resetFilterName(1); - - test('has expected type', () => { - expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/RESET_FILTER_NAME'); - }); - - test('payload is expected object', () => expect(a.payload).toEqual(1)); -}); - -describe('challengeListing.sidebar.saveFilter', () => { - global.fetch = mockFetch(true, 'dummy'); - - const a = actions.saveFilterDone('name', {}, 'token'); - - test('has expected type', () => { - expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/SAVE_FILTER_DONE'); - }); - - // FIXME: Broken in topcoder-react-lib v0.3.0 - // test('payload is a promise which resolves to the expected object', () => - // a.payload.then(res => expect(res).toEqual('dummy'))); -}); - -describe('challengeListing.sidebar.updateAllSavedFilters', () => { - global.fetch = mockFetch(true, 'dummy'); - - const a = actions.updateAllSavedFilters([{ filter: {} }], 'token'); - - test('has expected type', () => { - expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/UPDATE_ALL_SAVED_FILTERS'); - }); - - test('payload is undefined', () => expect(a.payload).toBeUndefined()); -}); - -describe('challengeListing.sidebar.updateSavedFilter', () => { - global.fetch = mockFetch(true, 'dummy'); - - const a = actions.updateSavedFilter({}, 'token'); - - test('has expected type', () => { - expect(a.type).toBe('CHALLENGE_LISTING/SIDEBAR/UPDATE_SAVED_FILTER'); - }); - - // FIXME: Broken in topcoder-react-lib v0.3.0 - // test('payload is a promise which resolves to the expected object', () => - // a.payload.then(res => expect(res).toEqual('dummy'))); }); diff --git a/__tests__/shared/components/GUIKit/Checkbox/__snapshots__/index.jsx.snap b/__tests__/shared/components/GUIKit/Checkbox/__snapshots__/index.jsx.snap new file mode 100644 index 0000000000..2ca9d09aa5 --- /dev/null +++ b/__tests__/shared/components/GUIKit/Checkbox/__snapshots__/index.jsx.snap @@ -0,0 +1,22 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Default render 1`] = ` + +`; diff --git a/__tests__/shared/components/GUIKit/Checkbox/index.jsx b/__tests__/shared/components/GUIKit/Checkbox/index.jsx new file mode 100644 index 0000000000..e693ad4989 --- /dev/null +++ b/__tests__/shared/components/GUIKit/Checkbox/index.jsx @@ -0,0 +1,12 @@ +import React from 'react'; +import Renderer from 'react-test-renderer/shallow'; + +import Checkbox from 'components/GUIKit/Checkbox'; + + +const rnd = new Renderer(); + +it('Default render', () => { + rnd.render(()); + expect(rnd.getRenderOutput()).toMatchSnapshot(); +}); diff --git a/__tests__/shared/components/GUIKit/Datepicker/__snapshots__/index.jsx.snap b/__tests__/shared/components/GUIKit/Datepicker/__snapshots__/index.jsx.snap new file mode 100644 index 0000000000..8ec048cd49 --- /dev/null +++ b/__tests__/shared/components/GUIKit/Datepicker/__snapshots__/index.jsx.snap @@ -0,0 +1,118 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Default render 1`] = ` +
+ + } + date={null} + daySize={47} + disableScroll={false} + disabled={false} + displayFormat="MMM DD, YYYY" + enableOutsideDays={true} + firstDayOfWeek={1} + focused={false} + hideKeyboardShortcutsPanel={true} + horizontalMargin={0} + horizontalMonthPadding={13} + id="null----false" + initialVisibleMonth={null} + inputIconPosition="after" + isDayBlocked={[Function]} + isDayHighlighted={[Function]} + isOutsideRange={[Function]} + isRTL={false} + keepFocusOnInput={false} + keepOpenOnDateSelect={false} + monthFormat="MMMM YYYY" + navNext={ + + } + navPrev={ + + } + noBorder={false} + numberOfMonths={1} + onClose={[Function]} + onDateChange={[Function]} + onFocusChange={[Function]} + onNextMonthClick={[Function]} + onPrevMonthClick={[Function]} + openDirection="down" + orientation="horizontal" + phrases={ + Object { + "calendarLabel": "Calendar", + "chooseAvailableDate": [Function], + "clearDate": "Clear Date", + "closeDatePicker": "Close", + "dateIsSelected": [Function], + "dateIsUnavailable": [Function], + "enterKey": "Enter key", + "escape": "Escape key", + "hideKeyboardShortcutsPanel": "Close the shortcuts panel.", + "homeEnd": "Home and end keys", + "jumpToNextMonth": "Move forward to switch to the next month.", + "jumpToPrevMonth": "Move backward to switch to the previous month.", + "keyboardNavigationInstructions": "Press the down arrow key to interact with the calendar and + select a date. Press the question mark key to get the keyboard shortcuts for changing dates.", + "keyboardShortcuts": "Keyboard Shortcuts", + "leftArrowRightArrow": "Right and left arrow keys", + "moveFocusByOneDay": "Move backward (left) and forward (right) by one day.", + "moveFocusByOneMonth": "Switch months.", + "moveFocusByOneWeek": "Move backward (up) and forward (down) by one week.", + "moveFocustoStartAndEndOfWeek": "Go to the first or last day of a week.", + "openThisPanel": "Open this panel.", + "pageUpPageDown": "page up and page down keys", + "questionMark": "Question mark", + "returnFocusToInput": "Return to the date input field.", + "selectFocusedDate": "Select the date in focus.", + "showKeyboardShortcutsPanel": "Open the keyboard shortcuts panel.", + "upArrowDownArrow": "up and down arrow keys", + } + } + placeholder="" + readOnly={false} + regular={false} + renderCalendarInfo={null} + renderDayContents={[Function]} + renderMonthElement={null} + renderMonthText={null} + reopenPickerOnClearDate={false} + required={false} + screenReaderInputMessage="" + showClearDate={false} + showDefaultInputIcon={false} + small={false} + verticalHeight={null} + verticalSpacing={22} + weekDayFormat="ddd" + withFullScreenPortal={false} + withPortal={false} + /> +
+`; diff --git a/__tests__/shared/components/GUIKit/Datepicker/index.jsx b/__tests__/shared/components/GUIKit/Datepicker/index.jsx new file mode 100644 index 0000000000..c0001cce99 --- /dev/null +++ b/__tests__/shared/components/GUIKit/Datepicker/index.jsx @@ -0,0 +1,12 @@ +import React from 'react'; +import Renderer from 'react-test-renderer/shallow'; + +import Datepicker from 'components/GUIKit/Datepicker'; + + +const rnd = new Renderer(); + +it('Default render', () => { + rnd.render(()); + expect(rnd.getRenderOutput()).toMatchSnapshot(); +}); diff --git a/__tests__/shared/components/GUIKit/Dropdown/__snapshots__/index.jsx.snap b/__tests__/shared/components/GUIKit/Dropdown/__snapshots__/index.jsx.snap new file mode 100644 index 0000000000..1108c3a813 --- /dev/null +++ b/__tests__/shared/components/GUIKit/Dropdown/__snapshots__/index.jsx.snap @@ -0,0 +1,77 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Default render 1`] = ` +
+
+ + + + + radio + +
+
+ +`; diff --git a/__tests__/shared/components/GUIKit/RadioButton/index.jsx b/__tests__/shared/components/GUIKit/RadioButton/index.jsx new file mode 100644 index 0000000000..f386d2bbbd --- /dev/null +++ b/__tests__/shared/components/GUIKit/RadioButton/index.jsx @@ -0,0 +1,12 @@ +import React from 'react'; +import Renderer from 'react-test-renderer/shallow'; + +import RadioButton from 'components/GUIKit/RadioButton'; + + +const rnd = new Renderer(); + +it('Default render', () => { + rnd.render(()); + expect(rnd.getRenderOutput()).toMatchSnapshot(); +}); diff --git a/__tests__/shared/components/GUIKit/TextInput/__snapshots__/index.jsx.snap b/__tests__/shared/components/GUIKit/TextInput/__snapshots__/index.jsx.snap new file mode 100644 index 0000000000..1d2c532062 --- /dev/null +++ b/__tests__/shared/components/GUIKit/TextInput/__snapshots__/index.jsx.snap @@ -0,0 +1,16 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Default render 1`] = ` +
+ +
+`; diff --git a/__tests__/shared/components/GUIKit/TextInput/index.jsx b/__tests__/shared/components/GUIKit/TextInput/index.jsx new file mode 100644 index 0000000000..fb49292a71 --- /dev/null +++ b/__tests__/shared/components/GUIKit/TextInput/index.jsx @@ -0,0 +1,12 @@ +import React from 'react'; +import Renderer from 'react-test-renderer/shallow'; + +import TextInput from 'components/GUIKit/TextInput'; + + +const rnd = new Renderer(); + +it('Default render', () => { + rnd.render(()); + expect(rnd.getRenderOutput()).toMatchSnapshot(); +}); diff --git a/__tests__/shared/components/GUIKit/Textarea/__snapshots__/index.jsx.snap b/__tests__/shared/components/GUIKit/Textarea/__snapshots__/index.jsx.snap new file mode 100644 index 0000000000..c1aa4a9108 --- /dev/null +++ b/__tests__/shared/components/GUIKit/Textarea/__snapshots__/index.jsx.snap @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Default render 1`] = ` +
+