Update tests

This commit is contained in:
Adam Chalmers
2024-09-25 11:34:25 -05:00
parent 38c1278948
commit d5475eab81
4 changed files with 37 additions and 37 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 KiB

After

Width:  |  Height:  |  Size: 244 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 613 KiB

After

Width:  |  Height:  |  Size: 446 KiB

View File

@ -69,7 +69,7 @@ async function testingSwapSketchFnCall({
describe('testing swapping out sketch calls with xLine/xLineTo', () => { describe('testing swapping out sketch calls with xLine/xLineTo', () => {
const bigExampleArr = [ const bigExampleArr = [
`const part001 = startSketchOn('XY')`, `let part001 = startSketchOn('XY')`,
` |> startProfileAt([0, 0], %)`, ` |> startProfileAt([0, 0], %)`,
` |> lineTo([1, 1], %, $abc1)`, ` |> lineTo([1, 1], %, $abc1)`,
` |> line([-2.04, -0.7], %, $abc2)`, ` |> line([-2.04, -0.7], %, $abc2)`,
@ -258,14 +258,14 @@ describe('testing swapping out sketch calls with xLine/xLineTo', () => {
describe('testing swapping out sketch calls with xLine/xLineTo while keeping variable/identifiers intact', () => { describe('testing swapping out sketch calls with xLine/xLineTo while keeping variable/identifiers intact', () => {
// Enable rotations #152 // Enable rotations #152
const variablesExampleArr = [ const variablesExampleArr = [
`const lineX = -1`, `let lineX = -1`,
`const lineToX = -1.3`, `let lineToX = -1.3`,
`const angledLineAngle = 207`, `let angledLineAngle = 207`,
`const angledLineOfXLengthX = 0.8`, `let angledLineOfXLengthX = 0.8`,
`const angledLineOfYLengthY = 0.89`, `let angledLineOfYLengthY = 0.89`,
`const angledLineToXx = -1.86`, `let angledLineToXx = -1.86`,
`const angledLineToYy = -0.76`, `let angledLineToYy = -0.76`,
`const part001 = startSketchOn('XY')`, `let part001 = startSketchOn('XY')`,
` |> startProfileAt([0, 0], %)`, ` |> startProfileAt([0, 0], %)`,
// ` |> rx(90, %)`, // ` |> rx(90, %)`,
` |> lineTo([1, 1], %)`, ` |> lineTo([1, 1], %)`,
@ -359,7 +359,7 @@ describe('testing swapping out sketch calls with xLine/xLineTo while keeping var
describe('testing getSketchSegmentIndexFromSourceRange', () => { describe('testing getSketchSegmentIndexFromSourceRange', () => {
const code = ` const code = `
const part001 = startSketchOn('XY') let part001 = startSketchOn('XY')
|> startProfileAt([0, 0.04], %) // segment-in-start |> startProfileAt([0, 0.04], %) // segment-in-start
|> line([0, 0.4], %) |> line([0, 0.4], %)
|> xLine(3.48, %) |> xLine(3.48, %)

View File

@ -96,12 +96,12 @@ function makeSelections(
} }
describe('testing transformAstForSketchLines for equal length constraint', () => { describe('testing transformAstForSketchLines for equal length constraint', () => {
const inputScript = `const myVar = 3 const inputScript = `let myVar = 3
const myVar2 = 5 let myVar2 = 5
const myVar3 = 6 let myVar3 = 6
const myAng = 40 let myAng = 40
const myAng2 = 134 let myAng2 = 134
const part001 = startSketchOn('XY') let part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([1, 3.82], %) // ln-should-get-tag |> line([1, 3.82], %) // ln-should-get-tag
|> lineTo([myVar, 1], %) // ln-lineTo-xAbsolute should use angleToMatchLengthX helper |> lineTo([myVar, 1], %) // ln-lineTo-xAbsolute should use angleToMatchLengthX helper
@ -132,12 +132,12 @@ const part001 = startSketchOn('XY')
|> xLineTo(30, %) // ln-xLineTo-free should convert to xLine |> xLineTo(30, %) // ln-xLineTo-free should convert to xLine
|> yLineTo(20, %) // ln-yLineTo-free should convert to yLine |> yLineTo(20, %) // ln-yLineTo-free should convert to yLine
` `
const expectModifiedScript = `const myVar = 3 const expectModifiedScript = `let myVar = 3
const myVar2 = 5 let myVar2 = 5
const myVar3 = 6 let myVar3 = 6
const myAng = 40 let myAng = 40
const myAng2 = 134 let myAng2 = 134
const part001 = startSketchOn('XY') let part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([1, 3.82], %, $seg01) // ln-should-get-tag |> line([1, 3.82], %, $seg01) // ln-should-get-tag
|> angledLineToX([ |> angledLineToX([
@ -241,10 +241,10 @@ const part001 = startSketchOn('XY')
}) })
describe('testing transformAstForSketchLines for vertical and horizontal constraint', () => { describe('testing transformAstForSketchLines for vertical and horizontal constraint', () => {
const inputScript = `const myVar = 2 const inputScript = `let myVar = 2
const myVar2 = 12 let myVar2 = 12
const myVar3 = -10 let myVar3 = -10
const part001 = startSketchOn('XY') let part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> lineTo([1, 1], %) |> lineTo([1, 1], %)
|> line([-6.28, 1.4], %) // select for horizontal constraint 1 |> line([-6.28, 1.4], %) // select for horizontal constraint 1
@ -269,10 +269,10 @@ const part001 = startSketchOn('XY')
|> angledLineToY([301, myVar], %) // select for vertical constraint 10 |> angledLineToY([301, myVar], %) // select for vertical constraint 10
` `
it('should transform horizontal lines the ast', async () => { it('should transform horizontal lines the ast', async () => {
const expectModifiedScript = `const myVar = 2 const expectModifiedScript = `let myVar = 2
const myVar2 = 12 let myVar2 = 12
const myVar3 = -10 let myVar3 = -10
const part001 = startSketchOn('XY') let part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> lineTo([1, 1], %) |> lineTo([1, 1], %)
|> xLine(-6.28, %) // select for horizontal constraint 1 |> xLine(-6.28, %) // select for horizontal constraint 1
@ -331,10 +331,10 @@ const part001 = startSketchOn('XY')
expect(newCode).toBe(expectModifiedScript) expect(newCode).toBe(expectModifiedScript)
}) })
it('should transform vertical lines the ast', async () => { it('should transform vertical lines the ast', async () => {
const expectModifiedScript = `const myVar = 2 const expectModifiedScript = `let myVar = 2
const myVar2 = 12 let myVar2 = 12
const myVar3 = -10 let myVar3 = -10
const part001 = startSketchOn('XY') let part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> lineTo([1, 1], %) |> lineTo([1, 1], %)
|> line([-6.28, 1.4], %) // select for horizontal constraint 1 |> line([-6.28, 1.4], %) // select for horizontal constraint 1
@ -396,8 +396,8 @@ const part001 = startSketchOn('XY')
describe('testing transformAstForSketchLines for vertical and horizontal distance constraints', () => { describe('testing transformAstForSketchLines for vertical and horizontal distance constraints', () => {
describe('testing setHorzDistance for line', () => { describe('testing setHorzDistance for line', () => {
const inputScript = `const myVar = 1 const inputScript = `let myVar = 1
const part001 = startSketchOn('XY') let part001 = startSketchOn('XY')
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> line([0.31, 1.67], %) // base selection |> line([0.31, 1.67], %) // base selection
|> line([0.45, 1.46], %) |> line([0.45, 1.46], %)
@ -505,7 +505,7 @@ const baseThickHalf = baseThick / 2
const halfHeight = totalHeight / 2 const halfHeight = totalHeight / 2
const halfArmAngle = armAngle / 2 const halfArmAngle = armAngle / 2
const part001 = startSketchOn('XY') let part001 = startSketchOn('XY')
|> startProfileAt([-0.01, -0.05], %) |> startProfileAt([-0.01, -0.05], %)
|> line([0.01, 0.94 + 0], %) // partial |> line([0.01, 0.94 + 0], %) // partial
|> xLine(3.03, %) // partial |> xLine(3.03, %) // partial