forked from sverweij/dependency-cruiser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.spec.js
43 lines (36 loc) · 1.38 KB
/
main.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
"use strict";
const chai = require('chai');
const main = require("../../src/main");
const depSchema = require('../../src/extract/jsonschema.json');
const tsFixture = require('./fixtures/ts.json');
const tsxFixture = require('./fixtures/tsx.json');
const jsxFixture = require('./fixtures/jsx.json');
const expect = chai.expect;
chai.use(require('chai-json-schema'));
describe("main", () => {
it("Returns an object when no options are passed", () => {
const lResult = main.cruise(["test/main/fixtures/ts"]);
expect(lResult).to.deep.equal(tsFixture);
expect(lResult).to.be.jsonSchema(depSchema);
});
it("Also processes tsx correctly", () => {
const lResult = main.cruise(["test/main/fixtures/tsx"]);
expect(lResult).to.deep.equal(tsxFixture);
expect(lResult).to.be.jsonSchema(depSchema);
});
it("And jsx", () => {
const lResult = main.cruise(["test/main/fixtures/jsx"]);
expect(lResult).to.deep.equal(jsxFixture);
expect(lResult).to.be.jsonSchema(depSchema);
});
it("And rulesets in the form a an object instead of json", () => {
const lResult = main.cruise(
["test/main/fixtures/jsx"],
{
ruleSet : {}
}
);
expect(lResult).to.deep.equal(jsxFixture);
expect(lResult).to.be.jsonSchema(depSchema);
});
});