We had a similar situation in a course I recently completed: two out of four of us literally did all the work for a substantial project. My perspective is: don't get hung up on credit, the credit is a tiny portion of the value of doing these things. By engaging you pick up more knowledge and experience, and you will get the benefits of that all the way down your career.

And if the injustice still really bothers you (and honestly it's hard to avoid feeling that way) bear in mind that this is a small portion of the credit required for your course. The knowledge you gained by actually engaging with this assignment will benefit you in other assessed parts of the course where you will work alone. If they get the credit now, they'll almost certainly lose it later.

The ideal thing to do is to be open about your feelings about work sharing with the group, as early as possible. Some social groups make this easier than others though. And in some cases (as in mine) you can have that conversation (and you can have it as strongly as is possible without falling out with them), and still end up doing all the work. Different people want different things out of a course and are willing to put in different levels of effort. Sometimes social pressure overrides that, sometimes it doesn't. That's all you can take away from this really. And you need to honestly judge your ability to have that discussion with them without souring things before you try to have it.

But you will have to work with these people again, and see them again, and you may be in a situation in the future where you could interview for a job at a company where one of them works. Better they remember you as the hard working person than the person who made them feel bad, or "ratted them out" (as they will see it).

So in short - be tactful, there's nothing to be won by doing anything else, and if you need to feel there's some justice in the situation remember that they lose out by not really engaging. That isn't a platitude: 2 years into your career university module credit counts for nothing, knowledge and the ability to work carries you. These people are not accumulating knowledge or learning to work.