24
submitted 3 months ago* (last edited 3 months ago) by Aijan@programming.dev to c/programming@programming.dev
top 7 comments
sorted by: hot top new old
[-] einkorn@feddit.org 7 points 3 months ago

I wrote my own litany before opening the article ...I must not mock.
Mocks are the mind-killer.
Mocks are the little-death that brings total system failure.
I will fully implement my tests.
I will permit the tests to pass over me and through me.
And when the tests have passed, I will turn the inner eye to see their path.
Where the mocks have gone there will be nothing. Only green will remain.

[-] jbrains@sh.itjust.works 2 points 3 months ago

Program to abstractions with clear contracts. Advice since the 1950s.

Why do you folks continue to resist?

[-] TehPers@beehaw.org 1 points 3 months ago

How does this library handle control flow? For example, how can I fetch results from the DB, then for each result, execute one of several different pipelines depending on properties of that entity?

[-] Aijan@programming.dev 2 points 3 months ago

You can handle complex branching using standard JavaScript. Since every pipeline is just a function returning data, you can use if/else or map to return different sub-pipelines and commands from within your logic functions. Here's an example:

const processUsersFlow = () => 
  effectPipe(
    fetchAllUsers,
    (users) => {
      const tasks = users.map(user => {
        if (user.isAdmin) return syncAdminPermissions(user); // Sub-pipeline
        if (user.isGuest) return cleanupGuestAccount(user);  // Sub-pipeline
        return notifyUser(user); // Simple Command
      });

      return Parallel(tasks); 
    }
  )();
this post was submitted on 28 May 2026
24 points (100.0% liked)

Programming

28322 readers
775 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 3 years ago
MODERATORS