Skip to content

Commit 07b18b4

Browse files
committed
revert all other changes not related to social component
1 parent 444c844 commit 07b18b4

File tree

2 files changed

+57
-6
lines changed

2 files changed

+57
-6
lines changed

src/components/__tests__/__snapshots__/social.test.js.snap

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ exports[`Social renders correctly 1`] = `
2525
id="github"
2626
onChange={[Function]}
2727
placeholder="github username"
28-
value="github"
28+
value="github "
2929
/>
3030
</div>
3131
<div
@@ -41,6 +41,7 @@ exports[`Social renders correctly 1`] = `
4141
id="twitter"
4242
onChange={[Function]}
4343
placeholder="twitter username"
44+
value="twitter"
4445
/>
4546
</div>
4647
<div
@@ -56,6 +57,7 @@ exports[`Social renders correctly 1`] = `
5657
id="dev"
5758
onChange={[Function]}
5859
placeholder="dev.to username"
60+
value="dev"
5961
/>
6062
</div>
6163
<div
@@ -71,6 +73,7 @@ exports[`Social renders correctly 1`] = `
7173
id="codepen"
7274
onChange={[Function]}
7375
placeholder="codepen username"
76+
value="codepen"
7477
/>
7578
</div>
7679
<div
@@ -86,6 +89,7 @@ exports[`Social renders correctly 1`] = `
8689
id="codesandbox"
8790
onChange={[Function]}
8891
placeholder="codesandbox username"
92+
value="codesandbodx"
8993
/>
9094
</div>
9195
<div
@@ -101,6 +105,7 @@ exports[`Social renders correctly 1`] = `
101105
id="stackoverflow"
102106
onChange={[Function]}
103107
placeholder="stackoverflow user ID"
108+
value="stackoverflow"
104109
/>
105110
</div>
106111
<div
@@ -116,6 +121,7 @@ exports[`Social renders correctly 1`] = `
116121
id="linkedin"
117122
onChange={[Function]}
118123
placeholder="linkedin username"
124+
value="linkedin"
119125
/>
120126
</div>
121127
<div
@@ -131,6 +137,7 @@ exports[`Social renders correctly 1`] = `
131137
id="kaggle"
132138
onChange={[Function]}
133139
placeholder="kaggle username"
140+
value="kaggle"
134141
/>
135142
</div>
136143
<div
@@ -146,6 +153,7 @@ exports[`Social renders correctly 1`] = `
146153
id="fb"
147154
onChange={[Function]}
148155
placeholder="facebook username"
156+
value="fb"
149157
/>
150158
</div>
151159
<div
@@ -161,6 +169,7 @@ exports[`Social renders correctly 1`] = `
161169
id="instagram"
162170
onChange={[Function]}
163171
placeholder="instagram username"
172+
value="instagram"
164173
/>
165174
</div>
166175
<div
@@ -191,6 +200,7 @@ exports[`Social renders correctly 1`] = `
191200
id="behance"
192201
onChange={[Function]}
193202
placeholder="behance username"
203+
value="behance"
194204
/>
195205
</div>
196206
<div
@@ -206,6 +216,7 @@ exports[`Social renders correctly 1`] = `
206216
id="medium"
207217
onChange={[Function]}
208218
placeholder="medium username (with @)"
219+
value="medium"
209220
/>
210221
</div>
211222
<div
@@ -221,6 +232,7 @@ exports[`Social renders correctly 1`] = `
221232
id="youtube"
222233
onChange={[Function]}
223234
placeholder="youtube channel name"
235+
value="youtube"
224236
/>
225237
</div>
226238
<div
@@ -236,6 +248,7 @@ exports[`Social renders correctly 1`] = `
236248
id="codechef"
237249
onChange={[Function]}
238250
placeholder="codechef username"
251+
value="codechef"
239252
/>
240253
</div>
241254
<div
@@ -266,6 +279,7 @@ exports[`Social renders correctly 1`] = `
266279
id="codeforces"
267280
onChange={[Function]}
268281
placeholder="codeforces username"
282+
value="codeforces"
269283
/>
270284
</div>
271285
<div
@@ -281,6 +295,7 @@ exports[`Social renders correctly 1`] = `
281295
id="leetcode"
282296
onChange={[Function]}
283297
placeholder="leetcode username"
298+
value="leetcode"
284299
/>
285300
</div>
286301
<div
@@ -296,6 +311,7 @@ exports[`Social renders correctly 1`] = `
296311
id="topcoder"
297312
onChange={[Function]}
298313
placeholder="topcoder username"
314+
value="topcoder"
299315
/>
300316
</div>
301317
<div
@@ -311,6 +327,7 @@ exports[`Social renders correctly 1`] = `
311327
id="hackerearth"
312328
onChange={[Function]}
313329
placeholder="hackerearth user (with @)"
330+
value="@hackerearth"
314331
/>
315332
</div>
316333
<div
@@ -326,6 +343,7 @@ exports[`Social renders correctly 1`] = `
326343
id="geeksforgeeks"
327344
onChange={[Function]}
328345
placeholder="GFG (<username>/profile)"
346+
value="geeks_for_geeks"
329347
/>
330348
</div>
331349
<div
@@ -341,6 +359,7 @@ exports[`Social renders correctly 1`] = `
341359
id="discord"
342360
onChange={[Function]}
343361
placeholder="discord invite (only code)"
362+
value="discord"
344363
/>
345364
</div>
346365
<div
@@ -356,6 +375,7 @@ exports[`Social renders correctly 1`] = `
356375
id="rssurl"
357376
onChange={[Function]}
358377
placeholder="RSS feed URL"
378+
value="rssurl"
359379
/>
360380
</div>
361381
</div>
Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,44 @@
11
import React from "react"
2-
import renderer from "react-test-renderer"
2+
import { shallow } from "enzyme"
3+
import toJson from "enzyme-to-json"
34

45
import Social from "../social"
56

67
describe("Social", () => {
8+
const mockEvent = { target: { value: "This is a mock event" } }
9+
const props = {
10+
social: {
11+
github: "github ",
12+
twitter: "twitter",
13+
dev: "dev",
14+
codepen: "codepen",
15+
codesandbox: "codesandbodx",
16+
stackoverflow: "stackoverflow",
17+
linkedin: "linkedin",
18+
kaggle: "kaggle",
19+
fb: "fb",
20+
instagram: "instagram",
21+
dribble: "dribble",
22+
behance: "behance",
23+
medium: "medium",
24+
youtube: "youtube",
25+
codechef: "codechef",
26+
hackerrack: "hackerranck",
27+
codeforces: "codeforces",
28+
leetcode: "leetcode",
29+
topcoder: "topcoder",
30+
hackerearth: "@hackerearth",
31+
geeks_for_geeks: "geeks_for_geeks",
32+
discord: "discord",
33+
rssurl: "rssurl",
34+
},
35+
handleSocialChange: jest.fn().mockReturnValue({}),
36+
}
737
it("renders correctly", () => {
8-
const tree = renderer
9-
.create(<Social social={{ github: "github" }} />)
10-
.toJSON()
11-
expect(tree).toMatchSnapshot()
38+
const component = shallow(<Social {...props} />)
39+
for (let i = 0; i < component.find("input").length; i++) {
40+
component.find("input").at(i).simulate("change", mockEvent)
41+
}
42+
expect(toJson(component)).toMatchSnapshot()
1243
})
1344
})

0 commit comments

Comments
 (0)