Skip to content

Commit 9a050a0

Browse files
author
fangedShadow
committed
Merge remote-tracking branch 'origin/development' into bhavpreet_create_choosing_village_map_frontend
2 parents 559cfec + 0ac4dcc commit 9a050a0

123 files changed

Lines changed: 2489 additions & 738 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Close PRs from Forks
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- synchronize
8+
9+
jobs:
10+
check-fork:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
pull-requests: write
14+
steps:
15+
- name: Check if PR is from a fork
16+
id: check
17+
run: |
18+
echo "PR head repo: ${{ github.event.pull_request.head.repo.full_name }}"
19+
echo "Base repo: ${{ github.event.repository.full_name }}"
20+
if [[ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.event.repository.full_name }}" ]]; then
21+
echo "PR is from a fork"
22+
echo "is_fork=true" >> $GITHUB_ENV
23+
else
24+
echo "PR is not from a fork"
25+
echo "is_fork=false" >> $GITHUB_ENV
26+
fi
27+
28+
- name: Close PR and add comment
29+
if: env.is_fork == 'true'
30+
run: |
31+
PR_NUMBER=${{ github.event.pull_request.number }}
32+
GH_REPO=${{ github.repository }}
33+
echo "Closing PR #$PR_NUMBER in repository $GH_REPO"
34+
gh pr close \
35+
"$PR_NUMBER" \
36+
--repo "${{ github.repository }}" \
37+
--comment "This PR has been closed because PRs from forks are not allowed. Please create a branch directly off the origin repository and resubmit your PR."
38+
env:
39+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

