{"size": 1437, "ext": "js", "max_stars_repo_path": "19. Arguments Optional/test.js", "max_stars_repo_name": "alexandracaulea/Intermediate-Algorithm-Scripting", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "19. Arguments Optional/test.js", "max_issues_repo_name": "alexandracaulea/Intermediate-Algorithm-Scripting", "max_issues_repo_issues_event_min_datetime": "2020-08-18T15:55:45.000Z", "max_issues_repo_issues_event_max_datetime": "2020-08-18T15:55:45.000Z", "max_forks_repo_path": "19. Arguments Optional/test.js", "max_forks_repo_name": "alexandracaulea/Intermediate-Algorithm-Scripting", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 30.5744680851, "max_line_length": 87, "alphanum_fraction": 0.6346555324}
const addTogether = require("./index");

test("addTogether function is defined.", () => {
  expect(addTogether).toBeDefined();
});

test("addTogether(2, 4) returns a number", () => {
  const sum = addTogether(2, 4);
  expect(typeof sum).toStrictEqual("number");
  expect(sum).toBe(6);
});

describe("addTogether function accepts either one or two arguments.", () => {
  test("if no argument is provided addTogether returns undefined.", () => {
    expect(addTogether()).toBe(undefined);
  });

  test("if three or more argument are provided addTogether returns undefined.", () => {
    expect(addTogether(1, 1, 20)).toBe(undefined);
    expect(addTogether(1, 1, 20, 5, 7, 10)).toBe(undefined);
  });

  test("the arguments passed to addTogether are numbers.", () => {
    expect(addTogether("http://www.google.com", "Google")).toBe(undefined);
    expect(addTogether("http://www.google.com")).toBe(undefined);
    expect(addTogether(10, 12)).toStrictEqual(22);
    expect(addTogether(9, "18")).toBe(undefined);
    expect(addTogether("a", { x: 1 })).toBe(undefined);
  });
});

test("addTogether(1, 11) returns 12.", () => {
  expect(addTogether(1, 11)).toBe(12);
});

test("addTogether(5, -7) returns -2.", () => {
  expect(addTogether(5, -7)).toBe(-2);
});

test("addTogether(5, 39) returns 44.", () => {
  expect(addTogether(5, 39)).toBe(44);
});

test("addTogether(3)(4) returns 7.", () => {
  expect(addTogether(3)(4)).toBe(7);
});
