Assert a module is, or is not, installed, by its machine name, as the Extend page (/admin/modules) reports it: the module's checkbox is ticked. A module absent from the codebase is "not installed" as well.
Examples
Then the "node" module should be installed
And the "layout_builder" module should be installed
Then the "book" module should not be installed
And the "statistics" module should not be enabled
Then the "media_library" module should be enabled
Pattern
Then(/^the "([^"]*)" module should( not)* be (?:installed|enabled)$/, …)
Part of @webship-js/drupal-core-steps (github.com/webship/drupal-core-steps), a step pack for Webship-js 2.0.x.