* 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 })
| 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. |