effect-app / libs

The core libraries to build apps with Effect
44 stars 6 forks source link

Enhance paths check #45

Closed jfet97 closed 1 year ago

jfet97 commented 1 year ago

Not sure how to test logWarning

patroza commented 1 year ago

Not sure how to test logWarning

You would need to set a fake logger via eff.provideSomeLayer(Logger.replace(Logger.defaultLogger, customLogger)) that stores it’s results in an array, then you can evaluate after if you find the message in the array.

jfet97 commented 1 year ago

For future me: do ask Patrick how to properly write it using effects instead of trickeffects

patroza commented 1 year ago

For future me: do ask Patrick how to properly write it using effects instead of trickeffects

@jfet97 here you go :) https://github.com/effect-ts-app/libs/commit/ddaeee3a69f24471bca058b711b85be055b0363d effects need to run :) usually you run them to an exit or either value, and then compare that. exit would be preferred, but there's some trouble with exits as they also include tracing, which makes them hard to compare, since we only care about E and A anyway, I just went for running to Either.

now I was contemplating just like with validation it may be nice to get all the issues combined, instead of bailing at the first sign of trouble. but then again, it isn't really practically required, this thing is just supposed to inform the user of a dumb mistake, which is better than being unaware, and actually sufficient :)

patroza commented 1 year ago

@jfet97 missing changeset, then ready to go from my side

jfet97 commented 1 year ago

@patroza let's see how many false positive we get this time