2025-01-10 12:57:16 -05:00
|
|
|
import { createCreateFileUrl } from './links'
|
|
|
|
|
|
|
|
describe(`link creation tests`, () => {
|
|
|
|
test(`createCreateFileUrl happy path`, async () => {
|
|
|
|
const code = `extrusionDistance = 12`
|
|
|
|
const name = `test`
|
|
|
|
const units = `mm`
|
|
|
|
|
|
|
|
// Converted with external online tools
|
|
|
|
const expectedEncodedCode = `ZXh0cnVzaW9uRGlzdGFuY2UgPSAxMg%3D%3D`
|
2025-01-13 10:42:08 -05:00
|
|
|
const expectedLink = `http://localhost:3000/?create-file=true&name=test&units=mm&code=${expectedEncodedCode}&ask-open-desktop=true`
|
2025-01-10 12:57:16 -05:00
|
|
|
|
|
|
|
const result = createCreateFileUrl({ code, name, units })
|
|
|
|
expect(result.toString()).toBe(expectedLink)
|
|
|
|
})
|
|
|
|
})
|