|
1 |
| -import { testBlock } from "bingo-stratum-testers"; |
2 |
| -import { describe, expect, test } from "vitest"; |
| 1 | +import { testBlock, testIntake } from "bingo-stratum-testers"; |
| 2 | +import { describe, expect, it, test } from "vitest"; |
3 | 3 |
|
4 | 4 | import { blockTypeScript } from "./blockTypeScript.js";
|
5 | 5 | import { optionsBase } from "./options.fakes.js";
|
@@ -652,4 +652,46 @@ describe("blockTypeScript", () => {
|
652 | 652 | }
|
653 | 653 | `);
|
654 | 654 | });
|
| 655 | + |
| 656 | + describe("intake", () => { |
| 657 | + it("returns undefined when tsconfig.json does not exist", () => { |
| 658 | + const actual = testIntake(blockTypeScript, { |
| 659 | + files: {}, |
| 660 | + }); |
| 661 | + |
| 662 | + expect(actual).toBeUndefined(); |
| 663 | + }); |
| 664 | + |
| 665 | + it("returns undefined when tsconfig.json does not contain truthy data", () => { |
| 666 | + const actual = testIntake(blockTypeScript, { |
| 667 | + files: { |
| 668 | + "tsconfig.json": [JSON.stringify(null)], |
| 669 | + }, |
| 670 | + }); |
| 671 | + |
| 672 | + expect(actual).toBeUndefined(); |
| 673 | + }); |
| 674 | + |
| 675 | + it("returns undefined when tsconfig.json does not contain compilerOptions", () => { |
| 676 | + const actual = testIntake(blockTypeScript, { |
| 677 | + files: { |
| 678 | + "tsconfig.json": [JSON.stringify({ other: true })], |
| 679 | + }, |
| 680 | + }); |
| 681 | + |
| 682 | + expect(actual).toBeUndefined(); |
| 683 | + }); |
| 684 | + |
| 685 | + it("returns compilerOptions when tsconfig.json contains compilerOptions", () => { |
| 686 | + const compilerOptions = { module: "ESNext" }; |
| 687 | + |
| 688 | + const actual = testIntake(blockTypeScript, { |
| 689 | + files: { |
| 690 | + "tsconfig.json": [JSON.stringify({ compilerOptions })], |
| 691 | + }, |
| 692 | + }); |
| 693 | + |
| 694 | + expect(actual).toEqual({ compilerOptions }); |
| 695 | + }); |
| 696 | + }); |
655 | 697 | });
|
0 commit comments