Skip to content

Commit 7e234b4

Browse files
test: add unit test for happy path for extract names function
1 parent 6f4c395 commit 7e234b4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import ExtractNamesFromJson from "../extractNamesFromJson";
2+
3+
const data = [
4+
{
5+
title: "",
6+
media_list_data: [],
7+
string_list_data: [
8+
{
9+
href: "https://www.instagram.com/POTUS",
10+
value: "POTUS",
11+
timestamp: 2248397812,
12+
},
13+
],
14+
},
15+
{
16+
title: "",
17+
media_list_data: [],
18+
string_list_data: [
19+
{
20+
href: "https://www.instagram.com/NASA",
21+
value: "NASA",
22+
timestamp: 1267694584,
23+
},
24+
],
25+
},
26+
];
27+
28+
describe("Extract Names Function Tests", () => {
29+
describe("Core Logic", () => {
30+
it("should return an array of usernames when a proper json is input", () => {
31+
const result = ExtractNamesFromJson(data);
32+
expect(result).toEqual(["POTUS", "NASA"]);
33+
});
34+
});
35+
});

0 commit comments

Comments
 (0)