Make tag last optional param everywhere (#1739)

* Make tag last optional param

* Update all test assertions with correct tag format

* Format ts

* Some progress on tests and code mods

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* More sketch fixes

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* Only 1 test left

* Clean up console.log

* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)

* Fix last ts test

* Clean up fmt

* Fix clippy too

* Update docs and fix small oversight on angled lines

* Fix more rust tests

* Make typescript happy

* Fmt

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
This commit is contained in:
Adam Sunderland
2024-03-15 17:03:42 -04:00
committed by GitHub
parent 4987965731
commit 816870253e
60 changed files with 934 additions and 1539 deletions

View File

@ -152,25 +152,25 @@ describe('Testing giveSketchFnCallTag', () => {
code,
'line([0, 0.83], %)'
)
expect(newCode).toContain("line({ to: [0, 0.83], tag: 'seg01' }, %)")
expect(newCode).toContain("line([0, 0.83], %, 'seg01')")
expect(tag).toBe('seg01')
expect(isTagExisting).toBe(false)
})
it('Should create a unique tag if seg01 already exists', () => {
let _code = code.replace(
'line([-2.57, -0.13], %)',
"line({ to: [-2.57, -0.13], tag: 'seg01' }, %)"
"line([-2.57, -0.13], %, 'seg01')"
)
const { newCode, tag, isTagExisting } = giveSketchFnCallTagTestHelper(
_code,
'line([0, 0.83], %)'
)
expect(newCode).toContain("line({ to: [0, 0.83], tag: 'seg02' }, %)")
expect(newCode).toContain("line([0, 0.83], %, 'seg02')")
expect(tag).toBe('seg02')
expect(isTagExisting).toBe(false)
})
it('Should return existing tag if it already exists', () => {
const lineButWithTag = "line({ to: [-2.57, -0.13], tag: 'butts' }, %)"
const lineButWithTag = "line([-2.57, -0.13], %, 'butts')"
let _code = code.replace('line([-2.57, -0.13], %)', lineButWithTag)
const { newCode, tag, isTagExisting } = giveSketchFnCallTagTestHelper(
_code,