@tscircuit/fake-snippets 0.0.93 → 0.0.94
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.
- package/bun-tests/fake-snippets-api/routes/datasheets/get.test.ts +25 -0
- package/dist/bundle.js +16 -4
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -0
- package/fake-snippets-api/lib/db/db-client.ts +4 -0
- package/fake-snippets-api/routes/api/datasheets/get.ts +15 -5
- package/package.json +1 -1
- package/src/App.tsx +2 -0
- package/src/hooks/use-create-datasheet.ts +30 -0
- package/src/hooks/use-datasheet.ts +18 -0
- package/src/pages/datasheet.tsx +87 -0
|
@@ -15,3 +15,28 @@ test("get datasheet", async () => {
|
|
|
15
15
|
expect(res.status).toBe(200)
|
|
16
16
|
expect(res.data.datasheet.datasheet_id).toBe(id)
|
|
17
17
|
})
|
|
18
|
+
|
|
19
|
+
test("get datasheet by chip name", async () => {
|
|
20
|
+
const { axios } = await getTestServer()
|
|
21
|
+
const create = await axios.post("/api/datasheets/create", {
|
|
22
|
+
chip_name: "Chip1",
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const res = await axios.get("/api/datasheets/get", {
|
|
26
|
+
params: { chip_name: "Chip1" },
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
expect(res.status).toBe(200)
|
|
30
|
+
expect(res.data.datasheet.datasheet_id).toBe(
|
|
31
|
+
create.data.datasheet.datasheet_id,
|
|
32
|
+
)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
test("get datasheet by chip name 404", async () => {
|
|
36
|
+
const { axios } = await getTestServer()
|
|
37
|
+
const res = await axios.get("/api/datasheets/get", {
|
|
38
|
+
params: { chip_name: "Missing" },
|
|
39
|
+
validateStatus: () => true,
|
|
40
|
+
})
|
|
41
|
+
expect(res.status).toBe(404)
|
|
42
|
+
})
|