Repository: eslint/eslint
File: tests/lib/linter/source-code-fixer.js (JavaScript)

Code before:
            });

            it("should remove BOM with a negative range", () => {
                const result = SourceCodeFixer.applyFixes(TEST_CODE, [REMOVE_BOM]);

                assert.strictEqual(result.output, TEST_CODE);
                assert.isTrue(result.fixed);
                assert.strictEqual(result.messages.length, 0);
            });

            it("should replace BOM with a negative range and 'foobar'", () => {
                const result = SourceCodeFixer.applyFixes(TEST_CODE, [REPLACE_BOM_WITH_TEXT]);

                assert.strictEqual(result.output, `// start\n${TEST_CODE}`);
                assert.isTrue(result.fixed);
                assert.strictEqual(result.messages.length, 0);
            });

        });

        describe("Nullish fixes", () => {
            it("should not throw if fix is null", () => {
                const result = SourceCodeFixer.applyFixes(TEST_CODE, [NULL_FIX]);

                assert.isFalse(result.fixed);
                assert.strictEqual(result.output, TEST_CODE);
            });

            it("should not throw if fix is undefined", () => {
                const result = SourceCodeFixer.applyFixes(TEST_CODE, [UNDEFINED_FIX]);

                assert.isFalse(result.fixed);
                assert.strictEqual(result.output, TEST_CODE);
            });
        });

    });

    /*
     * This section is almost same as "with no BOM".
     * Just `result.output` has BOM.
     */
    describe("applyFixes() with BOM", () => {

        const TEST_CODE_WITH_BOM = `\uFEFF${TEST_CODE}`;

        describe("Text Insertion", () => {

            it("should insert text at the end of the code", () => {
                const result = SourceCodeFixer.applyFixes(TEST_CODE_WITH_BOM, [INSERT_AT_END]);


Review comment (suggestion):
```suggestion
                assert.strictEqual(result.output, TEST_CODE);
                assert.strictEqual(result.messages.length, 1);
                assert.strictEqual(result.messages[0].message, "null");
```

To ensure the message is not removed.

Code after:
            });

            it("should remove BOM with a negative range", () => {
                const result = SourceCodeFixer.applyFixes(TEST_CODE, [REMOVE_BOM]);

                assert.strictEqual(result.output, TEST_CODE);
                assert.isTrue(result.fixed);
                assert.strictEqual(result.messages.length, 0);
            });

            it("should replace BOM with a negative range and 'foobar'", () => {
                const result = SourceCodeFixer.applyFixes(TEST_CODE, [REPLACE_BOM_WITH_TEXT]);

                assert.strictEqual(result.output, `// start\n${TEST_CODE}`);
                assert.isTrue(result.fixed);
                assert.strictEqual(result.messages.length, 0);
            });

        });

        describe("Nullish fixes", () => {
            it("should not throw if fix is null", () => {
                const result = SourceCodeFixer.applyFixes(TEST_CODE, [NULL_FIX]);

                assert.isFalse(result.fixed);
                assert.strictEqual(result.output, TEST_CODE);
                assert.strictEqual(result.messages.length, 1);
                assert.strictEqual(result.messages[0].message, "null");
            });

            it("should not throw if fix is undefined", () => {
                const result = SourceCodeFixer.applyFixes(TEST_CODE, [UNDEFINED_FIX]);

                assert.isFalse(result.fixed);
                assert.strictEqual(result.output, TEST_CODE);
                assert.strictEqual(result.messages.length, 1);
                assert.strictEqual(result.messages[0].message, "undefined");
            });
        });

    });

    /*
     * This section is almost same as "with no BOM".
     * Just `result.output` has BOM.
     */
    describe("applyFixes() with BOM", () => {

        const TEST_CODE_WITH_BOM = `\uFEFF${TEST_CODE}`;

        describe("Text Insertion", () => {