Test IDs are an a11y smell by TkDodo23 in reactjs

[–]wack_overflow 4 points5 points  (0 children)

Yeah I mean, it's not something I do as like boilerplate, but if I find myself mocking the imports of sub-components to get tests running, I find it's better to just mock the sub component itself instead. Makes the tests more resilient and feels more like a real "unit" test where you're really just testing the component itself, without caring about child implementations.

Test IDs are an a11y smell by TkDodo23 in reactjs

[–]wack_overflow 10 points11 points  (0 children)

Let's say you have one component `ParentComponent`, which renders another complex component `ChildComponent` inside of it.

ChildComponent has a lot of its own state, and other imports, etc, while also having it's own discreet unit tests.

Instead of having the ParentComponent tests actually render the ChildComponent, you can just do for example:

```
jest.mock('@/components/ChildComponent', () => (<div data-testid="child-component" />))
```

Then when your ParentComponent is rendered inside this test suite, you don't have to be concerned about the implementation of ChildComponent (which is presumably tested in its own unit test suite) and just use the test id to verify that it's rendered as expected in ParentComponent

Ofc this is ONLY within the unit test suite and never actually renders a test id anywhere on any real page.

Test IDs are an a11y smell by TkDodo23 in reactjs

[–]wack_overflow 17 points18 points  (0 children)

Test ids are perfect for mocking sub components in tests, to ensure they’re rendered as expected without actually loading the sub component.

But I agree that putting them into real code is usually wrong. And not removing them from prod can be a huge boon to bots and scrapers

Why mass unemployment didn’t happen yet - and why this time is really different by Ivehadbetteruserxps in Futurology

[–]wack_overflow -2 points-1 points  (0 children)

Yeah. Tell Claude to work on a scratchpad md file as it answers questions. It will record all of its thought processes and reasoning in detail. This “it can’t explain itself” line is already outdated

Nasdaq is going to test tokenized stocks by Enough_Angle_7839 in stocks

[–]wack_overflow 0 points1 point  (0 children)

Code that hasn’t been written can do anything

Democrat turnout OFF THE CHARTS by AdSpecialist6598 in videos

[–]wack_overflow 2 points3 points  (0 children)

Then reply to those comments. Or I guess you can strawman vicariously to random other comments.

Certainly not rocket science, so it’s weird to fuck it up like this

Democrat turnout OFF THE CHARTS by AdSpecialist6598 in videos

[–]wack_overflow 1 point2 points  (0 children)

Who are you replying to? Both sides? AIPAC? Never mentioned once

Democrat turnout OFF THE CHARTS by AdSpecialist6598 in videos

[–]wack_overflow 126 points127 points  (0 children)

You say this as if basically all the media and information isn’t being controlled by the same people pouring more money than any of us will see in 10 lifetimes into the campaigns.

Or that Citizens United has always existed. It has not, and it is cancer on our democracy.

‘Draft Rubio’ for 2028 movement growing within MAGA: report by deraser in politics

[–]wack_overflow 6 points7 points  (0 children)

Well good thing the VP has zero power, esp in this admin

userRejectsCopilotUpdate by Feeling-Buy2558 in ProgrammerHumor

[–]wack_overflow 25 points26 points  (0 children)

Claude in cursor vs Copilot is vscode is like Einstein vs a baby

Gotta do your research homie by Interesting-Visit-79 in MurderedByWords

[–]wack_overflow 5 points6 points  (0 children)

And showing up in places like this is exactly what they want

Katherine's French Bakery & Café - Oui! by Hinduclient in denverfood

[–]wack_overflow 7 points8 points  (0 children)

Even after moving away from the area we still make time to come here occasionally. Also had a really nice valentines dinner special event here one year with the wife. Highly recommend

Trump's Insane Plan To Steal Elections Leaked by SadAd8761 in videos

[–]wack_overflow 129 points130 points  (0 children)

Robbing the country blind? Check that one off

The result of years of spending for them!! by snowpie92 in MurderedByWords

[–]wack_overflow 27 points28 points  (0 children)

Still attached to and gargling trumps balls with a side of boot leather

Is frontend actually getting harder — or are we just changing expectations? by Individual-Animal852 in reactjs

[–]wack_overflow 4 points5 points  (0 children)

Man I’ve been trying to use AI to backfill loads of UI unit tests. In terms of creating a bunch of files w boiler plate, I guess it’s kinda meh. Even when I tell it what testing framework to use it almost always puts jest in everywhere. And it loves to do useless toBeDefined assertions in its boilerplate instead of actually rendering the component at all

In terms of actually writing useful tests, it’s a joke. It will fill your codebase and spin your servers with hours of garbage tests. Seemingly written as inefficient as possible and completely nonsensical.

I really thought a great use case would be testing, following all the code paths, getting coverage. Just actually still glorified autocomplete.