Skip to content

Conversation

@AishwaryaAgr
Copy link

As per issue #2566,
This commit replaces the use of string continuations with template literals to enhance code readability and maintainability. Template literals provide a cleaner way to handle multi-line strings, making the code easier to understand and reducing the risk of syntax errors caused by misplaced backslashes.

Attached is the makeOverlayPath.test.js file with test cases for the changes in the commit

`import { makeOverlayPath } from '../utils/overlay-path.ts';
describe('makeOverlayPath', () => {
it('should return the correct path string', () => {
const w = 10;
const h = 20;
const x = 5;
const y = 5;
const topLeft = 2;
const bottomLeft = 3;
const bottomRight = 4;
const topRight = 1;
const width = 50;
const height = 100;

const expectedPath = `M10,20

H0
V0
H10
V20
Z
M7,5
a2,2,0,0,0-2,2
V102
a3,3,0,0,0,3,3
H51
a4,4,0,0,0,4-4
V6
a1,1,0,0,0-1-1
Z`;

expect(makeOverlayPath(w, h, x, y, topLeft, bottomLeft, bottomRight, topRight, width, height)).toBe(expectedPath);

});

it('should handle edge cases with zero values', () => {
const w = 0;
const h = 0;
const x = 0;
const y = 0;
const topLeft = 0;
const bottomLeft = 0;
const bottomRight = 0;
const topRight = 0;
const width = 0;
const height = 0;

const expectedPath = `M0,0

H0
V0
H0
V0
Z
M0,0
a0,0,0,0,0-0,0
V0
a0,0,0,0,0,0,0
H0
a0,0,0,0,0,0-0
V0
a0,0,0,0,0-0-0
Z`;

expect(makeOverlayPath(w, h, x, y, topLeft, bottomLeft, bottomRight, topRight, width, height)).toBe(expectedPath);

});
});
`

@vercel
Copy link

vercel bot commented Oct 2, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
shepherd-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 8, 2024 5:40pm
shepherd-landing ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 8, 2024 5:40pm

@vercel
Copy link

vercel bot commented Oct 2, 2024

Someone is attempting to deploy a commit to the shipshapecode Team on Vercel.

A member of the Team first needs to authorize it.

@AishwaryaAgr
Copy link
Author

Screenshot 2024-10-02 at 10 40 36 AM

@chuckcarpenter
Copy link
Member

@AishwaryaAgr we just need passing tests here and then can merge

@RobbieTheWagner
Copy link
Member

@AishwaryaAgr could you please take a look at the failing tests and rebase?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants