|
| 1 | +// esm-to-plain-js |
| 2 | +// Package Specification Suite |
| 3 | + |
| 4 | +// Imports |
| 5 | +import { assertDeepStrictEqual } from 'assert-deep-strict-equal'; |
| 6 | +import fs from 'fs'; |
| 7 | + |
| 8 | +// Setup |
| 9 | +import { esmToPlainJs } from '../dist/esm-to-plain-js.js'; |
| 10 | + |
| 11 | +//////////////////////////////////////////////////////////////////////////////// |
| 12 | +describe('The "dist" folder', () => { |
| 13 | + |
| 14 | + it('contains the correct files', () => { |
| 15 | + const actual = fs.readdirSync('dist').sort(); |
| 16 | + const expected = [ |
| 17 | + 'esm-to-plain-js.d.ts', |
| 18 | + 'esm-to-plain-js.js', |
| 19 | + ]; |
| 20 | + assertDeepStrictEqual(actual, expected); |
| 21 | + }); |
| 22 | + |
| 23 | + }); |
| 24 | + |
| 25 | +//////////////////////////////////////////////////////////////////////////////// |
| 26 | +describe('Library module', () => { |
| 27 | + |
| 28 | + it('is an object', () => { |
| 29 | + const actual = { constructor: esmToPlainJs.constructor.name }; |
| 30 | + const expected = { constructor: 'Object' }; |
| 31 | + assertDeepStrictEqual(actual, expected); |
| 32 | + }); |
| 33 | + |
| 34 | + it('has functions named assert(), cli(), reporter(), and transform()', () => { |
| 35 | + const module = esmToPlainJs; |
| 36 | + const actual = Object.keys(module).sort().map(key => [key, typeof module[key]]); |
| 37 | + const expected = [ |
| 38 | + ['assert', 'function'], |
| 39 | + ['cli', 'function'], |
| 40 | + ['reporter', 'function'], |
| 41 | + ['transform', 'function'], |
| 42 | + ]; |
| 43 | + assertDeepStrictEqual(actual, expected); |
| 44 | + }); |
| 45 | + |
| 46 | + }); |
0 commit comments