amitaibu / ihp-cms-starter

5 stars 2 forks source link

Try to generalize testing of different types #26

Open amitaibu opened 1 year ago

amitaibu commented 1 year ago

@mpscholten This is something I keep needing on tests, so I think could be a nice addition to the guide. But I'd need some help here :)

mpscholten commented 1 year ago

Not sure this can be done in a way that generalizes well because a New...Action can always have different parameters (in your case Id LandingPage). I'd wait for a bit more code and then extract it into the framework once it's more clear what can be generalized here 👍

amitaibu commented 1 year ago

@mpscholten In my use case I have several New..Action the take the same param. I think it's quite typical that there's some central record ID (e.g. groupId) that others are referencing.

With that said, my issue is also in a case I remove the New..Action -- https://github.com/amitaibu/ihp-landing-page/pull/26#discussion_r1293971589

So my idea for the doc isn't to move code to IHP core, but to explain how to generalize functions that work with multiple records/ actions -- that share the same constraints.

amitaibu commented 1 year ago

I've simplified the test to only deal with Create..Action. I can't figure out what the compiler means by No instance for (Typeable landingPageId0)

image
mpscholten commented 1 year ago

So my idea for the doc isn't to move code to IHP core, but to explain how to generalize functions that work with multiple records/ actions -- that share the same constraints.

Makes sense, got it 👍

I've simplified the test to only deal with Create..Action. I can't figure out what the compiler means by No instance for (Typeable landingPageId0)

I've tried this for a couple of minutes, but could not figure out what is wrong specifically. It's very tricky