Introduce and re-use `assert_badge`

There is some duplication asserting correct badge generation so I introduced `assert_badge` to DRY things up.

@rrrene WDYT?