-
Notifications
You must be signed in to change notification settings - Fork 85
/
Copy pathfeedbackBoardContainer.test.tsx
62 lines (57 loc) · 1.74 KB
/
feedbackBoardContainer.test.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import React from 'react';
import { shallow } from 'enzyme';
import { mocked } from 'jest-mock';
import FeedbackBoardContainer, { FeedbackBoardContainerProps } from '../feedbackBoardContainer';
const getTeamIterationsMock = () => {
return [
mocked({
attributes: mocked({
finishDate: new Date(),
startDate: new Date(),
timeFrame: 1,
}),
id: 'iterationId',
name: 'iteration name',
path: 'default path',
_links: [],
url: 'https://teamfieldvaluesurl'
})
];
};
const getTeamFieldValuesMock = () => {
return [
mocked({
defaultValue: 'default field value',
field: mocked({
referenceName: 'default reference name',
url: 'https://fieldurl'
}),
values: [
mocked({
includeChildren: false,
value: 'default team field value',
})
],
links: [],
url: 'https://teamfieldvaluesurl'
})]
};
jest.mock('../feedbackBoardMetadataForm', () => { return mocked({});});
jest.mock('azure-devops-extension-api/Work/WorkClient', () => {
return {
getTeamIterations: getTeamIterationsMock,
getTeamFieldValues: getTeamFieldValuesMock,
};
});
const feedbackBoardContainerProps: FeedbackBoardContainerProps = {
isHostedAzureDevOps: false,
projectId: '1',
};
describe('Feedback Board Container ', () => {
it('can be rendered without content.', () => {
const wrapper = shallow(<FeedbackBoardContainer {...feedbackBoardContainerProps} /> as any);
expect(wrapper.children().dive().html()).toBe(
'<div class="ms-Spinner initialization-spinner root-53"><div class="ms-Spinner-circle ms-Spinner--large circle-54">' +
'</div><div class="ms-Spinner-label label-55">Loading...</div></div>');
});
});