<commit_before>import db from "..";

describe("db", () => {
  beforeEach(() => {
    // $FlowFixMe whatever
    jest.resetModuleRegistry();
  });

  it("should be able to put & get a value", () => {
    return db
      .put("foo", "bar", { data: { title: "bar" } })
      .then(() => db.get("foo", "bar"))
      .then(value => expect(value).toMatchSnapshot());
  });

  it("should be able to get a list", () => {
    return Promise.all([
      db.put("bar", "baz", { data: { title: "baz" } }),
      db.put("bar", "foo", { data: { title: "foo" } })
    ])
      .then(() => db.getList("bar", {}))
      .then(value => expect(value).toMatchSnapshot());
  });

  it("should be able to get a reversed list", () => {
    return Promise.all([
      db.put("bar2", "baz", { data: { title: "baz" } }),
      db.put("bar2", "foo", { data: { title: "foo" } })
    ])
      .then(() => db.getList("bar2", { reverse: true }))
      .then(value => expect(value).toMatchSnapshot());
  });

  it("should be able to get a list after some value", () => {
    return Promise.all([
      db.put("bar3", "baz", { data: { title: "baz" } }),
      db.put("bar3", "foo", { data: { title: "foo" } })
    ])
      .then(() => db.getList("bar3", { gt: "c" }))
      .then(value => expect(value).toMatchSnapshot());
  });

  it("should be able to get a list before some value", () => {
    return Promise.all([
      db.put("bar4", "baz", { data: { title: "baz" } }),
      db.put("bar4", "foo", { data: { title: "foo" } })
    ])
      .then(() => db.getList("bar4", { lt: "c" }))
      .then(value => expect(value).toMatchSnapshot());
  });

  it("should be able to get a list with a limited count", () => {
    return Promise.all([
      db.put("bar5", "baz", { data: { title: "baz" } }),
      db.put("bar5", "foo", { data: { title: "foo" } })
    ])
      .then(() => db.getList("bar5", { limit: 1 }))
      .then(value => expect(value).toMatchSnapshot());
  });

  it("should throw when value isn't there", () => {
    return db.get("foo", "baz").catch(error => expect(error).toMatchSnapshot());
  });
});
<commit_msg>Put right amount of arguments in tests<commit_after>import db from "..";

describe("db", () => {
  beforeEach(() => {
    // $FlowFixMe whatever
    jest.resetModuleRegistry();
  });

  it("should be able to put & get a value", () => {
    return db
      .put("foo", "bar", { data: { title: "bar" } })
      .then(() => db.get("foo", "bar"))
      .then(value => expect(value).toMatchSnapshot());
  });

  it("should be able to get a list", () => {
    return Promise.all([
      db.put("bar", "baz", { data: { title: "baz" } }),
      db.put("bar", "foo", { data: { title: "foo" } })
    ])
      .then(() => db.getList("bar", {}, "default", 1))
      .then(value => expect(value).toMatchSnapshot());
  });

  it("should be able to get a reversed list", () => {
    return Promise.all([
      db.put("bar2", "baz", { data: { title: "baz" } }),
      db.put("bar2", "foo", { data: { title: "foo" } })
    ])
      .then(() => db.getList("bar2", { reverse: true }, "default", 1))
      .then(value => expect(value).toMatchSnapshot());
  });

  it("should be able to get a list after some value", () => {
    return Promise.all([
      db.put("bar3", "baz", { data: { title: "baz" } }),
      db.put("bar3", "foo", { data: { title: "foo" } })
    ])
      .then(() => db.getList("bar3", { gt: "c" }, "default", 1))
      .then(value => expect(value).toMatchSnapshot());
  });

  it("should be able to get a list before some value", () => {
    return Promise.all([
      db.put("bar4", "baz", { data: { title: "baz" } }),
      db.put("bar4", "foo", { data: { title: "foo" } })
    ])
      .then(() => db.getList("bar4", { lt: "c" }, "default", 1))
      .then(value => expect(value).toMatchSnapshot());
  });

  it("should be able to get a list with a limited count", () => {
    return Promise.all([
      db.put("bar5", "baz", { data: { title: "baz" } }),
      db.put("bar5", "foo", { data: { title: "foo" } })
    ])
      .then(() => db.getList("bar5", { limit: 1 }, "default", 1))
      .then(value => expect(value).toMatchSnapshot());
  });

  it("should throw when value isn't there", () => {
    return db.get("foo", "baz").catch(error => expect(error).toMatchSnapshot());
  });
});

{'fraction_non_alphanumeric': 0.24796084828711257, 'fraction_numerical': 0.0072244232113726405, 'mean_word_length': 2.7550306211723536, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 47, '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': '2969622', 'n_tokens_mistral': 1524, 'n_tokens_neox': 1480, 'n_words': 360}