refactor: constants, DRY

use constants instead of magic numbers on the emitter,
extract emitter for boolean validation, and DRYing tests