import parseFile from "../parseFile";
import ParsingError from "../ParsingError";

const incorrectTomlFilePath =
  "./app/common/configParser/__tests__/incorrect.toml";

const tomlObj = {
  tmol: "is",
  pretty: {
    cool: "foo"
  }
};

test("Parses known file types", () => {
  expect(parseFile("./app/common/configParser/__tests__/correct.toml")).toEqual(
    tomlObj
  );
});

test("Injects file path to ParsingError", () => {
  try {
    parseFile(incorrectTomlFilePath);
  } catch (e) {
    expect(e instanceof ParsingError).toBeTruthy();
  }
});

test("Injects file path to ParsingError", () => {
  try {
    parseFile(incorrectTomlFilePath);
  } catch (e) {
    if (!(e instanceof ParsingError)) {
      throw e;
    }
    expect(e.filePath).toBe(incorrectTomlFilePath);
  }
});

import parseFile from "../parseFile";
import ParsingError from "../ParsingError";

const incorrectTomlFilePath = "./app/common/config/__tests__/incorrect.toml";

const tomlObj = {
  tmol: "is",
  pretty: {
    cool: "foo"
  }
};

test("Parses known file types", () => {
  expect(parseFile("./app/common/config/__tests__/correct.toml")).toEqual(
    tomlObj
  );
});

test("Injects file path to ParsingError", () => {
  try {
    parseFile(incorrectTomlFilePath);
  } catch (e) {
    expect(e instanceof ParsingError).toBeTruthy();
  }
});

test("Injects file path to ParsingError", () => {
  try {
    parseFile(incorrectTomlFilePath);
  } catch (e) {
    if (!(e instanceof ParsingError)) {
      throw e;
    }
    expect(e.filePath).toBe(incorrectTomlFilePath);
  }
});

Fix tests from last commit
Fix tests from last commit
