<commit_before>/*
 * Copyright 2020 <NAME> <<EMAIL>>
 *
 * This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
 */

import { PageDatabase } from "./PageDatabase.js";

test("Scan", async () => {
  const db = new PageDatabase("./data/pages");
  await db.loadIndex();

  const commandNames = db.getCommandNames();

  expect(commandNames).not.toBe(0);
  expect(commandNames.indexOf("ack")).not.toBe(-1);

  const info = await db.getPageInfoByName("cd", "windows");

  expect(info.examples.length).toBe(4);
  expect(info.examples[0].commandLine).toMatch(/^[^`].*[^`]$/);
  expect(info.examples[0].description).toMatch(/^.*[^:]$/);
});<commit_msg>Update a unit test because the TL;DR database changed slighty<commit_after>/*
 * Copyright 2020 <NAME> <<EMAIL>>
 *
 * This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
 */

import { PageDatabase } from "./PageDatabase.js";

test("Scan", async () => {
  const db = new PageDatabase("./data/pages");
  await db.loadIndex();

  const commandNames = db.getCommandNames();

  expect(commandNames).not.toBe(0);
  expect(commandNames.indexOf("ack")).not.toBe(-1);

  const info = await db.getPageInfoByName("cd", "windows");

  expect(info.examples.length).toBe(5);
  expect(info.examples[0].commandLine).toMatch(/^[^`].*[^`]$/);
  expect(info.examples[0].description).toMatch(/^.*[^:]$/);
});
{'fraction_non_alphanumeric': 0.1958981612446959, 'fraction_numerical': 0.01272984441301273, 'mean_word_length': 4.66, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '6336179', 'n_tokens_mistral': 473, 'n_tokens_neox': 448, 'n_words': 101}