How to use the jasmine-fix.it function in jasmine-fix

To help you get started, we’ve selected a few jasmine-fix examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AtomLinter / linter-julia / spec / linter-julia-spec.js View on Github external
});

  it('checks a file with syntax error and reports the correct message', async () => {
    const excerpt = 'question: use of undeclared symbol';
    const editor = await atom.workspace.open(badFile);
    const messages = await lint(editor);

    expect(messages.length).toBe(1);
    expect(messages[0].severity).toBe('error');
    expect(messages[0].excerpt).toBe(excerpt);
    expect(messages[0].location.file).toBe(badFile);
    // NOTE: This is invalid! Bug in Lint.jl
    expect(messages[0].location.position).toEqual([[23, 0], [23, 80]]);
  });

  it('finds nothing wrong with a valid file', async () => {
    const editor = await atom.workspace.open(goodFile);
    const messages = await lint(editor);
    expect(messages.length).toBe(0);
  });
});
github steelbrain / atom-linter / spec / helper-spec.js View on Github external
beforeEach(() => {
      // Disable deprecate warnings in the specs
      spyOn(Grim, "deprecate").andCallFake(() => {});
    });

    function parse(a: any = undefined, b: any = undefined, c: any = undefined) {
      return helpers.parse(a, b, c);
    }

    it("cries when no argument is passed", () =>
      expect(() => parse()).toThrow());

    it("cries when data isn't string", () =>
      expect(() => parse([], "")).toThrow());

    it("works", function() {
      let regex = "type:(?.+) message:(?.+)";
      let input = "TYPE:type message:message";
      let output = [
        {
          type: "type",
          text: "message",
          filePath: null,
          range: [[0, 0], [0, 0]]
        }
      ];
      let results = parse(input, regex, { flags: "i" });
      expect(results).toEqual(output);

      regex = "type:(?.+) message:(?.+)";
      input = "TYPE:type message:message";
      output = [
github AtomLinter / linter-reek / spec / linter-reek-spec.js View on Github external
it('checks a file with issues and reports the correct message', async () => {
    const excerpt = 'IrresponsibleModule: Dirty has no descriptive comment';
    const urlRegex = /https:\/\/github.com\/troessner\/reek\/blob\/v\d.+\/docs\/Irresponsible-Module.md/g;
    const editor = await atom.workspace.open(badFile);
    const messages = await lint(editor);

    expect(messages.length).toBe(1);
    expect(messages[0].severity).toEqual('warning');
    expect(messages[0].url).toMatch(urlRegex);
    expect(messages[0].excerpt).toEqual(excerpt);
    expect(messages[0].location.file).toBe(badFile);
    expect(messages[0].location.position).toEqual([[0, 0], [0, 11]]);
  });

  it('finds nothing wrong with a valid file', async () => {
    const editor = await atom.workspace.open(goodFile);
    const messages = await lint(editor);
    expect(messages.length).toBe(0);
  });
});
github AtomLinter / linter-php / spec / linter-php-spec.js View on Github external
expect(messages[0].severity).toBe('error');
      expect(messages[0].description).not.toBeDefined();
      expect(messages[0].excerpt).toBe('syntax error, unexpected \'{\'');
      expect(messages[0].location.file).toBe(badPath);
      expect(messages[0].location.position).toEqual([[1, 0], [1, 6]]);
    });
  });

  it('finds nothing wrong with an empty file', async () => {
    const editor = await atom.workspace.open(emptyPath);
    const messages = await lint(editor);

    expect(messages.length).toBe(0);
  });

  it('finds nothing wrong with a valid file', async () => {
    const editor = await atom.workspace.open(goodPath);
    const messages = await lint(editor);

    expect(messages.length).toBe(0);
  });

  it('handles fatal errors', async () => {
    const editor = await atom.workspace.open(fatalPath);
    const messages = await lint(editor);

    expect(messages[0].severity).toBe('error');
    expect(messages[0].excerpt).toBe('Cannot redeclare Test\\A::foo()');
    expect(messages[0].location.file).toBe(fatalPath);
    expect(messages[0].location.position).toEqual([[10, 4], [10, 25]]);
  });
