Skip to content

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

Description

@lvcabral
          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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions