@scrabble-solver/word-definitions 2.15.24 → 2.16.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parse = exports.crawl = void 0;
4
4
  const cheerio_1 = require("cheerio");
5
5
  const lib_1 = require("../lib");
6
- const DOES_NOT_EXIST_MESSAGE =
7
- // eslint-disable-next-line max-len
8
- "The word you've entered isn't in the dictionary. Click on a spelling suggestion below or try again using the search bar above.";
6
+ const DOES_NOT_EXIST_MESSAGE = "The word you've entered isn't in the dictionary. Click on a spelling suggestion below or try again using the search bar above.";
9
7
  const crawl = (word) => {
10
8
  return (0, lib_1.request)({
11
9
  protocol: 'https',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrabble-solver/word-definitions",
3
- "version": "2.15.24",
3
+ "version": "2.16.0-alpha.0",
4
4
  "description": "Scrabble Solver 2 - Word definitions",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -19,11 +19,12 @@
19
19
  },
20
20
  "homepage": "https://scrabble-solver.org",
21
21
  "scripts": {
22
- "build": "tsc --project .",
23
- "clean": "rimraf build/"
22
+ "build": "tsgo --project .",
23
+ "clean": "rimraf build/",
24
+ "test": "bun test --timeout 180000 src"
24
25
  },
25
26
  "dependencies": {
26
- "@scrabble-solver/types": "^2.15.24",
27
+ "@scrabble-solver/types": "^2.16.0-alpha.0",
27
28
  "cheerio": "^1.2.0",
28
29
  "follow-redirects": "^1.16.0",
29
30
  "striptags": "^3.2.0"
@@ -32,5 +33,5 @@
32
33
  "@types/follow-redirects": "^1.14.4",
33
34
  "domhandler": "^6.0.1"
34
35
  },
35
- "gitHead": "28330eeb094266d16a0e2c80f3333f534c70dea1"
36
+ "gitHead": "c9d35d0e7f7c187fbd2b0eaf04d621595e520bd9"
36
37
  }
@@ -4,7 +4,6 @@ import { request } from '../lib';
4
4
  import type { ParsingResult } from '../types';
5
5
 
6
6
  const DOES_NOT_EXIST_MESSAGE =
7
- // eslint-disable-next-line max-len
8
7
  "The word you've entered isn't in the dictionary. Click on a spelling suggestion below or try again using the search bar above.";
9
8
 
10
9
  export const crawl = (word: string): Promise<string> => {
package/src/parse.test.ts CHANGED
@@ -3,12 +3,17 @@ import fs from 'fs';
3
3
  import path from 'path';
4
4
 
5
5
  import { parse } from './parse';
6
+ import { type ParsingResult } from './types';
6
7
 
7
8
  const readTestFile = (filepath: string): string => {
8
9
  const absoluteFilepath = path.resolve(__dirname, '__tests__', filepath);
9
10
  return fs.readFileSync(absoluteFilepath, 'utf-8');
10
11
  };
11
12
 
13
+ const readExpected = (filepath: string): ParsingResult => {
14
+ return JSON.parse(readTestFile(filepath));
15
+ };
16
+
12
17
  const tests = [
13
18
  { locale: Locale.DE_DE, word: 'hm' },
14
19
  { locale: Locale.DE_DE, word: 'ho' },
@@ -29,7 +34,7 @@ const tests = [
29
34
  describe('parse', () => {
30
35
  it.each(tests)(`[$locale] "$word"`, ({ locale, word }) => {
31
36
  const input = readTestFile(`input/${locale}.${word}.html`);
32
- const expected = readTestFile(`expected/${locale}.${word}.json`);
33
- expect(parse(locale, input)).toEqual(JSON.parse(expected));
37
+ const expected = readExpected(`expected/${locale}.${word}.json`);
38
+ expect(parse(locale, input)).toEqual(expected);
34
39
  });
35
40
  });