Skip to content

Commit 3428432

Browse files
vaishnavi-gupta18amlannandy
authored andcommitted
Add test data in constants and fix issueDetails bug
1 parent 3013c0b commit 3428432

File tree

4 files changed

+222
-243
lines changed

4 files changed

+222
-243
lines changed

labellab-client/src/__tests__/components/issueDetails.test.js

+1-135
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Enzyme, { shallow } from 'enzyme'
33
import Adapter from 'enzyme-adapter-react-16';
44
import { testStore, findByTestAttr } from '../../utils/TestUtils'
55
import IssueDetails from '../../components/project/issue/issueDetails'
6+
import {issues, logs, projects, user, labels} from '../../constants/test'
67

78
Enzyme.configure({
89
adapter: new Adapter(),
@@ -20,141 +21,6 @@ const setUp = (initialState = {}, props = {}) => {
2021
describe('Issues Details Component', () => {
2122

2223
let wrapper
23-
const issues = {
24-
currentIssue: {
25-
"assigneeId": 1,
26-
"category": "general",
27-
"comments": [
28-
{
29-
"body": "hey",
30-
"id": 1,
31-
"issue_id": 1,
32-
"thumbnail": "https://react.semantic-ui.com/images/avatar/large/elliot.jpg",
33-
"timestamp": "2022-07-21 20:42:27",
34-
"user_id": 1,
35-
"username": "vaishnavi"
36-
}
37-
],
38-
"createdAt": "2022-07-07 13:42:25",
39-
"createdBy": 1,
40-
"description": "Frontend Test",
41-
"dueDate": "2022-07-21 04:55:00",
42-
"entityId": 1,
43-
"entityType": "label",
44-
"id": 1,
45-
"priority": "Critical",
46-
"projectId": 1,
47-
"status": "Closed",
48-
"teamId": 1,
49-
"title": "Frontend Test",
50-
"updatedAt": "2022-08-11 18:53:51"
51-
},
52-
issuesActions: {
53-
isFetching: false,
54-
isDeleting: false,
55-
isPosting: false,
56-
isUpdating: false,
57-
errors: ''
58-
},
59-
comments: [
60-
{
61-
"body": "hey",
62-
"id": 1,
63-
"issue_id": 1,
64-
"thumbnail": "https://react.semantic-ui.com/images/avatar/large/elliot.jpg",
65-
"timestamp": "2022-07-21 20:42:27",
66-
"user_id": 1,
67-
"username": "John Doe"
68-
}
69-
]
70-
}
71-
const logs = {
72-
logs: [
73-
{
74-
"category": "general",
75-
"entity_id": 1,
76-
"entity_type": "issue",
77-
"id": 1,
78-
"message": "Issue Frontend Test has been created",
79-
"project_id": 1,
80-
"timestamp": "Thu, 11 Aug 2022 18:53:51 GMT",
81-
"user_id": 1,
82-
"username": "John Doe"
83-
}
84-
],
85-
logsActions: {
86-
"isFetching": false
87-
}
88-
}
89-
const projects = {
90-
currentProject: {
91-
projectId: 1,
92-
members: [
93-
{
94-
"email": "[email protected]",
95-
"name": "John doe",
96-
"project_id": 1,
97-
"team_id": 1,
98-
"team_name": "admin",
99-
"team_role": "admin",
100-
"user_id": 1
101-
},
102-
],
103-
roles: [
104-
"admin"
105-
],
106-
teams: [
107-
{
108-
"id": 1,
109-
"project_id": 1,
110-
"role": "admin",
111-
"team_members": [
112-
{
113-
"team_id": 1,
114-
"user_id": 2
115-
},
116-
{
117-
"team_id": 1,
118-
"user_id": 1
119-
}
120-
],
121-
"team_name": "admin"
122-
},
123-
]
124-
}
125-
}
126-
const user = {
127-
users: [
128-
{
129-
"email": "[email protected]",
130-
"id": 1,
131-
"name": "John doe",
132-
"thumbnail": "https://react.semantic-ui.com/images/avatar/large/elliot.jpg",
133-
"username": "John Doe"
134-
}
135-
],
136-
userDetails: {
137-
"id": 1,
138-
"name": "John doe",
139-
"email": "[email protected]",
140-
"username": "John Doe",
141-
"thumbnail": "https://react.semantic-ui.com/images/avatar/large/elliot.jpg",
142-
"profileImage": "https://react.semantic-ui.com/images/avatar/large/elliot.jpg"
143-
}
144-
}
145-
const labels = {
146-
labels: [
147-
{
148-
"count": 0,
149-
"created_at": "2022-07-08 14:41:15",
150-
"id": 1,
151-
"label_name": "Label 1",
152-
"label_type": "bbox",
153-
"labeldata": {},
154-
"project_id": 1
155-
}
156-
]
157-
}
15824
beforeEach(() => {
15925
const initialState = {
16026
issues: issues,

labellab-client/src/__tests__/components/issues.test.js

+6-84
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import Enzyme, { shallow } from 'enzyme'
33
import Adapter from 'enzyme-adapter-react-16';
44
import { testStore, findByTestAttr } from '../../utils/TestUtils'
55
import ProjectIssues from '../../components/project/issue/issues'
6+
import {issues, logs, projects, user, labels} from '../../constants/test'
67

78
Enzyme.configure({
89
adapter: new Adapter(),
@@ -20,92 +21,13 @@ const setUp = (initialState = {}, props = {}) => {
2021
describe('Issues Listing Component', () => {
2122

2223
let wrapper
23-
const issues = {
24-
issues: {
25-
"items": [
26-
{
27-
"assignee_id": null,
28-
"category": "labels",
29-
"created_at": "2022-08-13 18:30:12",
30-
"created_by": 2,
31-
"description": "test issue 1",
32-
"due_date": null,
33-
"entity_id": null,
34-
"entity_type": null,
35-
"id": 1,
36-
"priority": "Low",
37-
"project_id": 1,
38-
"status": "Done",
39-
"team_id": null,
40-
"title": "test issue 1",
41-
"updated_at": "2022-08-13 18:30:12"
42-
},
43-
{
44-
"assignee_id": null,
45-
"category": "models",
46-
"created_at": "2022-08-13 18:29:37",
47-
"created_by": 2,
48-
"description": "test issue 2",
49-
"due_date": null,
50-
"entity_id": null,
51-
"entity_type": null,
52-
"id": 2,
53-
"priority": "Low",
54-
"project_id": 1,
55-
"status": "In Progress",
56-
"team_id": null,
57-
"title": "test issue 2",
58-
"updated_at": "2022-08-13 18:29:37"
59-
}
60-
],
61-
"page": 1,
62-
"perPage": 6,
63-
"total": 2
64-
},
65-
teams: [
66-
{
67-
"key": 1,
68-
"value": 1,
69-
"text": "admin"
70-
},
71-
{
72-
"key": 2,
73-
"value": 2,
74-
"text": "images"
75-
}
76-
],
77-
members: [
78-
{
79-
"email": "[email protected]",
80-
"name": "John doe",
81-
"project_id": 1,
82-
"team_id": 2,
83-
"team_name": "images",
84-
"team_role": "images",
85-
"user_id": 1
86-
},
87-
],
88-
users: [
89-
{
90-
"email": "[email protected]",
91-
"id": 1,
92-
"name": "John doe",
93-
"thumbnail": "https://react.semantic-ui.com/images/avatar/large/elliot.jpg",
94-
"username": "John Doe"
95-
}
96-
],
97-
projectId: 1,
98-
issuesActions: {
99-
isFetching: false,
100-
isDeleting: false,
101-
isPosting: false,
102-
isUpdating: false,
103-
errors: ''
104-
}
105-
}
10624
beforeEach(() => {
10725
const initialState = {
108-
issues: issues
26+
issues: issues,
27+
logs: logs,
28+
projects: projects,
29+
user: user,
30+
labels: labels
10931
}
11032
wrapper = setUp(initialState);
11133
});

0 commit comments

Comments
 (0)