bbc/psammead

View on GitHub
scripts/utilities/promptPackageMultiSelect/index.test.js

Summary

Maintainability
A
0 mins
Test Coverage
const { prompt } = require('enquirer');
const promptPackageMultiSelect = require('.');

jest.mock('enquirer', () => ({
  prompt: jest.fn(),
}));

describe('getPackages', () => {
  promptPackageMultiSelect();
  const [[{ message, type }]] = prompt.mock.calls;

  it('should call prompt api with the correct message', () => {
    expect(message).toEqual('Select package(s) with space bar then hit enter');
  });

  it('should request the "multiselect" prompt type', () => {
    expect(type).toEqual('multiselect');
  });
});