Skip to content

Commit cab4aff

Browse files
Merge pull request #5079 from topcoder-platform/listing-develop-sync
Smoke Testing 2020-10-09
2 parents 14f90de + 76f9b5c commit cab4aff

File tree

55 files changed

+3561
-3321
lines changed

Some content is hidden

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

55 files changed

+3561
-3321
lines changed

.circleci/config.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,8 @@ workflows:
236236
context : org-global
237237
filters:
238238
branches:
239-
only:
240-
- hot-fix-ad-code
241-
- feature-contentful
239+
only:
240+
- develop
242241
# This is alternate dev env for parallel testing
243242
- "build-qa":
244243
context : org-global
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
});

0 commit comments

Comments
 (0)