Skip to content

Commit

Permalink
Test: Unify integration tests styles with other tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SBoudrias committed Jul 7, 2024
1 parent dc4c1ef commit f7e6186
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 31 deletions.
20 changes: 11 additions & 9 deletions integration/cjs/integration.test.cjs
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
/* eslint-disable n/no-unsupported-features/node-builtins */
const test = require('node:test');
const { describe, it } = require('node:test');
const assert = require('node:assert');
const { input } = require('@inquirer/prompts');
const { createPrompt } = require('@inquirer/core');
const defaultInput = require('@inquirer/input').default;

test('[CJS] @inquirer/prompts should be exported', () => {
assert(input instanceof Function);
});
describe('CommonJS Integration', () => {
it('@inquirer/prompts should be exported', () => {
assert(input instanceof Function);
});

test('[CJS] @inquirer/input should be exported', () => {
assert(defaultInput instanceof Function);
});
it('@inquirer/input should be exported', () => {
assert(defaultInput instanceof Function);
});

test('[CJS] @inquirer/core should export createPrompt', () => {
assert(createPrompt instanceof Function);
it('@inquirer/core should export createPrompt', () => {
assert(createPrompt instanceof Function);
});
});
46 changes: 24 additions & 22 deletions integration/esm/integration.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { input } from '@inquirer/prompts';
import defaultInput from '@inquirer/input';
import { createPrompt } from '@inquirer/core';
import inquirer, { createPromptModule } from 'inquirer';
import test from 'node:test';
import { describe, it } from 'node:test';
import assert from 'node:assert';

import Base from 'inquirer/lib/prompts/base.js';
Expand All @@ -13,29 +13,31 @@ import observe from 'inquirer/lib/utils/events.js';
import * as utils from 'inquirer/lib/utils/readline.js';
import Paginator from 'inquirer/lib/utils/paginator.js';

test('[ESM] @inquirer/prompts should be exported', () => {
assert(input instanceof Function);
});
describe('ESM Integration', () => {
it('@inquirer/prompts should be exported', () => {
assert(input instanceof Function);
});

test('[ESM] @inquirer/input should be exported', () => {
assert(defaultInput instanceof Function);
});
it('@inquirer/input should be exported', () => {
assert(defaultInput instanceof Function);
});

test('[ESM] @inquirer/core should export createPrompt', () => {
assert(createPrompt instanceof Function);
});
it('@inquirer/core should export createPrompt', () => {
assert(createPrompt instanceof Function);
});

test('[ESM] inquirer should be exported', () => {
assert(inquirer.prompt instanceof Function);
assert(inquirer.createPromptModule instanceof Function);
assert(createPromptModule instanceof Function);
});
it('inquirer should be exported', () => {
assert(inquirer.prompt instanceof Function);
assert(inquirer.createPromptModule instanceof Function);
assert(createPromptModule instanceof Function);
});

test('[ESM] inquirer custom prompts util paths are stable', () => {
assert(Base != null);
assert(Choices != null);
assert(Separator != null);
assert(observe != null);
assert(utils != null);
assert(Paginator != null);
it('inquirer custom prompts util paths are stable', () => {
assert(Base != null);
assert(Choices != null);
assert(Separator != null);
assert(observe != null);
assert(utils != null);
assert(Paginator != null);
});
});

0 comments on commit f7e6186

Please sign in to comment.