@tscircuit/fake-snippets 0.0.34 → 0.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/.github/workflows/bun-test.yml +3 -0
  2. package/bun-tests/fake-snippets-api/fixtures/get-test-server.ts +12 -1
  3. package/bun-tests/fake-snippets-api/routes/accounts/get_account_balance.test.ts +1 -5
  4. package/bun-tests/fake-snippets-api/routes/orders/create.test.ts +0 -1
  5. package/bun-tests/fake-snippets-api/routes/orders/list.test.ts +3 -3
  6. package/bun-tests/fake-snippets-api/routes/package_files/create.test.ts +28 -84
  7. package/bun-tests/fake-snippets-api/routes/package_releases/create.test.ts +12 -36
  8. package/bun-tests/fake-snippets-api/routes/package_releases/list.test.ts +4 -12
  9. package/bun-tests/fake-snippets-api/routes/package_releases/update.test.ts +16 -48
  10. package/bun-tests/fake-snippets-api/routes/packages/add_star.test.ts +12 -44
  11. package/bun-tests/fake-snippets-api/routes/packages/create.test.ts +4 -12
  12. package/bun-tests/fake-snippets-api/routes/packages/delete.test.ts +15 -41
  13. package/bun-tests/fake-snippets-api/routes/packages/list-1.test.ts +1 -5
  14. package/bun-tests/fake-snippets-api/routes/packages/list-2.test.ts +6 -19
  15. package/bun-tests/fake-snippets-api/routes/packages/remove_star.test.ts +9 -36
  16. package/bun-tests/fake-snippets-api/routes/packages/update.test.ts +26 -74
  17. package/bun-tests/fake-snippets-api/routes/snippets/add_star.test.ts +12 -47
  18. package/bun-tests/fake-snippets-api/routes/snippets/create.test.ts +6 -14
  19. package/bun-tests/fake-snippets-api/routes/snippets/delete.test.ts +9 -33
  20. package/bun-tests/fake-snippets-api/routes/snippets/generate_from_jlcpcb.test.ts +3 -12
  21. package/bun-tests/fake-snippets-api/routes/snippets/list.test.ts +9 -34
  22. package/bun-tests/fake-snippets-api/routes/snippets/remove_star.test.ts +12 -44
  23. package/bun-tests/fake-snippets-api/routes/snippets/update.test.ts +12 -36
  24. package/bun.lock +27 -29
  25. package/dist/bundle.js +45 -27
  26. package/fake-snippets-api/lib/middleware/with-optional-session-auth.ts +27 -8
  27. package/fake-snippets-api/lib/middleware/with-session-auth.ts +17 -6
  28. package/fake-snippets-api/routes/api/snippets/add_star.ts +2 -4
  29. package/fake-snippets-api/routes/api/snippets/create.ts +8 -10
  30. package/package.json +5 -4
  31. package/src/App.tsx +3 -0
  32. package/src/components/CodeAndPreview.tsx +2 -2
  33. package/src/components/CodeEditor.tsx +1 -1
  34. package/src/components/DownloadButtonAndMenu.tsx +13 -11
  35. package/src/components/Footer.tsx +3 -0
  36. package/src/components/SnippetCard.tsx +159 -0
  37. package/src/components/ViewPackagePage/components/main-content-view-selector.tsx +89 -27
  38. package/src/pages/404.tsx +56 -0
  39. package/src/pages/trending.tsx +222 -0
  40. package/src/pages/user-profile.tsx +11 -102
  41. package/src/pages/view-package.tsx +18 -2
  42. package/src/lib/templates/manual-edits-template.ts +0 -5
