Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Nov 18, 2024
1 parent f35368d commit e3a8601
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const stringifyDsnSession = (session: DsnSession): string => {
// Routes section
result += `${indent}(routes \n`
result += `${indent}${indent}(resolution ${session.routes.resolution.unit} ${session.routes.resolution.value})\n`

// Parser subsection
result += `${indent}${indent}(parser\n`
result += `${indent}${indent}${indent}(host_cad ${JSON.stringify(session.routes.parser.host_cad)})\n`
Expand Down
12 changes: 8 additions & 4 deletions tests/dsn-pcb/stringify-dsn-session.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ test("stringify session file", () => {
const sessionJson = parseDsnToDsnJson(sessionFile) as DsnSession
const stringified = stringifyDsnSession(sessionJson)
const reparsed = parseDsnToDsnJson(stringified) as DsnSession

// Test that we can parse the generated string back to the same structure
expect(reparsed.filename).toBe(sessionJson.filename)
expect(reparsed.placement.components).toHaveLength(sessionJson.placement.components.length)
expect(reparsed.routes.network_out.nets).toHaveLength(sessionJson.routes.network_out.nets.length)

expect(reparsed.placement.components).toHaveLength(
sessionJson.placement.components.length,
)
expect(reparsed.routes.network_out.nets).toHaveLength(
sessionJson.routes.network_out.nets.length,
)

// Test specific values
const originalNet = sessionJson.routes.network_out.nets[0]
const reparsedNet = reparsed.routes.network_out.nets[0]
Expand Down

0 comments on commit e3a8601

Please sign in to comment.