Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use a package like undent to allow tests with lists to read a little nicer #59

Open
lvcabral opened this issue Apr 3, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@lvcabral
Copy link
Collaborator

lvcabral commented Apr 3, 2024

          Might I suggest using a package like `undent` to allow these tests to read a little nicer? We do this a lot in brighterscript-formatter. (see [here](https://github.com/rokucommunity/brighterscript-formatter/blob/b634f670920cd7a7d78e8cede8a4f0e62e7871b4/src/Formatter.spec.ts#L18-L41)). 

So your test would look something like this:

it("lists values", () => {
    let arr = new RoByteArray(new Uint8Array([1, 2, 3, 4, 5]));
    expect(arr.toString()).toEqual(undent`
        <Component: roByteArray> =
        [
        1
        2
        3
        4
        5
        ]
    `);
});

I feel like it improves the readability of the tests. Maybe that could be a separate PR though to hit all the spots that do tests like this? Anyway, just a thought.

Originally posted by @TwitchBronBron in #53 (comment)

@lvcabral lvcabral changed the title Might I suggest using a package like undent to allow these tests to read a little nicer? We do this a lot in brighterscript-formatter. (see [here](https://github.com/rokucommunity/brighterscript-formatter/blob/b634f670920cd7a7d78e8cede8a4f0e62e7871b4/src/Formatter.spec.ts#L18-L41)). Use a package like undent to allow tests with lists to read a little nicer Apr 3, 2024
@lvcabral lvcabral added the enhancement New feature or request label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant