Closed sweep-ai[bot] closed 9 months ago
write a .spec file close to src/app/components/patch-parts/patch-minimal/patch-minimal.component.ts to test generatePatchText()
function.
mock the database and avoid the calling get during the test,just keep the test as simple as possible
write a .spec file close to src/app/components/patch-parts/patch-minimal/patch-minimal.component.ts to test
generatePatchText()
function. mock the database and avoid the calling get during the test,just keep the test as simple as possible
Hi @Polyterative,
I decided to make the following changes:
File Path | Proposed Changes |
---|---|
src/app/components/patch-parts/patch-minimal/patch-minimal.component.spec.ts |
Create src/app/components/patch-parts/patch-minimal/patch-minimal.component.spec.ts with contents: β’ Import the necessary testing modules from Angular's testing library, such as TestBed and async .β’ Import the PatchMinimalComponent from the patch-minimal.component.ts file.β’ Set up the describe block for the PatchMinimalComponent and initialize the component and a testing module in a beforeEach block.β’ Create a mock patch object with a name and connections properties. The connections property should be an array of objects, each representing a connection with source and target properties. β’ Write a test case for the generatePatchText() function. In this test case, assign the mock patch object to the component's data property and call the generatePatchText() function. Check if the returned string matches the expected string representation of the mock patch. |
PR Feedback (click)
Description
This PR implements the copy as text feature in the
patch-minimal
component. The current tooltip in the component displays a placeholder text, and this PR enhances the feature to generate a descriptive textual representation of the Eurorack patch when the user clicks on the button. The generated text can then be shared on various websites.Summary of Changes
generatePatchText()
inpatch-minimal.component.ts
that generates a detailed textual description of the Eurorack patch.matTooltip
attribute in the button element inpatch-minimal.component.html
to call thegeneratePatchText()
function.Please review and merge these changes.
Fixes #89.
π Latest improvements to Sweep:
π‘ To get Sweep to edit this pull request, you can: