|
1 |
| -import { testBlock } from "bingo-stratum-testers"; |
2 |
| -import { describe, expect, test, vi } from "vitest"; |
| 1 | +import { testBlock, testIntake } from "bingo-stratum-testers"; |
| 2 | +import { describe, expect, it, test, vi } from "vitest"; |
3 | 3 |
|
4 | 4 | import { blockCSpell } from "./blockCSpell.js";
|
5 | 5 | import { optionsBase } from "./options.fakes.js";
|
@@ -364,4 +364,49 @@ describe("blockCSpell", () => {
|
364 | 364 | }
|
365 | 365 | `);
|
366 | 366 | });
|
| 367 | + |
| 368 | + describe("intake", () => { |
| 369 | + it("returns undefined when cspell.json does not exist", () => { |
| 370 | + const actual = testIntake(blockCSpell, { |
| 371 | + files: {}, |
| 372 | + }); |
| 373 | + |
| 374 | + expect(actual).toBeUndefined(); |
| 375 | + }); |
| 376 | + |
| 377 | + it("returns undefined when cspell.json does not contain truthy data", () => { |
| 378 | + const actual = testIntake(blockCSpell, { |
| 379 | + files: { |
| 380 | + "cspell.json": [JSON.stringify(null)], |
| 381 | + }, |
| 382 | + }); |
| 383 | + |
| 384 | + expect(actual).toBeUndefined(); |
| 385 | + }); |
| 386 | + |
| 387 | + it("returns undefined when cspell.json contains invalid data", () => { |
| 388 | + const actual = testIntake(blockCSpell, { |
| 389 | + files: { |
| 390 | + "cspell.json": [JSON.stringify({ ignores: true })], |
| 391 | + }, |
| 392 | + }); |
| 393 | + |
| 394 | + expect(actual).toBeUndefined(); |
| 395 | + }); |
| 396 | + |
| 397 | + it("returns compilerOptions when cspell.json contains ignores and words", () => { |
| 398 | + const data = { |
| 399 | + ignores: ["other"], |
| 400 | + words: ["abc", "def"], |
| 401 | + }; |
| 402 | + |
| 403 | + const actual = testIntake(blockCSpell, { |
| 404 | + files: { |
| 405 | + "cspell.json": [JSON.stringify(data)], |
| 406 | + }, |
| 407 | + }); |
| 408 | + |
| 409 | + expect(actual).toEqual(data); |
| 410 | + }); |
| 411 | + }); |
367 | 412 | });
|
0 commit comments