@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.
- package/bun-tests/fake-snippets-api/routes/datasheets/create.test.ts +15 -0
- package/bun-tests/fake-snippets-api/routes/datasheets/get.test.ts +17 -0
- package/bun-tests/fake-snippets-api/routes/datasheets/process_all_datasheets.test.ts +21 -0
- package/bun-tests/fake-snippets-api/routes/datasheets/run_async_tasks.test.ts +18 -0
- package/dist/bundle.js +558 -421
- package/dist/index.d.ts +81 -2
- package/dist/index.js +46 -1
- package/dist/schema.d.ts +130 -1
- package/dist/schema.js +17 -1
- package/fake-snippets-api/lib/db/db-client.ts +36 -0
- package/fake-snippets-api/lib/db/schema.ts +17 -0
- package/fake-snippets-api/routes/api/_fake/datasheets/process_all_datasheets.ts +37 -0
- package/fake-snippets-api/routes/api/_fake/run_async_tasks.ts +12 -0
- package/fake-snippets-api/routes/api/datasheets/create.ts +18 -0
- package/fake-snippets-api/routes/api/datasheets/get.ts +25 -0
- package/package.json +1 -1
|
@@ -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
|
+
})
|