{"size": 809, "ext": "js", "max_stars_repo_path": "src/lib/neural-net/__tests__/connection.test.js", "max_stars_repo_name": "Up-North-Coding/NEAT", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/lib/neural-net/__tests__/connection.test.js", "max_issues_repo_name": "Up-North-Coding/NEAT", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/lib/neural-net/__tests__/connection.test.js", "max_forks_repo_name": "Up-North-Coding/NEAT", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 29.962962963, "max_line_length": 104, "alphanum_fraction": 0.6229913473}
import Connection from "../connection.js";
import Neuron from "../neuron.js";

describe("The connection class", () => {
  test("should throw an error if the first argument is not a Neuron", () => {
    expect(() => {
      const connection = new Connection();
    }).toThrow();
  });

  test("should throw an error if the second argument is not a Neuron", () => {
    expect(() => {
      const from = new Neuron(1);
      const connection = new Connection(from);
    }).toThrow();
  });

  test("should update the weight and enabled status with the third and fourth constructor args", () => {
    const from = new Neuron(1);
    const to = new Neuron(2);
    const connection = new Connection(from, to, 1, false);

    expect(connection.weight).toBe(1);
    expect(connection.enabled).toBe(false);
  });
});