github AtomLinter / linter-proselint / spec / linter-proselint-spec.js View on Github external
describe('The proselint provider for Linter', () => {
  beforeEach(async () => {
    atom.workspace.destroyActivePaneItem();
    await atom.packages.activatePackage('linter-proselint');
  });

  it('finds nothing wrong with a valid file', async () => {
    const editor = await atom.workspace.open(goodPath);
    const messages = await lint(editor);
    expect(messages.length).toBe(0);
  });

  it('shows issues with a problematic file', async () => {
    const editor = await atom.workspace.open(badPath);
    const messages = await lint(editor);

    expect(messages.length).toBe(1);
    expect(messages[0].severity).toBe('warning');
    expect(messages[0].excerpt).toBe("'lol.' is chatspeak. Write it out.");
    expect(messages[0].location.file).toBe(badPath);
    expect(messages[0].location.position).toEqual([[0, 15], [0, 19]]);
  });
});
github AtomLinter / linter-elixirc / spec / linter-elixirc-spec.js View on Github external
expect(messages[0].location.position).toEqual([[20, 4], [20, 20]]);
      });

      it('works with .exs files', async () => {
        const editor = await atom.workspace.open(exsFilePathElixirc);
        const messages = await lint(editor);

        expect(messages.length).toBe(1);
        expect(messages[0].severity).toBe('warning');
        expect(messages[0].html).not.toBeDefined();
        expect(messages[0].excerpt).toBe('function simple_function/0 is unused');
        expect(messages[0].location.file).toBe(exsFilePathElixirc);
        expect(messages[0].location.position).toEqual([[1, 2], [1, 25]]);
      });

      it('finds nothing wrong with a valid file', async () => {
        const editor = await atom.workspace.open(validPathElixirc);
        const messages = await lint(editor);

        expect(messages.length).toBe(0);
      });
    });
  });
github steelbrain / atom-linter / spec / helper-spec.js View on Github external
a: any = undefined,
      b: any = undefined,
      c: any = undefined
    ) {
      return helpers.tempFile(a, b, c);
    }

    it("cries when arguments are invalid", function() {
      expect(() => tempFile()).toThrow();
      expect(() => tempFile(null, null, null)).toThrow();
      expect(() => tempFile("", null, null)).toThrow();
      expect(() => tempFile("", "", null)).toThrow();
      expect(() => tempFile("", "", "")).toThrow();
    });

    it(
      "works and accepts a callback and returns a promise and its promise" +
        " value is that returned by the callback",
      () =>
        waitsForAsync(
          async () =>
            helpers.tempFile("somefile.js", "Hey There", filepath => {
              expect(filepath.indexOf("atom-linter_")).not.toBe(-1);
              expect(path.basename(filepath)).toBe("somefile.js");
              expect(fs.existsSync(filepath)).toBe(true);
              expect(fs.readFileSync(filepath).toString()).toBe("Hey There");
              return Promise.resolve(1);
            }),
          1
        )
    );
  });
github steelbrain / linter / spec / linter-registry-spec.js View on Github external
describe('life cycle', function() {
    it('works', function() {
      const linter = getLinter()
      expect(linterRegistry.hasLinter(linter)).toBe(false)
      linterRegistry.addLinter(linter)
      expect(linterRegistry.hasLinter(linter)).toBe(true)
      linterRegistry.deleteLinter(linter)
      expect(linterRegistry.hasLinter(linter)).toBe(false)
    })
    it('sets props on add', function() {
      const linter = getLinter()
      expect(typeof linter[Helpers.$version]).toBe('undefined')
      expect(typeof linter[Helpers.$requestLatest]).toBe('undefined')
      expect(typeof linter[Helpers.$requestLastReceived]).toBe('undefined')
      linterRegistry.addLinter(linter)
      expect(typeof linter[Helpers.$version]).toBe('number')
      expect(typeof linter[Helpers.$requestLatest]).toBe('number')
      expect(typeof linter[Helpers.$requestLastReceived]).toBe('number')

jasmine-fix

My helper utilities to fix Jasmine and Add async helpers to it

MIT
Latest version published 7 years ago

Package Health Score

42 / 100
Full package analysis

Popular jasmine-fix functions