MCPcopy
hub / github.com/FoalTS/foal / assertEqual

Method assertEqual

packages/cli/src/services/generator/generator.ts:577–593  ·  view source on GitHub ↗

* Throws an error if the two files are different. * * @param {string} actual - The path relative to the client directory. * @param {string} expected - The path relative to the `specs/` directory. * @param {{ binary: boolean }} [{ binary }={ binary: true }] - Specify if the file is binary

(actual: string, expected: string, { binary }: { binary: boolean } = { binary: false })

Source from the content-addressed store, hash-verified

575 * @memberof Generator
576 */
577 assertEqual(actual: string, expected: string, { binary }: { binary: boolean } = { binary: false }): this {
578 if (!this.fileSystem.existsSpec(expected)) {
579 throw new Error(`The spec file "${expected}" does not exist.`);
580 }
581 if (binary) {
582 deepStrictEqual(
583 this.fileSystem.readBinaryFile(join(this.currentDir, actual)),
584 this.fileSystem.readBinaryFileFromSpecs(expected)
585 );
586 } else {
587 strictEqual(
588 this.fileSystem.readFile(join(this.currentDir, actual)),
589 this.fileSystem.readFileFromSpecs(expected)
590 );
591 }
592 return this;
593 }
594
595 /**
596 * Copies a file from the `fixtures` directory.

Callers 11

testFunction · 0.80
testFunction · 0.80
testFunction · 0.80
testFunction · 0.80
testFunction · 0.80
generator.spec.tsFile · 0.80

Calls 6

joinFunction · 0.85
existsSpecMethod · 0.80
readBinaryFileMethod · 0.80
readFileMethod · 0.80
readFileFromSpecsMethod · 0.80

Tested by 5

testFunction · 0.64
testFunction · 0.64
testFunction · 0.64
testFunction · 0.64
testFunction · 0.64