Skip to content

Sync feature refactor challengelist with develop #5042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
dc52de0
Refactor challenge list
LieutenantRoger Aug 24, 2020
b41f46c
Fix tests
LieutenantRoger Sep 2, 2020
54ef309
restore the package-lock.json
LieutenantRoger Sep 2, 2020
0e84539
additional fix on 2020-09-12
LieutenantRoger Sep 12, 2020
229ed9a
integrate sub-community filter
LieutenantRoger Sep 12, 2020
5ec9c71
adjust the groups param
LieutenantRoger Sep 12, 2020
934d620
update groupId into groups
LieutenantRoger Sep 13, 2020
39c44ba
update the groupId into group name
LieutenantRoger Sep 19, 2020
6f843f5
fix issues on sub community dropdown list
LieutenantRoger Sep 20, 2020
2846f46
Fix: for #4594
luizrrodrigues Sep 21, 2020
07e1bab
ci: Deploy feature-refactor-challengelist to Test
luizrrodrigues Sep 21, 2020
69030c7
ci: Deploy feature-refactor-challengelist to Stag
luizrrodrigues Sep 21, 2020
46d11e6
Fix issues for:
LieutenantRoger Sep 21, 2020
fa93b3d
Merge pull request #4983 from topcoder-platform/feature-refactor-chal…
sushilshinde Sep 22, 2020
5009021
Fix issue: https://github.com/topcoder-platform/community-app/issues/…
LieutenantRoger Sep 22, 2020
ea48bcd
Display the number of filters applied
gets0ul Sep 23, 2020
e1d09bd
Merge pull request #4986 from gets0ul/issue-4966
sushilshinde Sep 23, 2020
962d894
fix: for issue #4964
narekcat Sep 23, 2020
d025513
Fix sorted of by 'Most recent' of My Challenges bucket and sorted by …
gets0ul Sep 23, 2020
fbe8ea2
fix(challenge-listing): do not render buckets that have 0 challenges
cagdas001 Sep 23, 2020
5c59bf9
Fix issue: https://github.com/topcoder-platform/community-app/issues/…
LieutenantRoger Sep 23, 2020
959e5a2
Fix comment. Sorting by review start date is ascending as in prod env.
gets0ul Sep 23, 2020
4e60e7a
Revert back the comment. As sorting is in descending order.
gets0ul Sep 23, 2020
66ef300
Merge pull request #4993 from topcoder-platform/feature-refactor-chal…
luizrrodrigues Sep 24, 2020
74870c9
Merge pull request #4992 from cagdas001/fix-4962
luizrrodrigues Sep 24, 2020
57918b7
ci: Remove feature-refactor-challengelist from Stag env
luizrrodrigues Sep 24, 2020
346296a
Merge branch 'feature-refactor-challengelist' into issue-4964
narekcat Sep 24, 2020
92df869
Apply the same sorting to other buckets.
gets0ul Sep 24, 2020
f14f861
fix(challenge-listing): add NO_LIVE_CHALLENGES messsage to All bucket…
cagdas001 Sep 24, 2020
524e091
Fix challenge detail screen
LieutenantRoger Sep 26, 2020
64a6ef5
Revert Review Opportunities sort to asc
luizrrodrigues Sep 29, 2020
692b747
Merge pull request #4991 from gets0ul/issue-4973
luizrrodrigues Sep 29, 2020
83e012b
Merge pull request #4989 from narekcat/issue-4964
luizrrodrigues Sep 29, 2020
8e0504e
ci: deploy feature-refactor-challengelist to Stag
luizrrodrigues Sep 29, 2020
db8315b
stays on main challenge listing when view more challenges is clicked.
gets0ul Sep 29, 2020
79a6894
update the track name
LieutenantRoger Sep 30, 2020
7e0f013
Update track name
luizrrodrigues Sep 30, 2020
97d3c88
Merge pull request #5008 from topcoder-platform/feature-refactor-chal…
luizrrodrigues Oct 1, 2020
003bc67
fix: for issue #4965
luizrrodrigues Oct 1, 2020
4993459
fix: add placeholder challenge cards when loading
cagdas001 Oct 1, 2020
c0c7eeb
fix(challenge-listing): ongoing challenges bucket won't include openF…
cagdas001 Oct 1, 2020
a352932
Merge pull request #5017 from gets0ul/issue_5002-fix
luizrrodrigues Oct 2, 2020
cb067d6
Merge pull request #5001 from cagdas001/fix-4962
luizrrodrigues Oct 2, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ workflows:
filters:
branches:
only:
- integration-v5-challenge-api
- feature-refactor-challengelist
# This is alternate dev env for parallel testing
- "build-qa":
context : org-global
Expand All @@ -259,6 +259,7 @@ workflows:
branches:
only:
- develop
- feature-refactor-challengelist
# Production builds are exectuted
# when PR is merged to the master
# Don't change anything in this configuration
Expand Down
168 changes: 3 additions & 165 deletions __tests__/shared/actions/challenge-listing/sidebar.js
Original file line number Diff line number Diff line change
@@ -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(() => {
Expand All @@ -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')));
});
Loading