<commit_before>/* eslint-disable */
import { observe } from "mobx";
import ProjectStore from "../../../stores/domain/ProjectStore";
import Test from "../../../models/Test";

describe("Project Store", () => {
  it("should have a name", () => {
    const store = new ProjectStore("myStore");
    expect(store.name).toBe("myStore");
  });
  it("should observe the name change", () => {
    const store = new ProjectStore("myStore");
    const disposer = observe(store, "name", (change) => {
      expect(change.newValue).toBe("changed");
    });
    store.name = "changed";
    disposer();
  });
  it("should observe adding addition test to the store", () => {
    const store = new ProjectStore();
    const disposer = observe(store, "tests", (change) => {
      expect(change.newValue.length).toBe(1);
    });
    store.tests.push(new Test());
    disposer();
  });
  it("should add a new Test", () => {
    const store = new ProjectStore();
    expect(store.tests.length).toBe(0);
    store.addTest(new Test());
    expect(store.tests.length).toBe(1);
  });
  it("should throw if no Test was given", () => {
    const store = new ProjectStore();
    expect(() => store.addTest()).toThrowError("Expected to receive Test instead received undefined");
  });
  it("should throw if a different type was given", () => {
    const store = new ProjectStore();
    expect(() => store.addTest(1)).toThrowError("Expected to receive Test instead received Number");
  });
  it("should delete a test", () => {
    const store = new ProjectStore();
    const test = new Test();
    store.addTest(test);
    expect(store.tests.length).toBe(1);
    store.deleteTest(test);
    expect(store.tests.length).toBe(0);
  });
  it("should remove the deleted test from it's suites", () => {
    const store = new ProjectStore();
    const firstSuite = new Suite(store);
    const secondSuite = new Suite(store);
    const controlSuite = new Suite(store);
    const toBeDeleted = new Test();
    const control = new Test();
    store.addTest(toBeDeleted);
    store.addTest(control);
    firstSuite.addTest(toBeDeleted);
    secondSuite.addTest(toBeDeleted);
    secondSuite.addTest(control);
    controlSuite.addTest(control);
    expect(firstSuite.tests.length).toBe(1);
    expect(secondSuite.tests.length).toBe(2);
    expect(controlSuite.tests.length).toBe(1);
    store.deleteTest(toBeDeleted);
    expect(firstSuite.tests.length).toBe(0);
    expect(secondSuite.tests.length).toBe(1);
    expect(controlSuite.tests.length).toBe(1);
  });
});
<commit_msg>define Suite?<commit_after>/* eslint-disable */
import { observe } from "mobx";
import ProjectStore from "../../../stores/domain/ProjectStore";
import Suite from "../../../models/Suite";
import Test from "../../../models/Test";

describe("Project Store", () => {
  it("should have a name", () => {
    const store = new ProjectStore("myStore");
    expect(store.name).toBe("myStore");
  });
  it("should observe the name change", () => {
    const store = new ProjectStore("myStore");
    const disposer = observe(store, "name", (change) => {
      expect(change.newValue).toBe("changed");
    });
    store.name = "changed";
    disposer();
  });
  it("should observe adding addition test to the store", () => {
    const store = new ProjectStore();
    const disposer = observe(store, "tests", (change) => {
      expect(change.newValue.length).toBe(1);
    });
    store.tests.push(new Test());
    disposer();
  });
  it("should add a new Test", () => {
    const store = new ProjectStore();
    expect(store.tests.length).toBe(0);
    store.addTest(new Test());
    expect(store.tests.length).toBe(1);
  });
  it("should throw if no Test was given", () => {
    const store = new ProjectStore();
    expect(() => store.addTest()).toThrowError("Expected to receive Test instead received undefined");
  });
  it("should throw if a different type was given", () => {
    const store = new ProjectStore();
    expect(() => store.addTest(1)).toThrowError("Expected to receive Test instead received Number");
  });
  it("should delete a test", () => {
    const store = new ProjectStore();
    const test = new Test();
    store.addTest(test);
    expect(store.tests.length).toBe(1);
    store.deleteTest(test);
    expect(store.tests.length).toBe(0);
  });
  it("should remove the deleted test from it's suites", () => {
    const store = new ProjectStore();
    const firstSuite = new Suite(store);
    const secondSuite = new Suite(store);
    const controlSuite = new Suite(store);
    const toBeDeleted = new Test();
    const control = new Test();
    store.addTest(toBeDeleted);
    store.addTest(control);
    firstSuite.addTest(toBeDeleted);
    secondSuite.addTest(toBeDeleted);
    secondSuite.addTest(control);
    controlSuite.addTest(control);
    expect(firstSuite.tests.length).toBe(1);
    expect(secondSuite.tests.length).toBe(2);
    expect(controlSuite.tests.length).toBe(1);
    store.deleteTest(toBeDeleted);
    expect(firstSuite.tests.length).toBe(0);
    expect(secondSuite.tests.length).toBe(1);
    expect(controlSuite.tests.length).toBe(1);
  });
});

{'fraction_non_alphanumeric': 0.17211030706043418, 'fraction_numerical': 0.004693917465284568, 'mean_word_length': 3.6322463768115942, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4037966', 'n_tokens_mistral': 1501, 'n_tokens_neox': 1509, 'n_words': 359}