src/App.css

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ body {
99

1010
#root {
1111
height: 100%;
12-
overflow-x: auto;
12+
overflow-x: auto;
1313
overflow: hidden;
1414
/* background-color: var(--background-color); */
1515
background-color: #ffffff;
@@ -98,7 +98,7 @@ body {
9898
/* 90%to100%-red */
9999
}
100100

101-
.bg-oxford-blue{
101+
.bg-oxford-blue {
102102
background-color: #1B2A41 !important;
103103
}
104104

@@ -107,7 +107,7 @@ body {
107107
color:black;
108108
} */
109109

110-
.bg-space-cadet{
110+
.bg-space-cadet {
111111
background-color: #1C2541 !important;
112112
}
113113

@@ -116,7 +116,7 @@ body {
116116
color:black;
117117
} */
118118

119-
.bg-yinmn-blue{
119+
.bg-yinmn-blue {
120120
background-color: #3A506B !important;
121121
}
122122

@@ -125,55 +125,67 @@ body {
125125
color: black;
126126
} */
127127

128-
.bg-yinmn-blue-light{
129-
background-color:#2f4157;
128+
.bg-yinmn-blue-light {
129+
background-color: #2f4157;
130130
}
131131

132132
/* .bg-yinmn-blue-light:hover{
133133
background-color:#2f4157;
134134
color: black;
135135
} */
136136

137-
.bg-azure{
137+
.bg-darkmode-liblack {
138+
background-color: #1C1C1C !important;
139+
}
140+
141+
.bg-darkmode-black {
142+
background-color: #000000 !important;
143+
}
144+
145+
.bg-azure {
138146
background-color: #007BFF !important;
139147
}
140148

141-
.text-oxford-blue{
149+
.text-oxford-blue {
142150
color: #1B2A41 !important;
143151
}
144152

145-
.text-space-cadet{
153+
.text-space-cadet {
146154
color: #1C2541 !important;
147155
}
148156

149-
.text-yinmn-blue{
157+
.text-yinmn-blue {
150158
color: #3A506B !important;
151159
}
152160

153-
.text-azure{
161+
.text-azure {
154162
color: #007BFF !important;
155163
}
156164

157-
.text-dark-green{
165+
.text-dark-green {
158166
color: #193D31 !important;
159167
}
160168

161-
.text-custom-grey{
169+
.text-custom-grey {
162170
color: rgb(192, 192, 192) !important;
163171
}
164172

165173
.box-shadow-dark {
166174
box-shadow: 2px 2px 4px 1px black;
167175
}
168176

169-
.box-shadow-light{
177+
.box-shadow-light {
170178
box-shadow: 2px 2px 4px 1px lightgray;
171179
}
172180

173-
nav ul.navbar-nav li:last-child > div {
181+
nav ul.navbar-nav li:last-child>div {
174182
transform: translate3d(-26px, 40px, 0px) !important;
175183
}
176184

185+
.calendar-icon-dark {
186+
color-scheme: dark;
187+
}
188+
177189
.top {
178190
text-decoration: none;
179191
padding: 10px;
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
import axios from 'axios'; // Import axios for making HTTP requests
2+
import configureMockStore from 'redux-mock-store'; // Import redux-mock-store for creating a mock store
3+
import thunk from 'redux-thunk'; // Import redux-thunk for handling asynchronous actions
4+
import * as types from '../../constants/BluequareEmailBccConstants'; // Import the action type constants
5+
import { setBlueSquareEmailAssignement, deleteBlueSquareEmailAssignement } from '../blueSquareEmailBCCAction'; // Import the action creator
6+
7+
// Mock axios to control its behavior in tests
8+
jest.mock('axios');
9+
10+
// Define middlewares to be used in the mock store
11+
const middlewares = [thunk];
12+
// Create a mock store with the defined middlewares
13+
const mockStore = configureMockStore(middlewares);
14+
15+
// Define the test suite for the setBlueSquareEmailAssignement action creator
16+
describe('setBlueSquareEmailAssignement action creator', () => {
17+
// Define a test case for the success scenario
18+
it('should handle setting a blue square email assignment successfully', async () => {
19+
// Create an empty mock store
20+
const store = mockStore({});
21+
// Define the email to be used in the test
22+
const email = 'test@example.com';
23+
// Define the expected response data
24+
const responseData = { id: 1, email };
25+
26+
// Mock the axios.post method to resolve with the expected response data
27+
axios.post.mockResolvedValue({ status: 200, data: responseData });
28+
29+
// Dispatch the setBlueSquareEmailAssignement action with the email
30+
await store.dispatch(setBlueSquareEmailAssignement(email));
31+
32+
// Assert that the actions dispatched include the setBlueSquareEmailBcc action
33+
const actionsDispatched = store.getActions();
34+
expect(actionsDispatched).toContainEqual({
35+
type: types.SET_BLUE_SQUARE_EMAIL_ASSIGNMENT,
36+
payload: responseData,
37+
});
38+
});
39+
40+
// Define a test case for the failure scenario
41+
it('should handle setting a blue square email assignment failure', async () => {
42+
// Create an empty mock store
43+
const store = mockStore({});
44+
// Define the email to be used in the test
45+
const email = 'test@example.com';
46+
// Define the expected error message
47+
const errorMessage = 'Network Error';
48+
49+
// Mock the axios.post method to reject with an error
50+
axios.post.mockRejectedValue(new Error(errorMessage));
51+
52+
// Dispatch the setBlueSquareEmailAssignement action with the email
53+
await store.dispatch(setBlueSquareEmailAssignement(email));
54+
55+
// Assert that the actions dispatched include the blueSquareEmailBccError action
56+
const actionsDispatched = store.getActions();
57+
expect(actionsDispatched).toContainEqual({
58+
type: types.BLUE_SQUARE_EMAIL_ASSIGNMENT_ERROR,
59+
payload: new Error(errorMessage),
60+
});
61+
});
62+
});
63+
64+
// Define the test suite for the deleteBlueSquareEmailAssignement action creator
65+
describe('deleteBlueSquareEmailAssignement action creator', () => {
66+
// Define a test case for the success scenario
67+
it('should handle deleting a blue square email assignment successfully', async () => {
68+
// Create an empty mock store
69+
const store = mockStore({});
70+
// Define the ID to be used in the test
71+
const id = 1;
72+
// Define the expected response data
73+
const responseData = { id };
74+
75+
// Mock the axios.delete method to resolve with the expected response data
76+
axios.delete.mockResolvedValue({ status: 200, data: responseData });
77+
78+
// Dispatch the deleteBlueSquareEmailAssignement action with the ID
79+
await store.dispatch(deleteBlueSquareEmailAssignement(id));
80+
81+
// Assert that the actions dispatched include the deleteBlueSquareEmailBcc action
82+
const actionsDispatched = store.getActions();
83+
expect(actionsDispatched).toContainEqual({
84+
type: types.DELETE_BLUE_SQUARE_EMAIL_ASSIGNMENT,
85+
payload: id,
86+
});
87+
});
88+
89+
// Define a test case for the failure scenario
90+
it('should handle deleting a blue square email assignment failure', async () => {
91+
// Create an empty mock store
92+
const store = mockStore({});
93+
// Define the ID to be used in the test
94+
const id = 1;
95+
// Define the expected error message
96+
const errorMessage = 'Network Error';
97+
98+
// Mock the axios.delete method to reject with an error
99+
axios.delete.mockRejectedValue(new Error(errorMessage));
100+
101+
// Dispatch the deleteBlueSquareEmailAssignement action with the ID
102+
await store.dispatch(deleteBlueSquareEmailAssignement(id));
103+
104+
// Assert that the actions dispatched include the blueSquareEmailBccError action
105+
const actionsDispatched = store.getActions();
106+
expect(actionsDispatched).toContainEqual({
107+
type: types.BLUE_SQUARE_EMAIL_ASSIGNMENT_ERROR,
108+
payload: new Error(errorMessage),
109+
});
110+
});
111+
});

0 commit comments

Comments
 (0)