@@ -3,23 +3,17 @@ import { expect, test } from "bun:test"
3
3
  test("list packages with is_writable filter", async () => {
4
4
  const { axios, db } = await getTestServer()
5
5
 
6
- // Log the initial state of packages in the database
7
- console.log("LIST-2 TEST - Initial packages in DB:", db.packages)
8
-
9
6
  // Add test packages
10
7
  const packages = [
11
8
  {
12
9
  package_id: "pkg1",
13
- name: "Package1",
14
- unscoped_name: "Package1",
15
- owner_github_username: "testuser", // Matches auth context github_username
16
- creator_account_id: "account-1234", // Matches auth context account_id
10
+ name: "testuser/testPackage1",
11
+ unscoped_name: "testPackage1",
17
12
  created_at: "2023-01-01T00:00:00Z",
18
13
  updated_at: "2023-01-01T00:00:00Z",
19
14
  description: "Description 1",
20
15
  ai_description: "AI Description 1",
21
16
  ai_usage_instructions: "Usage instructions 1",
22
- owner_org_id: "org-1234", // Matches auth context personal_org_id
23
17
  latest_version: "1.0.0",
24
18
  license: "MIT",
25
19
  is_source_from_github: true,
@@ -27,16 +21,13 @@ test("list packages with is_writable filter", async () => {
27
21
  },
28
22
  {
29
23
  package_id: "pkg2",
30
- name: "Package2",
31
- unscoped_name: "Package2",
32
- owner_github_username: "user2",
33
- creator_account_id: "creator2",
24
+ name: "testuser/testPackage2",
25
+ unscoped_name: "testPackage2",
34
26
  created_at: "2023-01-02T00:00:00Z",
35
27
  updated_at: "2023-01-02T00:00:00Z",
36
28
  description: "Description 2",
37
29
  ai_description: "AI Description 2",
38
30
  ai_usage_instructions: "Usage instructions 2",
39
- owner_org_id: "other-org",
40
31
  latest_version: "1.0.0",
41
32
  license: "MIT",
42
33
  is_source_from_github: true,
@@ -46,16 +37,12 @@ test("list packages with is_writable filter", async () => {
46
37
 
47
38
  // Add only these test packages
48
39
  for (const pkg of packages) {
49
- db.addPackage(pkg as any)
40
+ await axios.post("/api/packages/create", pkg)
50
41
  }
51
42
 
52
43
  // Test with is_writable filter (requires auth)
53
44
  const { data: writableData } = await axios.get("/api/packages/list", {
54
45
  params: { is_writable: true },
55
- headers: {
56
- Authorization: "Bearer 1234",
57
- },
58
46
  })
59
- expect(writableData.packages).toHaveLength(1)
60
- expect(writableData.packages[0].owner_org_id).toBe("org-1234")
47
+ expect(writableData.packages).toHaveLength(2)
61
48
  })
@@ -69,9 +69,6 @@ test("remove star from package using name", async () => {
69
69
  // Verify star was removed by checking the package again
70
70
  const getResponse = await axios.get("/api/packages/get", {
71
71
  params: { package_id: createdPackage.package_id },
72
- headers: {
73
- Authorization: "Bearer 1234",
74
- },
75
72
  })
76
73
 
77
74
  expect(getResponse.status).toBe(200)
@@ -82,17 +79,9 @@ test("remove star from non-existent package", async () => {
82
79
  const { axios } = await getTestServer()
83
80
 
84
81
  try {
85
- await axios.post(
86
- "/api/packages/remove_star",
87
- {
88
- package_id: "non-existent-id",
89
- },
90
- {
91
- headers: {
92
- Authorization: "Bearer 1234",
93
- },
94
- },
95
- )
82
+ await axios.post("/api/packages/remove_star", {
83
+ package_id: "non-existent-id",
84
+ })
96
85
  expect(true).toBe(false) // Should not reach here
97
86
  } catch (error: any) {
98
87
  expect(error.status).toBe(404)
@@ -104,17 +93,9 @@ test("remove star from non-existent package by name", async () => {
104
93
  const { axios } = await getTestServer()
105
94
 
106
95
  try {
107
- await axios.post(
108
- "/api/packages/remove_star",
109
- {
110
- name: "non-existent-package",
111
- },
112
- {
113
- headers: {
114
- Authorization: "Bearer 1234",
115
- },
116
- },
117
- )
96
+ await axios.post("/api/packages/remove_star", {
97
+ name: "non-existent-package",
98
+ })
118
99
  expect(true).toBe(false) // Should not reach here
119
100
  } catch (error: any) {
120
101
  expect(error.status).toBe(404)
@@ -139,17 +120,9 @@ test("remove star from unstarred package", async () => {
139
120
 
140
121
  // Try to remove star without starring first
141
122
  try {
142
- await axios.post(
143
- "/api/packages/remove_star",
144
- {
145
- package_id: createdPackage.package_id,
146
- },
147
- {
148
- headers: {
149
- Authorization: "Bearer 1234",
150
- },
151
- },
152
- )
123
+ await axios.post("/api/packages/remove_star", {
124
+ package_id: createdPackage.package_id,
125
+ })
153
126
  expect(true).toBe(false) // Should not reach here
154
127
  } catch (error: any) {
155
128
  expect(error.status).toBe(400)
@@ -5,34 +5,18 @@ test("update package", async () => {
5
5
  const { axios, db } = await getTestServer()
6
6
 
7
7
  // First create a package
8
- const packageResponse = await axios.post(
9
- "/api/packages/create",
10
- {
11
- name: "testuser/test-package",
12
- description: "Test Description",
13
- },
14
- {
15
- headers: {
16
- Authorization: "Bearer 1234",
17
- },
18
- },
19
- )
8
+ const packageResponse = await axios.post("/api/packages/create", {
9
+ name: "testuser/test-package",
10
+ description: "Test Description",
11
+ })
20
12
  const packageId = packageResponse.data.package.package_id
21
13
 
22
14
  // Update the package
23
- const response = await axios.post(
24
- "/api/packages/update",
25
- {
26
- package_id: packageId,
27
- name: "updated-package",
28
- description: "Updated Description",
29
- },
30
- {
31
- headers: {
32
- Authorization: "Bearer 1234",
33
- },
34
- },
35
- )
15
+ const response = await axios.post("/api/packages/update", {
16
+ package_id: packageId,
17
+ name: "updated-package",
18
+ description: "Updated Description",
19
+ })
36
20
 
37
21
  expect(response.status).toBe(200)
38
22
  expect(response.data.ok).toBe(true)
@@ -49,34 +33,18 @@ test("update package privacy settings", async () => {
49
33
  const { axios, db } = await getTestServer()
50
34
 
51
35
  // Create initial public package
52
- const packageResponse = await axios.post(
53
- "/api/packages/create",
54
- {
55
- name: "testuser/public-package",
56
- description: "Public Package",
57
- is_private: false,
58
- },
59
- {
60
- headers: {
61
- Authorization: "Bearer 1234",
62
- },
63
- },
64
- )
36
+ const packageResponse = await axios.post("/api/packages/create", {
37
+ name: "testuser/public-package",
38
+ description: "Public Package",
39
+ is_private: false,
40
+ })
65
41
  const packageId = packageResponse.data.package.package_id
66
42
 
67
43
  // Update to make it private
68
- const response = await axios.post(
69
- "/api/packages/update",
70
- {
71
- package_id: packageId,
72
- is_private: true,
73
- },
74
- {
75
- headers: {
76
- Authorization: "Bearer 1234",
77
- },
78
- },
79
- )
44
+ const response = await axios.post("/api/packages/update", {
45
+ package_id: packageId,
46
+ is_private: true,
47
+ })
80
48
 
81
49
  expect(response.status).toBe(200)
82
50
  expect(response.data.ok).toBe(true)
@@ -95,18 +63,10 @@ test("update non-existent package", async () => {
95
63
  const { axios } = await getTestServer()
96
64
 
97
65
  try {
98
- await axios.post(
99
- "/api/packages/update",
100
- {
101
- package_id: "non-existent-id",
102
- name: "updated-name",
103
- },
104
- {
105
- headers: {
106
- Authorization: "Bearer 1234",
107
- },
108
- },
109
- )
66
+ await axios.post("/api/packages/update", {
67
+ package_id: "non-existent-id",
68
+ name: "updated-name",
69
+ })
110
70
  throw new Error("Expected request to fail")
111
71
  } catch (error: any) {
112
72
  expect(error.status).toBe(404)
@@ -138,18 +98,10 @@ test("update package without permission", async () => {
138
98
 
139
99
  // Try to update with different user
140
100
  try {
141
- await axios.post(
142
- "/api/packages/update",
143
- {
144
- package_id: packageId,
145
- name: "stolen-package",
146
- },
147
- {
148
- headers: {
149
- Authorization: "Bearer 5678", // Different user
150
- },
151
- },
152
- )
101
+ await axios.post("/api/packages/update", {
102
+ package_id: packageId,
103
+ name: "stolen-package",
104
+ })
153
105
  throw new Error("Expected request to fail")
154
106
  } catch (error: any) {
155
107
  expect(error.status).toBe(403)
@@ -18,17 +18,9 @@ test("add star to snippet", async () => {
18
18
  const createdSnippet = createResponse.data.snippet
19
19
 
20
20
  // Star the snippet
21
- const response = await axios.post(
22
- "/api/snippets/add_star",
23
- {
24
- snippet_id: createdSnippet.snippet_id,
25
- },
26
- {
27
- headers: {
28
- Authorization: "Bearer 1234",
29
- },
30
- },
31
- )
21
+ const response = await axios.post("/api/snippets/add_star", {
22
+ snippet_id: createdSnippet.snippet_id,
23
+ })
32
24
 
33
25
  expect(response.status).toBe(200)
34
26
  expect(response.data.ok).toBe(true)
@@ -36,9 +28,6 @@ test("add star to snippet", async () => {
36
28
  // Verify star was added by checking the snippet again
37
29
  const getResponse = await axios.get("/api/snippets/get", {
38
30
  params: { snippet_id: createdSnippet.snippet_id },
39
- headers: {
40
- Authorization: "Bearer 1234",
41
- },
42
31
  })
43
32
 
44
33
  expect(getResponse.status).toBe(200)
@@ -49,17 +38,9 @@ test("add star to non-existent snippet", async () => {
49
38
  const { axios } = await getTestServer()
50
39
 
51
40
  try {
52
- await axios.post(
53
- "/api/snippets/add_star",
54
- {
55
- snippet_id: "non-existent-id",
56
- },
57
- {
58
- headers: {
59
- Authorization: "Bearer 1234",
60
- },
61
- },
62
- )
41
+ await axios.post("/api/snippets/add_star", {
42
+ snippet_id: "non-existent-id",
43
+ })
63
44
  expect(true).toBe(false) // Should not reach here
64
45
  } catch (error: any) {
65
46
  expect(error.status).toBe(404)
@@ -84,31 +65,15 @@ test("add star to already starred snippet", async () => {
84
65
  const createdSnippet = createResponse.data.snippet
85
66
 
86
67
  // Star the snippet first time
87
- await axios.post(
88
- "/api/snippets/add_star",
89
- {
90
- snippet_id: createdSnippet.snippet_id,
91
- },
92
- {
93
- headers: {
94
- Authorization: "Bearer 1234",
95
- },
96
- },
97
- )
68
+ await axios.post("/api/snippets/add_star", {
69
+ snippet_id: createdSnippet.snippet_id,
70
+ })
98
71
 
99
72
  // Try to star again
100
73
  try {
101
- await axios.post(
102
- "/api/snippets/add_star",
103
- {
104
- snippet_id: createdSnippet.snippet_id,
105
- },
106
- {
107
- headers: {
108
- Authorization: "Bearer 1234",
109
- },
110
- },
111
- )
74
+ await axios.post("/api/snippets/add_star", {
75
+ snippet_id: createdSnippet.snippet_id,
76
+ })
112
77
  expect(true).toBe(false) // Should not reach here
113
78
  } catch (error: any) {
114
79
  expect(error.status).toBe(400)
@@ -4,20 +4,12 @@ import { expect, test } from "bun:test"
4
4
  test("create snippet", async () => {
5
5
  const { axios } = await getTestServer()
6
6
 
7
- const response = await axios.post(
8
- "/api/snippets/create",
9
- {
10
- unscoped_name: "TestSnippet",
11
- code: "Test Content",
12
- snippet_type: "package",
13
- description: "Test Description",
14
- },
15
- {
16
- headers: {
17
- Authorization: "Bearer 1234",
18
- },
19
- },
20
- )
7
+ const response = await axios.post("/api/snippets/create", {
8
+ unscoped_name: "TestSnippet",
9
+ code: "Test Content",
10
+ snippet_type: "package",
11
+ description: "Test Description",
12
+ })
21
13
 
22
14
  expect(response.status).toBe(200)
23
15
  expect(response.data.snippet.unscoped_name).toBe("TestSnippet")
@@ -18,17 +18,9 @@ test("delete snippet", async () => {
18
18
  const addedSnippet: any = db.addSnippet(snippet as any)
19
19
 
20
20
  // Delete the snippet
21
- const response = await axios.post(
22
- "/api/snippets/delete",
23
- {
24
- snippet_id: addedSnippet.snippet_id,
25
- },
26
- {
27
- headers: {
28
- Authorization: "Bearer 1234",
29
- },
30
- },
31
- )
21
+ const response = await axios.post("/api/snippets/delete", {
22
+ snippet_id: addedSnippet.snippet_id,
23
+ })
32
24
 
33
25
  expect(response.status).toBe(200)
34
26
  expect(response.data.ok).toBe(true)
@@ -48,17 +40,9 @@ test("delete non-existent snippet", async () => {
48
40
  const { axios } = await getTestServer()
49
41
 
50
42
  try {
51
- await axios.post(
52
- "/api/snippets/delete",
53
- {
54
- snippet_id: "non-existent-id",
55
- },
56
- {
57
- headers: {
58
- Authorization: "Bearer 1234",
59
- },
60
- },
61
- )
43
+ await axios.post("/api/snippets/delete", {
44
+ snippet_id: "non-existent-id",
45
+ })
62
46
  // If the request doesn't throw an error, fail the test
63
47
  expect(true).toBe(false)
64
48
  } catch (error: any) {
@@ -84,17 +68,9 @@ test("delete snippet without permission", async () => {
84
68
  const addedSnippet: any = db.addSnippet(snippet as any)
85
69
 
86
70
  try {
87
- await axios.post(
88
- "/api/snippets/delete",
89
- {
90
- snippet_id: addedSnippet.snippet_id,
91
- },
92
- {
93
- headers: {
94
- Authorization: "Bearer 1234",
95
- },
96
- },
97
- )
71
+ await axios.post("/api/snippets/delete", {
72
+ snippet_id: addedSnippet.snippet_id,
73
+ })
98
74
  // If the request doesn't throw an error, fail the test
99
75
  expect(true).toBe(false)
100
76
  } catch (error: any) {
@@ -4,18 +4,9 @@ import { test, expect } from "bun:test"
4
4
  test.skip("generate snippet from JLCPCB part number", async () => {
5
5
  const { axios } = await getTestServer()
6
6
 
7
- const response = await axios.post(
8
- "/api/snippets/generate_from_jlcpcb",
9
- {
10
- jlcpcb_part_number: "C46749",
11
- },
12
- {
13
- headers: {
14
- Authorization: "Bearer 1234",
15
- },
16
- },
17
- )
18
-
7
+ const response = await axios.post("/api/snippets/generate_from_jlcpcb", {
8
+ jlcpcb_part_number: "C46749",
9
+ })
19
10
  expect(response.status).toBe(200)
20
11
  expect(response.data.snippet).toBeDefined()
21
12
  expect(response.data.snippet.unscoped_name).toBe("C46749")
@@ -104,7 +104,6 @@ test("list starred snippets", async () => {
104
104
  const snippets = [
105
105
  {
106
106
  unscoped_name: "Snippet1",
107
- owner_name: "testuser",
108
107
  code: "Content1",
109
108
  created_at: "2023-01-01T00:00:00Z",
110
109
  updated_at: "2023-01-01T00:00:00Z",
@@ -113,7 +112,6 @@ test("list starred snippets", async () => {
113
112
  },
114
113
  {
115
114
  unscoped_name: "Snippet2",
116
- owner_name: "otheruser",
117
115
  code: "Content2",
118
116
  created_at: "2023-01-02T00:00:00Z",
119
117
  updated_at: "2023-01-02T00:00:00Z",
@@ -122,7 +120,6 @@ test("list starred snippets", async () => {
122
120
  },
123
121
  {
124
122
  unscoped_name: "Snippet3",
125
- owner_name: "thirduser",
126
123
  code: "Content3",
127
124
  created_at: "2023-01-03T00:00:00Z",
128
125
  updated_at: "2023-01-03T00:00:00Z",
@@ -133,13 +130,8 @@ test("list starred snippets", async () => {
133
130
 
134
131
  const createdSnippets = []
135
132
  for (const snippet of snippets) {
136
- db.addSnippet(snippet as any)
137
- // Get the snippet from the database to get its ID
138
- const createdSnippet = db.packages.find(
139
- (p) => p.unscoped_name === snippet.unscoped_name,
140
- )
141
- if (!createdSnippet) throw new Error("Failed to create snippet")
142
- createdSnippets.push(createdSnippet)
133
+ const createdSnippet = await axios.post("/api/snippets/create", snippet)
134
+ createdSnippets.push(createdSnippet.data.snippet)
143
135
  }
144
136
 
145
137
  // Add stars for testuser
@@ -149,32 +141,15 @@ test("list starred snippets", async () => {
149
141
  if (!testUserAccount) throw new Error("testuser account not found")
150
142
 
151
143
  // testuser stars Snippet2 and Snippet3
152
- db.addStar(testUserAccount.account_id, createdSnippets[1].package_id) // Snippet2
153
- db.addStar(testUserAccount.account_id, createdSnippets[2].package_id) // Snippet3
154
-
155
- // Create a different user for the Authorization header
156
- const otherUserAccount = db.addAccount({
157
- github_username: "otheruser",
158
- shippingInfo: {
159
- firstName: "Other",
160
- lastName: "User",
161
- companyName: "Other Company",
162
- address: "456 Other St",
163
- apartment: "Apt 7C",
164
- city: "Otherville",
165
- state: "CA",
166
- zipCode: "90001",
167
- country: "United States of America",
168
- phone: "555-987-6543",
169
- },
144
+ await axios.post("/api/snippets/add_star", {
145
+ snippet_id: createdSnippets[1].snippet_id,
146
+ })
147
+ await axios.post("/api/snippets/add_star", {
148
+ snippet_id: createdSnippets[2].snippet_id,
170
149
  })
171
150
 
172
151
  // List starred snippets for testuser
173
- const response = await axios.get("/api/snippets/list?starred_by=testuser", {
174
- headers: {
175
- Authorization: `Bearer ${otherUserAccount.account_id}`,
176
- },
177
- })
152
+ const response = await axios.get("/api/snippets/list?starred_by=testuser", {})
178
153
  expect(response.status).toBe(200)
179
154
  expect(response.data.snippets).toHaveLength(2)
180
155
  expect(
@@ -189,6 +164,6 @@ test("list starred snippets", async () => {
189
164
  is_starred: boolean
190
165
  }>) {
191
166
  expect(snippet.star_count).toBe(1)
192
- expect(snippet.is_starred).toBe(false) // Should be false because we're using otherUserAccount
167
+ expect(snippet.is_starred).toBe(true)
193
168
  }
194
169
  })
@@ -18,30 +18,14 @@ test("remove star from snippet", async () => {
18
18
 
19
19
  const createdSnippet = await axios.post("/api/snippets/create", snippet)
20
20
  // Star the snippet
21
- await axios.post(
22
- "/api/snippets/add_star",
23
- {
24
- snippet_id: createdSnippet.data.snippet.snippet_id,
25
- },
26
- {
27
- headers: {
28
- Authorization: "Bearer 1234",
29
- },
30
- },
31
- )
21
+ await axios.post("/api/snippets/add_star", {
22
+ snippet_id: createdSnippet.data.snippet.snippet_id,
23
+ })
32
24
 
33
25
  // remove star from snippet
34
- const response = await axios.post(
35
- "/api/snippets/remove_star",
36
- {
37
- snippet_id: createdSnippet.data.snippet.snippet_id,
38
- },
39
- {
40
- headers: {
41
- Authorization: "Bearer 123",
42
- },
43
- },
44
- )
26
+ const response = await axios.post("/api/snippets/remove_star", {
27
+ snippet_id: createdSnippet.data.snippet.snippet_id,
28
+ })
45
29
 
46
30
  expect(response.status).toBe(200)
47
31
  expect(response.data.ok).toBe(true)
@@ -57,17 +41,9 @@ test("remove star from non-existent snippet", async () => {
57
41
  const { axios } = await getTestServer()
58
42
 
59
43
  try {
60
- await axios.post(
61
- "/api/snippets/remove_star",
62
- {
63
- snippet_id: "non-existent-id",
64
- },
65
- {
66
- headers: {
67
- Authorization: "Bearer 1234",
68
- },
69
- },
70
- )
44
+ await axios.post("/api/snippets/remove_star", {
45
+ snippet_id: "non-existent-id",
46
+ })
71
47
  expect(true).toBe(false) // Should not reach here
72
48
  } catch (error: any) {
73
49
  expect(error.status).toBe(404)
@@ -93,17 +69,9 @@ test("remove star from unstarred snippet", async () => {
93
69
 
94
70
  // Remove star
95
71
  try {
96
- await axios.post(
97
- "/api/snippets/remove_star",
98
- {
99
- snippet_id: createdSnippet.data.snippet.snippet_id,
100
- },
101
- {
102
- headers: {
103
- Authorization: "Bearer 1234",
104
- },
105
- },
106
- )
72
+ await axios.post("/api/snippets/remove_star", {
73
+ snippet_id: createdSnippet.data.snippet.snippet_id,
74
+ })
107
75
  expect(true).toBe(false) // Should not reach here
108
76
  } catch (error: any) {
109
77
  expect(error.status).toBe(400)