@tscircuit/fake-snippets 0.0.84 → 0.0.85

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.
@@ -0,0 +1,15 @@
1
+ import { getTestServer } from "bun-tests/fake-snippets-api/fixtures/get-test-server"
2
+ import { test, expect } from "bun:test"
3
+
4
+ test("create datasheet", async () => {
5
+ const { axios } = await getTestServer()
6
+
7
+ const res = await axios.post("/api/datasheets/create", {
8
+ chip_name: "TestChip",
9
+ })
10
+
11
+ expect(res.status).toBe(200)
12
+ expect(res.data.datasheet.chip_name).toBe("TestChip")
13
+ expect(res.data.datasheet.pin_information).toBeNull()
14
+ expect(res.data.datasheet.datasheet_pdf_urls).toBeNull()
15
+ })
@@ -0,0 +1,17 @@
1
+ import { getTestServer } from "bun-tests/fake-snippets-api/fixtures/get-test-server"
2
+ import { test, expect } from "bun:test"
3
+
4
+ test("get datasheet", async () => {
5
+ const { axios } = await getTestServer()
6
+ const create = await axios.post("/api/datasheets/create", {
7
+ chip_name: "Chip",
8
+ })
9
+ const id = create.data.datasheet.datasheet_id
10
+
11
+ const res = await axios.get("/api/datasheets/get", {
12
+ params: { datasheet_id: id },
13
+ })
14
+
15
+ expect(res.status).toBe(200)
16
+ expect(res.data.datasheet.datasheet_id).toBe(id)
17
+ })
@@ -0,0 +1,21 @@
1
+ import { getTestServer } from "bun-tests/fake-snippets-api/fixtures/get-test-server"
2
+ import { test, expect } from "bun:test"
3
+
4
+ test("process datasheets", async () => {
5
+ const { axios } = await getTestServer()
6
+ const create = await axios.post("/api/datasheets/create", {
7
+ chip_name: "Chip",
8
+ })
9
+ const id = create.data.datasheet.datasheet_id
10
+
11
+ const processRes = await axios.post(
12
+ "/api/_fake/datasheets/process_all_datasheets",
13
+ )
14
+ expect(processRes.status).toBe(200)
15
+
16
+ const res = await axios.get("/api/datasheets/get", {
17
+ params: { datasheet_id: id },
18
+ })
19
+ expect(res.data.datasheet.pin_information).not.toBeNull()
20
+ expect(res.data.datasheet.datasheet_pdf_urls).not.toBeNull()
21
+ })
@@ -0,0 +1,18 @@
1
+ import { getTestServer } from "bun-tests/fake-snippets-api/fixtures/get-test-server"
2
+ import { test, expect } from "bun:test"
3
+
4
+ test("run async tasks processes datasheets", async () => {
5
+ const { axios } = await getTestServer()
6
+ const create = await axios.post("/api/datasheets/create", {
7
+ chip_name: "Chip",
8
+ })
9
+ const id = create.data.datasheet.datasheet_id
10
+
11
+ const runRes = await axios.get("/api/_fake/run_async_tasks")
12
+ expect(runRes.status).toBe(200)
13
+
14
+ const res = await axios.get("/api/datasheets/get", {
15
+ params: { datasheet_id: id },
16
+ })
17
+ expect(res.data.datasheet.pin_information).not.toBeNull()
18
+ })