-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexports.spec.js
66 lines (54 loc) · 2.17 KB
/
exports.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
"use strict";
const commonJSExport = require("../../");
const { default: defaultExport, humanize: namedExport } = require("../../");
const { expect } = require("chai");
describe("@jsdevtools/humanize-anything package exports", () => {
it("should export the module as the default CommonJS export", () => {
expect(commonJSExport).to.be.a("function");
expect(commonJSExport.name).to.equal("humanizeValue");
});
it("should export the humanize function as the default ESM export", () => {
expect(defaultExport).to.be.a("function");
expect(defaultExport.name).to.equal("humanizeValue");
});
it("should export the humanize function as a named ESM export", () => {
expect(namedExport).to.be.a("function");
expect(namedExport.name).to.equal("humanizeValue");
});
it("should export the humanize.class function", () => {
expect(namedExport.class).to.be.a("function");
expect(namedExport.class.name).to.equal("humanizeClass");
expect(namedExport.class).to.equal(commonJSExport.class);
});
it("should export the humanize.function function", () => {
expect(namedExport.function).to.be.a("function");
expect(namedExport.function.name).to.equal("humanizeFunction");
expect(namedExport.function).to.equal(commonJSExport.function);
});
it("should export the humanize.list function", () => {
expect(namedExport.list).to.be.a("function");
expect(namedExport.list.name).to.equal("humanizeList");
expect(namedExport.list).to.equal(commonJSExport.list);
});
it("should export the humanize.type function", () => {
expect(namedExport.type).to.be.a("function");
expect(namedExport.type.name).to.equal("humanizeType");
expect(namedExport.type).to.equal(commonJSExport.type);
});
it("should export the humanize.values function", () => {
expect(namedExport.values).to.be.a("function");
expect(namedExport.values.name).to.equal("humanizeValues");
expect(namedExport.values).to.equal(commonJSExport.values);
});
it("should not export anything else", () => {
expect(commonJSExport).to.have.keys(
"default",
"humanize",
"class",
"function",
"list",
"type",
"values",
);
});
});