@vnejs/helpers.tokenize-text 0.1.4 → 0.1.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/helpers.tokenize-text",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,18 +10,19 @@
10
10
  "tsconfig.json"
11
11
  ],
12
12
  "scripts": {
13
- "test": "npm run build && node tests.js",
14
13
  "build": "npx @vnejs/monorepo package",
15
14
  "publish:major:plugin": "npm run publish:major",
16
15
  "publish:minor:plugin": "npm run publish:minor",
17
16
  "publish:patch:plugin": "npm run publish:patch",
18
17
  "publish:major": "npx @vnejs/monorepo publish major --access public",
19
18
  "publish:minor": "npx @vnejs/monorepo publish minor --access public",
20
- "publish:patch": "npx @vnejs/monorepo publish patch --access public"
19
+ "publish:patch": "npx @vnejs/monorepo publish patch --access public",
20
+ "test": "npx @vnejs/monorepo test"
21
21
  },
22
22
  "author": "",
23
23
  "license": "ISC",
24
24
  "devDependencies": {
25
- "@vnejs/configs.ts-common": "~0.0.1"
25
+ "@vnejs/configs.ts-common": "~0.1.0",
26
+ "@vnejs/configs.vitest": "~0.1.0"
26
27
  }
27
28
  }
@@ -0,0 +1,23 @@
1
+ import { describe, expect, it } from "vitest";
2
+
3
+ import { tokenizeText } from "../index.js";
4
+
5
+ describe("tokenizeText", () => {
6
+ it("tokenizes plain text without marks", () => {
7
+ expect(tokenizeText("ab")).toEqual([
8
+ { token: "a", marks: [] },
9
+ { token: "b", marks: [] },
10
+ ]);
11
+ });
12
+
13
+ it("applies mark to characters after opening tag", () => {
14
+ expect(tokenizeText("{bold}X")).toEqual([{ token: "X", marks: ["bold"] }]);
15
+ });
16
+
17
+ it("removes mark after closing tag", () => {
18
+ expect(tokenizeText("{bold}X{/bold}Y")).toEqual([
19
+ { token: "X", marks: ["bold"] },
20
+ { token: "Y", marks: [] },
21
+ ]);
22
+ });
23
+ });
package/tsconfig.json CHANGED
@@ -9,6 +9,7 @@
9
9
  ],
10
10
  "exclude": [
11
11
  "dist",
12
- "node_modules"
12
+ "node_modules",
13
+ "src/tests"
13
14
  ]
14
15
  }