diff --git a/.node-version b/.node-version new file mode 100644 index 00000000..7d7a0702 --- /dev/null +++ b/.node-version @@ -0,0 +1 @@ +23.10.0 diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..b6f27f13 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/node.config.json b/node.config.json new file mode 100644 index 00000000..90efe531 --- /dev/null +++ b/node.config.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://nodejs.org/dist/latest/docs/node-config-schema.json", + "nodeOptions": { + "disable-warning": "ExperimentalWarning" + } +} diff --git a/package-lock.json b/package-lock.json index ef5188b0..7224c8dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,84 +10,9 @@ "license": "MIT", "devDependencies": { "@biomejs/biome": "1.9.4", - "@vitest/coverage-v8": "3.0.9", "npm-run-all2": "7.0.2", "typescript": "5.8.2", - "vite": "6.2.3", - "vitest": "3.0.9" - } - }, - "node_modules/@ampproject/remapping": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", - "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", - "dev": true, - "dependencies": { - "@jridgewell/gen-mapping": "^0.3.5", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/helper-string-parser": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", - "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", - "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/parser": { - "version": "7.26.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.1.tgz", - "integrity": "sha512-reoQYNiAJreZNsJzyrDNzFQ+IQ5JFiIzAHJg9bn94S3l+4++J7RsIhNMoB+lgP/9tpmiAQqspv+xfdxTSzREOw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/types": "^7.26.0" - }, - "bin": { - "parser": "bin/babel-parser.js" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@babel/types": { - "version": "7.26.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.0.tgz", - "integrity": "sha512-Z/yiTPj+lDVnF7lWeKCIJzaIkI0vYO87dMpZ4bg4TDrFe4XXLFWL1TbXU27gBP3QccxV9mZICCrnjnYlJjXHOA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-string-parser": "^7.25.9", - "@babel/helper-validator-identifier": "^7.25.9" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@bcoe/v8-coverage": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz", - "integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" + "vite": "6.2.3" } }, "node_modules/@biomejs/biome": { @@ -679,113 +604,6 @@ "node": ">=18" } }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/@istanbuljs/schema": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", - "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.5", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/set-array": "^1.2.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.24" - }, - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/resolve-uri": { - "version": "3.1.0", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/set-array": { - "version": "1.2.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6.0.0" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", - "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", - "dev": true - }, - "node_modules/@jridgewell/trace-mapping": { - "version": "0.3.25", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - } - }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, - "optional": true, - "engines": { - "node": ">=14" - } - }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.34.3", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.3.tgz", @@ -1060,168 +878,15 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.14.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.11.tgz", - "integrity": "sha512-kprQpL8MMeszbz6ojB5/tU8PLN4kesnN8Gjzw349rDlNgsSzg90lAVj3llK99Dh7JON+t9AuscPPFW6mPbTnSA==", + "version": "22.13.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.13.tgz", + "integrity": "sha512-ClsL5nMwKaBRwPcCvH8E7+nU4GxHVx1axNvMZTFHMEfNI7oahimt26P5zjVCRrjiIWj6YFXfE1v3dEp94wLcGQ==", "dev": true, + "license": "MIT", "optional": true, "peer": true, "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/@vitest/coverage-v8": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-3.0.9.tgz", - "integrity": "sha512-15OACZcBtQ34keIEn19JYTVuMFTlFrClclwWjHo/IRPg/8ELpkgNTl0o7WLP9WO9XGH6+tip9CPYtEOrIDJvBA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@ampproject/remapping": "^2.3.0", - "@bcoe/v8-coverage": "^1.0.2", - "debug": "^4.4.0", - "istanbul-lib-coverage": "^3.2.2", - "istanbul-lib-report": "^3.0.1", - "istanbul-lib-source-maps": "^5.0.6", - "istanbul-reports": "^3.1.7", - "magic-string": "^0.30.17", - "magicast": "^0.3.5", - "std-env": "^3.8.0", - "test-exclude": "^7.0.1", - "tinyrainbow": "^2.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "@vitest/browser": "3.0.9", - "vitest": "3.0.9" - }, - "peerDependenciesMeta": { - "@vitest/browser": { - "optional": true - } - } - }, - "node_modules/@vitest/expect": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.0.9.tgz", - "integrity": "sha512-5eCqRItYgIML7NNVgJj6TVCmdzE7ZVgJhruW0ziSQV4V7PvLkDL1bBkBdcTs/VuIz0IxPb5da1IDSqc1TR9eig==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/spy": "3.0.9", - "@vitest/utils": "3.0.9", - "chai": "^5.2.0", - "tinyrainbow": "^2.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/mocker": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.0.9.tgz", - "integrity": "sha512-ryERPIBOnvevAkTq+L1lD+DTFBRcjueL9lOUfXsLfwP92h4e+Heb+PjiqS3/OURWPtywfafK0kj++yDFjWUmrA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/spy": "3.0.9", - "estree-walker": "^3.0.3", - "magic-string": "^0.30.17" - }, - "funding": { - "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "msw": "^2.4.9", - "vite": "^5.0.0 || ^6.0.0" - }, - "peerDependenciesMeta": { - "msw": { - "optional": true - }, - "vite": { - "optional": true - } - } - }, - "node_modules/@vitest/pretty-format": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.0.9.tgz", - "integrity": "sha512-OW9F8t2J3AwFEwENg3yMyKWweF7oRJlMyHOMIhO5F3n0+cgQAJZBjNgrF8dLwFTEXl5jUqBLXd9QyyKv8zEcmA==", - "dev": true, - "license": "MIT", - "dependencies": { - "tinyrainbow": "^2.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/runner": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.0.9.tgz", - "integrity": "sha512-NX9oUXgF9HPfJSwl8tUZCMP1oGx2+Sf+ru6d05QjzQz4OwWg0psEzwY6VexP2tTHWdOkhKHUIZH+fS6nA7jfOw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/utils": "3.0.9", - "pathe": "^2.0.3" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/snapshot": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.0.9.tgz", - "integrity": "sha512-AiLUiuZ0FuA+/8i19mTYd+re5jqjEc2jZbgJ2up0VY0Ddyyxg/uUtBDpIFAy4uzKaQxOW8gMgBdAJJ2ydhu39A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/pretty-format": "3.0.9", - "magic-string": "^0.30.17", - "pathe": "^2.0.3" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/spy": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.0.9.tgz", - "integrity": "sha512-/CcK2UDl0aQ2wtkp3YVWldrpLRNCfVcIOFGlVGKO4R5eajsH393Z1yiXLVQ7vWsj26JOEjeZI0x5sm5P4OGUNQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "tinyspy": "^3.0.2" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/utils": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.0.9.tgz", - "integrity": "sha512-ilHM5fHhZ89MCp5aAaM9uhfl1c2JdxVxl3McqsdVyVNN6JffnEen8UMCdRTzOhGXNQGo5GNL9QugHrz727Wnng==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/pretty-format": "3.0.9", - "loupe": "^3.1.3", - "tinyrainbow": "^2.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" + "undici-types": "~6.20.0" } }, "node_modules/ansi-styles": { @@ -1236,16 +901,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/assertion-error": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", - "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - } - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -1261,60 +916,6 @@ "balanced-match": "^1.0.0" } }, - "node_modules/cac": { - "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/chai": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-5.2.0.tgz", - "integrity": "sha512-mCuXncKXk5iCLhfhwTc0izo0gtEmpz5CtG2y8GiOINBlMVS6v8TMRc5TaLWKS6692m9+dVVfzgeVxR5UxWHTYw==", - "dev": true, - "license": "MIT", - "dependencies": { - "assertion-error": "^2.0.1", - "check-error": "^2.1.1", - "deep-eql": "^5.0.1", - "loupe": "^3.1.0", - "pathval": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/check-error": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", - "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 16" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", @@ -1330,53 +931,6 @@ "node": ">= 8" } }, - "node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/deep-eql": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", - "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true - }, - "node_modules/es-module-lexer": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.6.0.tgz", - "integrity": "sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==", - "dev": true, - "license": "MIT" - }, "node_modules/esbuild": { "version": "0.25.0", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.0.tgz", @@ -1418,42 +972,6 @@ "@esbuild/win32-x64": "0.25.0" } }, - "node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0" - } - }, - "node_modules/expect-type": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.1.0.tgz", - "integrity": "sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/foreground-child": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.2.1.tgz", - "integrity": "sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==", - "dev": true, - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/fsevents": { "version": "2.3.3", "dev": true, @@ -1466,100 +984,11 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/html-escaper": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", - "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", - "dev": true - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/isexe": { - "version": "2.0.0", + "node_modules/isexe": { + "version": "2.0.0", "dev": true, "license": "ISC" }, - "node_modules/istanbul-lib-coverage": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", - "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/istanbul-lib-report": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", - "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", - "dev": true, - "dependencies": { - "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^4.0.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-lib-source-maps": { - "version": "5.0.6", - "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz", - "integrity": "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==", - "dev": true, - "dependencies": { - "@jridgewell/trace-mapping": "^0.3.23", - "debug": "^4.1.1", - "istanbul-lib-coverage": "^3.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/istanbul-reports": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.7.tgz", - "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", - "dev": true, - "dependencies": { - "html-escaper": "^2.0.0", - "istanbul-lib-report": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/jackspeak": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", - "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", - "dev": true, - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, "node_modules/json-parse-even-better-errors": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-4.0.0.tgz", @@ -1570,56 +999,6 @@ "node": "^18.17.0 || >=20.5.0" } }, - "node_modules/loupe": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.1.3.tgz", - "integrity": "sha512-kkIp7XSkP78ZxJEsSxW3712C6teJVoeHHwgo9zJ380de7IYyJ2ISlxojcH2pC5OFLewESmnRi/+XCDIEEVyoug==", - "dev": true, - "license": "MIT" - }, - "node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "dev": true - }, - "node_modules/magic-string": { - "version": "0.30.17", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", - "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0" - } - }, - "node_modules/magicast": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz", - "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/parser": "^7.25.4", - "@babel/types": "^7.25.4", - "source-map-js": "^1.2.0" - } - }, - "node_modules/make-dir": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", - "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", - "dev": true, - "dependencies": { - "semver": "^7.5.3" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/memorystream": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/memorystream/-/memorystream-0.3.1.tgz", @@ -1644,22 +1023,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, "node_modules/nanoid": { "version": "3.3.8", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", @@ -1742,12 +1105,6 @@ "node": "^18.17.0 || >=20.5.0" } }, - "node_modules/package-json-from-dist": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.0.tgz", - "integrity": "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==", - "dev": true - }, "node_modules/path-key": { "version": "3.1.1", "dev": true, @@ -1756,39 +1113,6 @@ "node": ">=8" } }, - "node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "dev": true, - "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/pathe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", - "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", - "dev": true, - "license": "MIT" - }, - "node_modules/pathval": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.0.tgz", - "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 14.16" - } - }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -1890,18 +1214,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/shebang-command": { "version": "2.0.0", "dev": true, @@ -1930,24 +1242,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/siginfo": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", - "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true - }, - "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/source-map-js": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", @@ -1958,198 +1252,6 @@ "node": ">=0.10.0" } }, - "node_modules/stackback": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true - }, - "node_modules/std-env": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.8.0.tgz", - "integrity": "sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==", - "dev": true, - "license": "MIT" - }, - "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/string-width/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/string-width/node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/test-exclude": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.1.tgz", - "integrity": "sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==", - "dev": true, - "dependencies": { - "@istanbuljs/schema": "^0.1.2", - "glob": "^10.4.1", - "minimatch": "^9.0.4" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/test-exclude/node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", - "dev": true, - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/tinybench": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", - "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", - "dev": true, - "license": "MIT" - }, - "node_modules/tinyexec": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", - "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", - "dev": true, - "license": "MIT" - }, - "node_modules/tinypool": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.0.2.tgz", - "integrity": "sha512-al6n+QEANGFOMf/dmUMsuS5/r9B06uwlyNjZZql/zv8J7ybHCgoihBNORZCY2mzUuAnomQa2JdhyHKzZxPCrFA==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.0.0 || >=20.0.0" - } - }, - "node_modules/tinyrainbow": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", - "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/tinyspy": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz", - "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/typescript": { "version": "5.8.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.2.tgz", @@ -2165,7 +1267,9 @@ } }, "node_modules/undici-types": { - "version": "5.26.5", + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", "dev": true, "license": "MIT", "optional": true, @@ -2243,99 +1347,6 @@ } } }, - "node_modules/vite-node": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.0.9.tgz", - "integrity": "sha512-w3Gdx7jDcuT9cNn9jExXgOyKmf5UOTb6WMHz8LGAm54eS1Elf5OuBhCxl6zJxGhEeIkgsE1WbHuoL0mj/UXqXg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cac": "^6.7.14", - "debug": "^4.4.0", - "es-module-lexer": "^1.6.0", - "pathe": "^2.0.3", - "vite": "^5.0.0 || ^6.0.0" - }, - "bin": { - "vite-node": "vite-node.mjs" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/vitest": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.0.9.tgz", - "integrity": "sha512-BbcFDqNyBlfSpATmTtXOAOj71RNKDDvjBM/uPfnxxVGrG+FSH2RQIwgeEngTaTkuU/h0ScFvf+tRcKfYXzBybQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/expect": "3.0.9", - "@vitest/mocker": "3.0.9", - "@vitest/pretty-format": "^3.0.9", - "@vitest/runner": "3.0.9", - "@vitest/snapshot": "3.0.9", - "@vitest/spy": "3.0.9", - "@vitest/utils": "3.0.9", - "chai": "^5.2.0", - "debug": "^4.4.0", - "expect-type": "^1.1.0", - "magic-string": "^0.30.17", - "pathe": "^2.0.3", - "std-env": "^3.8.0", - "tinybench": "^2.9.0", - "tinyexec": "^0.3.2", - "tinypool": "^1.0.2", - "tinyrainbow": "^2.0.0", - "vite": "^5.0.0 || ^6.0.0", - "vite-node": "3.0.9", - "why-is-node-running": "^2.3.0" - }, - "bin": { - "vitest": "vitest.mjs" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "@edge-runtime/vm": "*", - "@types/debug": "^4.1.12", - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", - "@vitest/browser": "3.0.9", - "@vitest/ui": "3.0.9", - "happy-dom": "*", - "jsdom": "*" - }, - "peerDependenciesMeta": { - "@edge-runtime/vm": { - "optional": true - }, - "@types/debug": { - "optional": true - }, - "@types/node": { - "optional": true - }, - "@vitest/browser": { - "optional": true - }, - "@vitest/ui": { - "optional": true - }, - "happy-dom": { - "optional": true - }, - "jsdom": { - "optional": true - } - } - }, "node_modules/which": { "version": "2.0.2", "dev": true, @@ -2349,119 +1360,6 @@ "engines": { "node": ">= 8" } - }, - "node_modules/why-is-node-running": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", - "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", - "dev": true, - "dependencies": { - "siginfo": "^2.0.0", - "stackback": "0.0.2" - }, - "bin": { - "why-is-node-running": "cli.js" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", - "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } } } } diff --git a/package.json b/package.json index 94d5c147..f6282ebb 100644 --- a/package.json +++ b/package.json @@ -13,14 +13,21 @@ "import": "./out/index.mjs", "require": "./out/index.cjs" }, + "devEngines": { + "runtime": { + "name": "node", + "version": ">=23.10.0", + "onFail": "error" + } + }, "scripts": { "prebuild": "node -e 'fs.rmSync(`out`, {recursive:true, force:true})'", "build": "run-p build:*", "build:types": "tsc -p ./tsconfig.json", "build:vite": "vite build", "prepare": "npm run build", - "test": "vitest run --coverage", - "test:update": "vitest run -u", + "test": "node --experimental-default-config-file --test --experimental-test-coverage", + "test:update": "npm test -- --experimental-test-snapshots", "lint": "run-p lint:*", "lint:biome": "biome check .", "lint:tsc": "tsc -p ./tsconfig.lint.json", @@ -39,11 +46,9 @@ "homepage": "https://github.com/progfay/scrapbox-parser#readme", "devDependencies": { "@biomejs/biome": "1.9.4", - "@vitest/coverage-v8": "3.0.9", "npm-run-all2": "7.0.2", "typescript": "5.8.2", - "vite": "6.2.3", - "vitest": "3.0.9" + "vite": "6.2.3" }, "publishConfig": { "access": "public" diff --git a/tests/codeBlock/index.test.ts b/test/codeBlock/index.test.ts similarity index 74% rename from tests/codeBlock/index.test.ts rename to test/codeBlock/index.test.ts index 699f915b..561206d2 100644 --- a/tests/codeBlock/index.test.ts +++ b/test/codeBlock/index.test.ts @@ -1,9 +1,9 @@ -import { describe, expect, it } from "vitest"; +import { describe, it } from "node:test"; import { parse } from "../../src/index.ts"; describe("Code Block", () => { - it("Simple code block", () => { - expect( + it("Simple code block", ({ assert }) => { + assert.snapshot( parse( ` code:hello.js @@ -15,11 +15,11 @@ code:hello.js `.trim(), { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); - it("Bulleted code block", () => { - expect( + it("Bulleted code block", ({ assert }) => { + assert.snapshot( parse( ` code:hello.js function () { @@ -29,11 +29,11 @@ code:hello.js }`, { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); - it("Code block with bullet", () => { - expect( + it("Code block with bullet", ({ assert }) => { + assert.snapshot( parse( ` Bullet code:hello.js @@ -45,11 +45,11 @@ code:hello.js Bullet`, { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); - it("Consecutive code blocks", () => { - expect( + it("Consecutive code blocks", ({ assert }) => { + assert.snapshot( parse( ` code:hello.js @@ -67,6 +67,6 @@ code:hello.js `.trim(), { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); }); diff --git a/tests/codeBlock/__snapshots__/index.test.ts.snap b/test/codeBlock/index.test.ts.snapshot similarity index 52% rename from tests/codeBlock/__snapshots__/index.test.ts.snap rename to test/codeBlock/index.test.ts.snapshot index 92c4a42d..196dddda 100644 --- a/tests/codeBlock/__snapshots__/index.test.ts.snap +++ b/test/codeBlock/index.test.ts.snapshot @@ -1,17 +1,11 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`Code Block > Bulleted code block 1`] = ` [ { - "content": "function () { - alert(document.location.href) - console.log("hello") - // You can also write comments! -}", - "fileName": "hello.js", "indent": 1, "type": "codeBlock", - }, + "fileName": "hello.js", + "content": "function () {\\n alert(document.location.href)\\n console.log(\\"hello\\")\\n // You can also write comments!\\n}" + } ] `; @@ -19,75 +13,59 @@ exports[`Code Block > Code block with bullet 1`] = ` [ { "indent": 1, + "type": "line", "nodes": [ { - "raw": "Bullet", - "text": "Bullet", "type": "plain", - }, - ], - "type": "line", + "raw": "Bullet", + "text": "Bullet" + } + ] }, { - "content": "function () { - alert(document.location.href) - console.log("hello") - // You can also write comments! -}", - "fileName": "hello.js", "indent": 1, "type": "codeBlock", + "fileName": "hello.js", + "content": "function () {\\n alert(document.location.href)\\n console.log(\\"hello\\")\\n // You can also write comments!\\n}" }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "Bullet", - "text": "Bullet", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "Bullet", + "text": "Bullet" + } + ] + } ] `; exports[`Code Block > Consecutive code blocks 1`] = ` [ { - "content": "function () { - alert(document.location.href) - console.log("hello") - // You can also write comments! -}", - "fileName": "hello.js", "indent": 0, "type": "codeBlock", + "fileName": "hello.js", + "content": "function () {\\n alert(document.location.href)\\n console.log(\\"hello\\")\\n // You can also write comments!\\n}" }, { - "content": "function () { - alert(document.location.href) - console.log("hello") - // You can also write comments! -}", - "fileName": "hello.js", "indent": 0, "type": "codeBlock", - }, + "fileName": "hello.js", + "content": "function () {\\n alert(document.location.href)\\n console.log(\\"hello\\")\\n // You can also write comments!\\n}" + } ] `; exports[`Code Block > Simple code block 1`] = ` [ { - "content": "function () { - alert(document.location.href) - console.log("hello") - // You can also write comments! -}", - "fileName": "hello.js", "indent": 0, "type": "codeBlock", - }, + "fileName": "hello.js", + "content": "function () {\\n alert(document.location.href)\\n console.log(\\"hello\\")\\n // You can also write comments!\\n}" + } ] `; diff --git a/test/line/blank.test.ts b/test/line/blank.test.ts new file mode 100644 index 00000000..0ba7dc54 --- /dev/null +++ b/test/line/blank.test.ts @@ -0,0 +1,37 @@ +/* eslint-disable no-irregular-whitespace */ +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("blank", () => { + it("Simple half-space blank", ({ assert }) => { + assert.snapshot(parse("[ ]", { hasTitle: false })); + }); + + it("Simple double-byte space blank", ({ assert }) => { + assert.snapshot(parse("[ ]", { hasTitle: false })); + }); + + it("Simple tab blank", ({ assert }) => { + assert.snapshot(parse("[\t]", { hasTitle: false })); + }); + + it("Multi char blank", ({ assert }) => { + assert.snapshot(parse("[   \t \t ]", { hasTitle: false })); + }); + + it("Blank in the sentence", ({ assert }) => { + assert.snapshot( + parse("sentence[ ]sentence", { + hasTitle: false, + }), + ); + }); + + it("[] is not blank", ({ assert }) => { + assert.snapshot(parse("[]", { hasTitle: false })); + }); + + it("Blank in the [*** ]", ({ assert }) => { + assert.snapshot(parse("[*** [ ]]", { hasTitle: false })); + }); +}); diff --git a/tests/line/__snapshots__/blank.test.ts.snap b/test/line/blank.test.ts.snapshot similarity index 72% rename from tests/line/__snapshots__/blank.test.ts.snap rename to test/line/blank.test.ts.snapshot index 93d4b0bc..f6a4d357 100644 --- a/tests/line/__snapshots__/blank.test.ts.snap +++ b/test/line/blank.test.ts.snapshot @@ -1,44 +1,26 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`blank > [] is not blank 1`] = ` -[ - { - "indent": 0, - "nodes": [ - { - "raw": "[]", - "text": "[]", - "type": "plain", - }, - ], - "type": "line", - }, -] -`; - exports[`blank > Blank in the [*** ] 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[*** ", - "text": "[*** ", "type": "plain", + "raw": "[*** ", + "text": "[*** " }, { - "raw": "[ ]", - "text": " ", "type": "blank", + "raw": "[ ]", + "text": " " }, { - "raw": "]", - "text": "]", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "]", + "text": "]" + } + ] + } ] `; @@ -46,25 +28,25 @@ exports[`blank > Blank in the sentence 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "sentence", - "text": "sentence", "type": "plain", + "raw": "sentence", + "text": "sentence" }, { - "raw": "[ ]", - "text": " ", "type": "blank", + "raw": "[ ]", + "text": " " }, { - "raw": "sentence", - "text": "sentence", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "sentence", + "text": "sentence" + } + ] + } ] `; @@ -72,15 +54,15 @@ exports[`blank > Multi char blank 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[     ]", - "text": "     ", "type": "blank", - }, - ], - "type": "line", - }, + "raw": "[   \\t \\t ]", + "text": "   \\t \\t " + } + ] + } ] `; @@ -88,15 +70,15 @@ exports[`blank > Simple double-byte space blank 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[ ]", - "text": " ", "type": "blank", - }, - ], - "type": "line", - }, + "raw": "[ ]", + "text": " " + } + ] + } ] `; @@ -104,15 +86,15 @@ exports[`blank > Simple half-space blank 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[ ]", - "text": " ", "type": "blank", - }, - ], - "type": "line", - }, + "raw": "[ ]", + "text": " " + } + ] + } ] `; @@ -120,14 +102,30 @@ exports[`blank > Simple tab blank 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[ ]", - "text": " ", "type": "blank", - }, - ], + "raw": "[\\t]", + "text": "\\t" + } + ] + } +] +`; + +exports[`blank > [] is not blank 1`] = ` +[ + { + "indent": 0, "type": "line", - }, + "nodes": [ + { + "type": "plain", + "raw": "[]", + "text": "[]" + } + ] + } ] `; diff --git a/tests/line/bullet.test.ts b/test/line/bullet.test.ts similarity index 54% rename from tests/line/bullet.test.ts rename to test/line/bullet.test.ts index 29f8e542..75bb3eb6 100644 --- a/tests/line/bullet.test.ts +++ b/test/line/bullet.test.ts @@ -1,30 +1,30 @@ -import { describe, expect, it } from "vitest"; +import { describe, it } from "node:test"; import { parse } from "../../src/index.ts"; describe("bullet", () => { - it("Single-byte space indent", () => { - expect( + it("Single-byte space indent", ({ assert }) => { + assert.snapshot( parse(" Single-byte space", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); - it("Double-byte space indent", () => { - expect( + it("Double-byte space indent", ({ assert }) => { + assert.snapshot( parse(" Double-byte space", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); - it("Tab indent", () => { + it("Tab indent", ({ assert }) => { // eslint-disable-next-line no-tabs - expect(parse(" Tab", { hasTitle: false })).toMatchSnapshot(); + assert.snapshot(parse(" Tab", { hasTitle: false })); }); - it("Multi lines bullet", () => { - expect( + it("Multi lines bullet", ({ assert }) => { + assert.snapshot( parse( ` no bullet (indent: 0) @@ -34,6 +34,6 @@ no bullet (indent: 0) `.trim(), { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); }); diff --git a/tests/line/__snapshots__/bullet.test.ts.snap b/test/line/bullet.test.ts.snapshot similarity index 70% rename from tests/line/__snapshots__/bullet.test.ts.snap rename to test/line/bullet.test.ts.snapshot index 7b882a2d..92a44944 100644 --- a/tests/line/__snapshots__/bullet.test.ts.snap +++ b/test/line/bullet.test.ts.snapshot @@ -1,18 +1,16 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`bullet > Double-byte space indent 1`] = ` [ { "indent": 1, + "type": "line", "nodes": [ { - "raw": "Double-byte space", - "text": "Double-byte space", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "Double-byte space", + "text": "Double-byte space" + } + ] + } ] `; @@ -20,48 +18,48 @@ exports[`bullet > Multi lines bullet 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "no bullet (indent: 0)", - "text": "no bullet (indent: 0)", "type": "plain", - }, - ], - "type": "line", + "raw": "no bullet (indent: 0)", + "text": "no bullet (indent: 0)" + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "first bullet (indent: 1)", - "text": "first bullet (indent: 1)", "type": "plain", - }, - ], - "type": "line", + "raw": "first bullet (indent: 1)", + "text": "first bullet (indent: 1)" + } + ] }, { "indent": 2, + "type": "line", "nodes": [ { - "raw": "second bullet (indent: 2)", - "text": "second bullet (indent: 2)", "type": "plain", - }, - ], - "type": "line", + "raw": "second bullet (indent: 2)", + "text": "second bullet (indent: 2)" + } + ] }, { "indent": 3, + "type": "line", "nodes": [ { - "raw": "third bullet (indent: 3)", - "text": "third bullet (indent: 3)", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "third bullet (indent: 3)", + "text": "third bullet (indent: 3)" + } + ] + } ] `; @@ -69,15 +67,15 @@ exports[`bullet > Single-byte space indent 1`] = ` [ { "indent": 1, + "type": "line", "nodes": [ { - "raw": "Single-byte space", - "text": "Single-byte space", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "Single-byte space", + "text": "Single-byte space" + } + ] + } ] `; @@ -85,14 +83,14 @@ exports[`bullet > Tab indent 1`] = ` [ { "indent": 1, + "type": "line", "nodes": [ { - "raw": "Tab", - "text": "Tab", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "Tab", + "text": "Tab" + } + ] + } ] `; diff --git a/test/line/code.test.ts b/test/line/code.test.ts new file mode 100644 index 00000000..551ba0be --- /dev/null +++ b/test/line/code.test.ts @@ -0,0 +1,12 @@ +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("code", () => { + it("Simple code with backquote", ({ assert }) => { + assert.snapshot(parse("`Simple code`", { hasTitle: false })); + }); + + it("Empty code with backquote", ({ assert }) => { + assert.snapshot(parse("``", { hasTitle: false })); + }); +}); diff --git a/tests/line/__snapshots__/code.test.ts.snap b/test/line/code.test.ts.snapshot similarity index 69% rename from tests/line/__snapshots__/code.test.ts.snap rename to test/line/code.test.ts.snapshot index 85d5fd92..efd017ef 100644 --- a/tests/line/__snapshots__/code.test.ts.snap +++ b/test/line/code.test.ts.snapshot @@ -1,18 +1,16 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`code > Empty code with backquote 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "\`\`", - "text": "", "type": "code", - }, - ], - "type": "line", - }, + "raw": "\`\`", + "text": "" + } + ] + } ] `; @@ -20,14 +18,14 @@ exports[`code > Simple code with backquote 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "\`Simple code\`", - "text": "Simple code", "type": "code", - }, - ], - "type": "line", - }, + "raw": "\`Simple code\`", + "text": "Simple code" + } + ] + } ] `; diff --git a/test/line/commandLine.test.ts b/test/line/commandLine.test.ts new file mode 100644 index 00000000..0e743096 --- /dev/null +++ b/test/line/commandLine.test.ts @@ -0,0 +1,24 @@ +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("commandLine", () => { + it("Simple command with $", ({ assert }) => { + assert.snapshot(parse("$ command", { hasTitle: false })); + }); + + it("Simple command with %", ({ assert }) => { + assert.snapshot(parse("% command", { hasTitle: false })); + }); + + it("`$` is not command", ({ assert }) => { + assert.snapshot(parse("$", { hasTitle: false })); + }); + + it("`$ ` is not command", ({ assert }) => { + assert.snapshot(parse("$ ", { hasTitle: false })); + }); + + it("`$s` is not command", ({ assert }) => { + assert.snapshot(parse("$not command", { hasTitle: false })); + }); +}); diff --git a/tests/line/__snapshots__/commandLine.test.ts.snap b/test/line/commandLine.test.ts.snapshot similarity index 75% rename from tests/line/__snapshots__/commandLine.test.ts.snap rename to test/line/commandLine.test.ts.snapshot index b3b9c42e..50a1b5c3 100644 --- a/tests/line/__snapshots__/commandLine.test.ts.snap +++ b/test/line/commandLine.test.ts.snapshot @@ -1,83 +1,81 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`commandLine > \`$ \` is not command 1`] = ` +exports[`commandLine > Simple command with $ 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "$ ", - "text": "$ ", - "type": "plain", - }, - ], - "type": "line", - }, + "type": "commandLine", + "raw": "$ command", + "symbol": "$", + "text": "command" + } + ] + } ] `; -exports[`commandLine > \`$\` is not command 1`] = ` +exports[`commandLine > Simple command with % 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "$", - "text": "$", - "type": "plain", - }, - ], - "type": "line", - }, + "type": "commandLine", + "raw": "% command", + "symbol": "%", + "text": "command" + } + ] + } ] `; -exports[`commandLine > \`$s\` is not command 1`] = ` +exports[`commandLine > \`$ \` is not command 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "$not command", - "text": "$not command", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "$ ", + "text": "$ " + } + ] + } ] `; -exports[`commandLine > Simple command with $ 1`] = ` +exports[`commandLine > \`$\` is not command 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "$ command", - "symbol": "$", - "text": "command", - "type": "commandLine", - }, - ], - "type": "line", - }, + "type": "plain", + "raw": "$", + "text": "$" + } + ] + } ] `; -exports[`commandLine > Simple command with % 1`] = ` +exports[`commandLine > \`$s\` is not command 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "% command", - "symbol": "%", - "text": "command", - "type": "commandLine", - }, - ], - "type": "line", - }, + "type": "plain", + "raw": "$not command", + "text": "$not command" + } + ] + } ] `; diff --git a/tests/line/decoration.test.ts b/test/line/decoration.test.ts similarity index 55% rename from tests/line/decoration.test.ts rename to test/line/decoration.test.ts index 36e7024f..b845af32 100644 --- a/tests/line/decoration.test.ts +++ b/test/line/decoration.test.ts @@ -1,4 +1,5 @@ -import { describe, expect, it } from "vitest"; +import { deepStrictEqual } from "node:assert/strict"; +import { describe, it } from "node:test"; import { type Decoration, type DecorationNode, @@ -7,8 +8,8 @@ import { } from "../../src/index.ts"; describe("decoration", () => { - it("Simple decoration", () => { - expect( + it("Simple decoration", ({ assert }) => { + assert.snapshot( parse( ` [* deco] @@ -44,7 +45,7 @@ describe("decoration", () => { `.trim(), { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); it("All decoration", () => { @@ -74,60 +75,62 @@ describe("decoration", () => { "_", "~", ]; - expect(new Set(received)).toEqual(new Set(decos)); + deepStrictEqual(received.sort(), decos.sort()); }); - it("Decoration * overflow", () => { - expect(parse("[*********** 11*]", { hasTitle: false })).toMatchSnapshot(); + it("Decoration * overflow", ({ assert }) => { + assert.snapshot(parse("[*********** 11*]", { hasTitle: false })); }); - it("Decoration similar with externalLink", () => { - expect( + it("Decoration similar with externalLink", ({ assert }) => { + assert.snapshot( parse("[* hoge https://example.com]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); - it("Decoration with hashTag", () => { - expect( + it("Decoration with hashTag", ({ assert }) => { + assert.snapshot( parse("[* #tag]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); - it("Decoration with many [", () => { - expect(parse("[! [[[[[[a]", { hasTitle: false })).toMatchSnapshot(); + it("Decoration with many [", ({ assert }) => { + assert.snapshot(parse("[! [[[[[[a]", { hasTitle: false })); }); - it("Decoration with many [ and link", () => { - expect(parse("[! [[[[[[a]]", { hasTitle: false })).toMatchSnapshot(); + it("Decoration with many [ and link", ({ assert }) => { + assert.snapshot(parse("[! [[[[[[a]]", { hasTitle: false })); }); - it("Decoration with strong notation (it's just link)", () => { - expect(parse("[* [[link]]]", { hasTitle: false })).toMatchSnapshot(); + it("Decoration with strong notation (it's just link)", ({ assert }) => { + assert.snapshot(parse("[* [[link]]]", { hasTitle: false })); }); - it("Decoration with icon notation", () => { - expect( + it("Decoration with icon notation", ({ assert }) => { + assert.snapshot( parse("[* [progfay.icon]]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); - it("Decoration with strong icon notation (it's just icon, not strong)", () => { - expect( - parse("[* [[progfay.icon]]]", { hasTitle: false }), - ).toMatchSnapshot(); + it("Decoration with strong icon notation (it's just icon, not strong)", ({ + assert, + }) => { + assert.snapshot(parse("[* [[progfay.icon]]]", { hasTitle: false })); }); - it("Decoration with strong image notation (it's just image, not strong)", () => { - expect( + it("Decoration with strong image notation (it's just image, not strong)", ({ + assert, + }) => { + assert.snapshot( parse("[* [[https://example.com/image.png]]]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); }); diff --git a/tests/line/__snapshots__/decoration.test.ts.snap b/test/line/decoration.test.ts.snapshot similarity index 77% rename from tests/line/__snapshots__/decoration.test.ts.snap rename to test/line/decoration.test.ts.snapshot index d4c22601..4956f8d5 100644 --- a/tests/line/__snapshots__/decoration.test.ts.snap +++ b/test/line/decoration.test.ts.snapshot @@ -1,28 +1,26 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`decoration > Decoration * overflow 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[*********** 11*]", + "rawDecos": "***********", "decos": [ - "*-10", + "*-10" ], "nodes": [ { - "raw": "11*", - "text": "11*", "type": "plain", - }, - ], - "raw": "[*********** 11*]", - "rawDecos": "***********", - "type": "decoration", - }, - ], - "type": "line", - }, + "raw": "11*", + "text": "11*" + } + ] + } + ] + } ] `; @@ -30,32 +28,32 @@ exports[`decoration > Decoration similar with externalLink 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[* hoge https://example.com]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { - "raw": "hoge ", - "text": "hoge ", "type": "plain", + "raw": "hoge ", + "text": "hoge " }, { - "content": "", - "href": "https://example.com", - "pathType": "absolute", - "raw": "https://example.com", "type": "link", - }, - ], - "raw": "[* hoge https://example.com]", - "rawDecos": "*", - "type": "decoration", - }, - ], - "type": "line", - }, + "raw": "https://example.com", + "pathType": "absolute", + "href": "https://example.com", + "content": "" + } + ] + } + ] + } ] `; @@ -63,25 +61,25 @@ exports[`decoration > Decoration with hashTag 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[* #tag]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { - "href": "tag", - "raw": "#tag", "type": "hashTag", - }, - ], - "raw": "[* #tag]", - "rawDecos": "*", - "type": "decoration", - }, - ], - "type": "line", - }, + "raw": "#tag", + "href": "tag" + } + ] + } + ] + } ] `; @@ -89,26 +87,26 @@ exports[`decoration > Decoration with icon notation 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[* [progfay.icon]]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { "path": "progfay", "pathType": "relative", - "raw": "[progfay.icon]", "type": "icon", - }, - ], - "raw": "[* [progfay.icon]]", - "rawDecos": "*", - "type": "decoration", - }, - ], - "type": "line", - }, + "raw": "[progfay.icon]" + } + ] + } + ] + } ] `; @@ -116,25 +114,25 @@ exports[`decoration > Decoration with many [ 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[! [[[[[[a]", + "rawDecos": "!", "decos": [ - "!", + "!" ], "nodes": [ { - "raw": "[[[[[[a", - "text": "[[[[[[a", "type": "plain", - }, - ], - "raw": "[! [[[[[[a]", - "rawDecos": "!", - "type": "decoration", - }, - ], - "type": "line", - }, + "raw": "[[[[[[a", + "text": "[[[[[[a" + } + ] + } + ] + } ] `; @@ -142,32 +140,32 @@ exports[`decoration > Decoration with many [ and link 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[! [[[[[[a]]", + "rawDecos": "!", "decos": [ - "!", + "!" ], "nodes": [ { - "raw": "[[[[[", - "text": "[[[[[", "type": "plain", + "raw": "[[[[[", + "text": "[[[[[" }, { - "content": "", - "href": "a", - "pathType": "relative", - "raw": "[a]", "type": "link", - }, - ], - "raw": "[! [[[[[[a]]", - "rawDecos": "!", - "type": "decoration", - }, - ], - "type": "line", - }, + "raw": "[a]", + "pathType": "relative", + "href": "a", + "content": "" + } + ] + } + ] + } ] `; @@ -175,36 +173,36 @@ exports[`decoration > Decoration with strong icon notation (it's just icon, not [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[* [[progfay.icon]]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { - "raw": "[", - "text": "[", "type": "plain", + "raw": "[", + "text": "[" }, { "path": "progfay", "pathType": "relative", - "raw": "[progfay.icon]", "type": "icon", - }, - ], - "raw": "[* [[progfay.icon]]", - "rawDecos": "*", - "type": "decoration", + "raw": "[progfay.icon]" + } + ] }, { - "raw": "]", - "text": "]", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "]", + "text": "]" + } + ] + } ] `; @@ -212,36 +210,36 @@ exports[`decoration > Decoration with strong image notation (it's just image, no [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[* [[https://example.com/image.png]]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { - "raw": "[", - "text": "[", "type": "plain", + "raw": "[", + "text": "[" }, { - "link": "", + "type": "image", "raw": "[https://example.com/image.png]", "src": "https://example.com/image.png", - "type": "image", - }, - ], - "raw": "[* [[https://example.com/image.png]]", - "rawDecos": "*", - "type": "decoration", + "link": "" + } + ] }, { - "raw": "]", - "text": "]", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "]", + "text": "]" + } + ] + } ] `; @@ -249,37 +247,37 @@ exports[`decoration > Decoration with strong notation (it's just link) 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[* [[link]]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { - "raw": "[", - "text": "[", "type": "plain", + "raw": "[", + "text": "[" }, { - "content": "", - "href": "link", - "pathType": "relative", - "raw": "[link]", "type": "link", - }, - ], - "raw": "[* [[link]]", - "rawDecos": "*", - "type": "decoration", + "raw": "[link]", + "pathType": "relative", + "href": "link", + "content": "" + } + ] }, { - "raw": "]", - "text": "]", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "]", + "text": "]" + } + ] + } ] `; @@ -287,633 +285,633 @@ exports[`decoration > Simple decoration 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[* deco]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[* deco]", - "rawDecos": "*", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[** deco]", + "rawDecos": "**", "decos": [ - "*-2", + "*-2" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[** deco]", - "rawDecos": "**", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[*** deco]", + "rawDecos": "***", "decos": [ - "*-3", + "*-3" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[*** deco]", - "rawDecos": "***", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[**** deco]", + "rawDecos": "****", "decos": [ - "*-4", + "*-4" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[**** deco]", - "rawDecos": "****", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[***** deco]", + "rawDecos": "*****", "decos": [ - "*-5", + "*-5" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[***** deco]", - "rawDecos": "*****", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[****** deco]", + "rawDecos": "******", "decos": [ - "*-6", + "*-6" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[****** deco]", - "rawDecos": "******", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[******* deco]", + "rawDecos": "*******", "decos": [ - "*-7", + "*-7" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[******* deco]", - "rawDecos": "*******", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[******** deco]", + "rawDecos": "********", "decos": [ - "*-8", + "*-8" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[******** deco]", - "rawDecos": "********", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[********* deco]", + "rawDecos": "*********", "decos": [ - "*-9", + "*-9" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[********* deco]", - "rawDecos": "*********", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[********** deco]", + "rawDecos": "**********", "decos": [ - "*-10", + "*-10" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[********** deco]", - "rawDecos": "**********", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[! deco]", + "rawDecos": "!", "decos": [ - "!", + "!" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[! deco]", - "rawDecos": "!", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[\\" deco]", + "rawDecos": "\\"", "decos": [ - """, + "\\"" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[" deco]", - "rawDecos": """, - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[# deco]", + "rawDecos": "#", "decos": [ - "#", + "#" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[# deco]", - "rawDecos": "#", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[% deco]", + "rawDecos": "%", "decos": [ - "%", + "%" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[% deco]", - "rawDecos": "%", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[& deco]", + "rawDecos": "&", "decos": [ - "&", + "&" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[& deco]", - "rawDecos": "&", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[' deco]", + "rawDecos": "'", "decos": [ - "'", + "'" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[' deco]", - "rawDecos": "'", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[( deco]", + "rawDecos": "(", "decos": [ - "(", + "(" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[( deco]", - "rawDecos": "(", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[) deco]", + "rawDecos": ")", "decos": [ - ")", + ")" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[) deco]", - "rawDecos": ")", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[+ deco]", + "rawDecos": "+", "decos": [ - "+", + "+" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[+ deco]", - "rawDecos": "+", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[, deco]", + "rawDecos": ",", "decos": [ - ",", + "," ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[, deco]", - "rawDecos": ",", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[- deco]", + "rawDecos": "-", "decos": [ - "-", + "-" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[- deco]", - "rawDecos": "-", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[. deco]", + "rawDecos": ".", "decos": [ - ".", + "." ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[. deco]", - "rawDecos": ".", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[/ deco]", + "rawDecos": "/", "decos": [ - "/", + "/" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[/ deco]", - "rawDecos": "/", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[{ deco]", + "rawDecos": "{", "decos": [ - "{", + "{" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[{ deco]", - "rawDecos": "{", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[| deco]", + "rawDecos": "|", "decos": [ - "|", + "|" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[| deco]", - "rawDecos": "|", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[} deco]", + "rawDecos": "}", "decos": [ - "}", + "}" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[} deco]", - "rawDecos": "}", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[< deco]", + "rawDecos": "<", "decos": [ - "<", + "<" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[< deco]", - "rawDecos": "<", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[> deco]", + "rawDecos": ">", "decos": [ - ">", + ">" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[> deco]", - "rawDecos": ">", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[_ deco]", + "rawDecos": "_", "decos": [ - "_", + "_" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[_ deco]", - "rawDecos": "_", - "type": "decoration", - }, - ], - "type": "line", + "raw": "deco", + "text": "deco" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[~ deco]", + "rawDecos": "~", "decos": [ - "~", + "~" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[~ deco]", - "rawDecos": "~", - "type": "decoration", - }, - ], - "type": "line", - }, + "raw": "deco", + "text": "deco" + } + ] + } + ] + } ] `; diff --git a/test/line/formula.test.ts b/test/line/formula.test.ts new file mode 100644 index 00000000..b7842e9d --- /dev/null +++ b/test/line/formula.test.ts @@ -0,0 +1,20 @@ +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("formula", () => { + it("Simple formula", ({ assert }) => { + assert.snapshot( + parse("[$ \\frac{3}{2}^N]", { + hasTitle: false, + }), + ); + }); + + it("Formula includes [] with tail half-space", ({ assert }) => { + assert.snapshot(parse("[$ [x] ]", { hasTitle: false })); + }); + + it("Formula includes [] without tail half-space", ({ assert }) => { + assert.snapshot(parse("[$ [x]]", { hasTitle: false })); + }); +}); diff --git a/tests/line/__snapshots__/formula.test.ts.snap b/test/line/formula.test.ts.snapshot similarity index 68% rename from tests/line/__snapshots__/formula.test.ts.snap rename to test/line/formula.test.ts.snapshot index 6fe00f31..b20ba612 100644 --- a/tests/line/__snapshots__/formula.test.ts.snap +++ b/test/line/formula.test.ts.snapshot @@ -1,18 +1,16 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`formula > Formula includes [] with tail half-space 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "formula": "[x]", - "raw": "[$ [x] ]", "type": "formula", - }, - ], - "type": "line", - }, + "raw": "[$ [x] ]", + "formula": "[x]" + } + ] + } ] `; @@ -20,20 +18,20 @@ exports[`formula > Formula includes [] without tail half-space 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "formula": "[x", - "raw": "[$ [x]", "type": "formula", + "raw": "[$ [x]", + "formula": "[x" }, { - "raw": "]", - "text": "]", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "]", + "text": "]" + } + ] + } ] `; @@ -41,14 +39,14 @@ exports[`formula > Simple formula 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "formula": "\\frac{3}{2}^N", - "raw": "[$ \\frac{3}{2}^N]", "type": "formula", - }, - ], - "type": "line", - }, + "raw": "[$ \\\\frac{3}{2}^N]", + "formula": "\\\\frac{3}{2}^N" + } + ] + } ] `; diff --git a/tests/line/googleMap.test.ts b/test/line/googleMap.test.ts similarity index 52% rename from tests/line/googleMap.test.ts rename to test/line/googleMap.test.ts index f23f6a1d..e70e0441 100644 --- a/tests/line/googleMap.test.ts +++ b/test/line/googleMap.test.ts @@ -1,44 +1,44 @@ -import { describe, expect, it } from "vitest"; +import { describe, it } from "node:test"; import { parse } from "../../src/index.ts"; describe("googleMap", () => { - it("Simple google map with NE", () => { - expect( + it("Simple google map with NE", ({ assert }) => { + assert.snapshot( parse("[N35.6812362,E139.7649361]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); - it("Simple google map with SW", () => { - expect( + it("Simple google map with SW", ({ assert }) => { + assert.snapshot( parse("[S13.70533,W69.6533372]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); - it("Simple google map with zoom", () => { - expect( + it("Simple google map with zoom", ({ assert }) => { + assert.snapshot( parse("[N35.6812362,E139.7649361,Z14]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); - it("Simple google map with place on left", () => { - expect( + it("Simple google map with place on left", ({ assert }) => { + assert.snapshot( parse("[東京駅 N35.6812362,E139.7649361,Z14]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); - it("Simple google map with place on right", () => { - expect( + it("Simple google map with place on right", ({ assert }) => { + assert.snapshot( parse("[N35.6812362,E139.7649361,Z14 東京駅]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); }); diff --git a/tests/line/__snapshots__/googleMap.test.ts.snap b/test/line/googleMap.test.ts.snapshot similarity index 87% rename from tests/line/__snapshots__/googleMap.test.ts.snap rename to test/line/googleMap.test.ts.snapshot index e062b261..3ee17d74 100644 --- a/tests/line/__snapshots__/googleMap.test.ts.snap +++ b/test/line/googleMap.test.ts.snapshot @@ -1,22 +1,20 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`googleMap > Simple google map with NE 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "googleMap", + "raw": "[N35.6812362,E139.7649361]", "latitude": 35.6812362, "longitude": 139.7649361, - "place": "", - "raw": "[N35.6812362,E139.7649361]", - "type": "googleMap", - "url": "https://www.google.com/maps/@35.6812362,139.7649361,14z", "zoom": 14, - }, - ], - "type": "line", - }, + "place": "", + "url": "https://www.google.com/maps/@35.6812362,139.7649361,14z" + } + ] + } ] `; @@ -24,19 +22,19 @@ exports[`googleMap > Simple google map with SW 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "googleMap", + "raw": "[S13.70533,W69.6533372]", "latitude": -13.70533, "longitude": -69.6533372, - "place": "", - "raw": "[S13.70533,W69.6533372]", - "type": "googleMap", - "url": "https://www.google.com/maps/@-13.70533,-69.6533372,14z", "zoom": 14, - }, - ], - "type": "line", - }, + "place": "", + "url": "https://www.google.com/maps/@-13.70533,-69.6533372,14z" + } + ] + } ] `; @@ -44,19 +42,19 @@ exports[`googleMap > Simple google map with place on left 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "googleMap", + "raw": "[東京駅 N35.6812362,E139.7649361,Z14]", "latitude": 35.6812362, "longitude": 139.7649361, - "place": "東京駅", - "raw": "[東京駅 N35.6812362,E139.7649361,Z14]", - "type": "googleMap", - "url": "https://www.google.com/maps/place/%E6%9D%B1%E4%BA%AC%E9%A7%85/@35.6812362,139.7649361,14z", "zoom": 14, - }, - ], - "type": "line", - }, + "place": "東京駅", + "url": "https://www.google.com/maps/place/%E6%9D%B1%E4%BA%AC%E9%A7%85/@35.6812362,139.7649361,14z" + } + ] + } ] `; @@ -64,19 +62,19 @@ exports[`googleMap > Simple google map with place on right 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "googleMap", + "raw": "[N35.6812362,E139.7649361,Z14 東京駅]", "latitude": 35.6812362, "longitude": 139.7649361, - "place": "東京駅", - "raw": "[N35.6812362,E139.7649361,Z14 東京駅]", - "type": "googleMap", - "url": "https://www.google.com/maps/place/%E6%9D%B1%E4%BA%AC%E9%A7%85/@35.6812362,139.7649361,14z", "zoom": 14, - }, - ], - "type": "line", - }, + "place": "東京駅", + "url": "https://www.google.com/maps/place/%E6%9D%B1%E4%BA%AC%E9%A7%85/@35.6812362,139.7649361,14z" + } + ] + } ] `; @@ -84,18 +82,18 @@ exports[`googleMap > Simple google map with zoom 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "googleMap", + "raw": "[N35.6812362,E139.7649361,Z14]", "latitude": 35.6812362, "longitude": 139.7649361, - "place": "", - "raw": "[N35.6812362,E139.7649361,Z14]", - "type": "googleMap", - "url": "https://www.google.com/maps/@35.6812362,139.7649361,14z", "zoom": 14, - }, - ], - "type": "line", - }, + "place": "", + "url": "https://www.google.com/maps/@35.6812362,139.7649361,14z" + } + ] + } ] `; diff --git a/test/line/hashTag.test.ts b/test/line/hashTag.test.ts new file mode 100644 index 00000000..ed7951b6 --- /dev/null +++ b/test/line/hashTag.test.ts @@ -0,0 +1,28 @@ +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("hashTag", () => { + it("Simple hashTag", ({ assert }) => { + assert.snapshot(parse("#tag", { hasTitle: false })); + }); + + it("Only `#` is not hashTag", ({ assert }) => { + assert.snapshot(parse("#", { hasTitle: false })); + }); + + it("HashTag includes `#`", ({ assert }) => { + assert.snapshot(parse("#hash#Tag", { hasTitle: false })); + }); + + it("HashTag in sentence with spaces", ({ assert }) => { + assert.snapshot(parse("This is a #tag .", { hasTitle: false })); + }); + + it("HashTag in sentence without spaces is not hashTag", ({ assert }) => { + assert.snapshot(parse("→#notTag←", { hasTitle: false })); + }); + + it("Multiple hashTag", ({ assert }) => { + assert.snapshot(parse("#hoge #fuga #piyo", { hasTitle: false })); + }); +}); diff --git a/tests/line/__snapshots__/hashTag.test.ts.snap b/test/line/hashTag.test.ts.snapshot similarity index 75% rename from tests/line/__snapshots__/hashTag.test.ts.snap rename to test/line/hashTag.test.ts.snapshot index e36b7106..4bcb6926 100644 --- a/tests/line/__snapshots__/hashTag.test.ts.snap +++ b/test/line/hashTag.test.ts.snapshot @@ -1,33 +1,31 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`hashTag > HashTag in sentence with spaces 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "This is a", - "text": "This is a", "type": "plain", + "raw": "This is a", + "text": "This is a" }, { - "raw": " ", - "text": " ", "type": "plain", + "raw": " ", + "text": " " }, { - "href": "tag", - "raw": "#tag", "type": "hashTag", + "raw": "#tag", + "href": "tag" }, { - "raw": " .", - "text": " .", "type": "plain", - }, - ], - "type": "line", - }, + "raw": " .", + "text": " ." + } + ] + } ] `; @@ -35,15 +33,15 @@ exports[`hashTag > HashTag in sentence without spaces is not hashTag 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "→#notTag←", - "text": "→#notTag←", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "→#notTag←", + "text": "→#notTag←" + } + ] + } ] `; @@ -51,15 +49,15 @@ exports[`hashTag > HashTag includes \`#\` 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "href": "hash#Tag", - "raw": "#hash#Tag", "type": "hashTag", - }, - ], - "type": "line", - }, + "raw": "#hash#Tag", + "href": "hash#Tag" + } + ] + } ] `; @@ -67,35 +65,35 @@ exports[`hashTag > Multiple hashTag 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "href": "hoge", - "raw": "#hoge", "type": "hashTag", + "raw": "#hoge", + "href": "hoge" }, { - "raw": " ", - "text": " ", "type": "plain", + "raw": " ", + "text": " " }, { - "href": "fuga", - "raw": "#fuga", "type": "hashTag", + "raw": "#fuga", + "href": "fuga" }, { - "raw": " ", - "text": " ", "type": "plain", + "raw": " ", + "text": " " }, { - "href": "piyo", - "raw": "#piyo", "type": "hashTag", - }, - ], - "type": "line", - }, + "raw": "#piyo", + "href": "piyo" + } + ] + } ] `; @@ -103,15 +101,15 @@ exports[`hashTag > Only \`#\` is not hashTag 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "#", - "text": "#", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "#", + "text": "#" + } + ] + } ] `; @@ -119,14 +117,14 @@ exports[`hashTag > Simple hashTag 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "href": "tag", - "raw": "#tag", "type": "hashTag", - }, - ], - "type": "line", - }, + "raw": "#tag", + "href": "tag" + } + ] + } ] `; diff --git a/test/line/helpfeel.test.ts b/test/line/helpfeel.test.ts new file mode 100644 index 00000000..19a5f6bf --- /dev/null +++ b/test/line/helpfeel.test.ts @@ -0,0 +1,16 @@ +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("helpfeel", () => { + it("Simple helpfeel", ({ assert }) => { + assert.snapshot(parse("? Simple helpfeel", { hasTitle: false })); + }); + + it("No head `?` is not helpfeel", ({ assert }) => { + assert.snapshot(parse("a ? not helpfeel", { hasTitle: false })); + }); + + it("Quoted ? is not helpfeel", ({ assert }) => { + assert.snapshot(parse("> ? Quoted", { hasTitle: false })); + }); +}); diff --git a/tests/line/__snapshots__/helpfeel.test.ts.snap b/test/line/helpfeel.test.ts.snapshot similarity index 71% rename from tests/line/__snapshots__/helpfeel.test.ts.snap rename to test/line/helpfeel.test.ts.snapshot index be5b8eaf..8cb1814b 100644 --- a/tests/line/__snapshots__/helpfeel.test.ts.snap +++ b/test/line/helpfeel.test.ts.snapshot @@ -1,18 +1,16 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`helpfeel > No head \`?\` is not helpfeel 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "a ? not helpfeel", - "text": "a ? not helpfeel", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "a ? not helpfeel", + "text": "a ? not helpfeel" + } + ] + } ] `; @@ -20,21 +18,21 @@ exports[`helpfeel > Quoted ? is not helpfeel 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "quote", + "raw": "> ? Quoted", "nodes": [ { - "raw": " ? Quoted", - "text": " ? Quoted", "type": "plain", - }, - ], - "raw": "> ? Quoted", - "type": "quote", - }, - ], - "type": "line", - }, + "raw": " ? Quoted", + "text": " ? Quoted" + } + ] + } + ] + } ] `; @@ -42,14 +40,14 @@ exports[`helpfeel > Simple helpfeel 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "? Simple helpfeel", - "text": "Simple helpfeel", "type": "helpfeel", - }, - ], - "type": "line", - }, + "raw": "? Simple helpfeel", + "text": "Simple helpfeel" + } + ] + } ] `; diff --git a/test/line/icon.test.ts b/test/line/icon.test.ts new file mode 100644 index 00000000..45ab86be --- /dev/null +++ b/test/line/icon.test.ts @@ -0,0 +1,36 @@ +import { deepStrictEqual, strictEqual } from "node:assert/strict"; +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("icon", () => { + it("Simple root icon", ({ assert }) => { + assert.snapshot(parse("[/icons/+1.icon]", { hasTitle: false })); + }); + + it("Simple relative icon", ({ assert }) => { + assert.snapshot(parse("[me.icon]", { hasTitle: false })); + }); + + it("Multiple icons", ({ assert }) => { + assert.snapshot(parse("[me.icon*3]", { hasTitle: false })); + }); + + it("Icon and internal link on same line", ({ assert }) => { + assert.snapshot( + parse("[Internal link][me.icon]", { + hasTitle: false, + }), + ); + }); + + it("Each multiple icon must be different Object", () => { + const [block] = parse("[me.icon*2]", { hasTitle: false }); + + if (block === undefined || block.type !== "line") { + throw new Error("fail"); + } + + strictEqual(block.nodes.length, 2); + deepStrictEqual(block.nodes[0], block.nodes[1]); + }); +}); diff --git a/tests/line/__snapshots__/icon.test.ts.snap b/test/line/icon.test.ts.snapshot similarity index 76% rename from tests/line/__snapshots__/icon.test.ts.snap rename to test/line/icon.test.ts.snapshot index 561916b9..646193a4 100644 --- a/tests/line/__snapshots__/icon.test.ts.snap +++ b/test/line/icon.test.ts.snapshot @@ -1,26 +1,24 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`icon > Icon and internal link on same line 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "content": "", - "href": "Internal link", - "pathType": "relative", - "raw": "[Internal link]", "type": "link", + "raw": "[Internal link]", + "pathType": "relative", + "href": "Internal link", + "content": "" }, { "path": "me", "pathType": "relative", - "raw": "[me.icon]", "type": "icon", - }, - ], - "type": "line", - }, + "raw": "[me.icon]" + } + ] + } ] `; @@ -28,28 +26,28 @@ exports[`icon > Multiple icons 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { "path": "me", "pathType": "relative", - "raw": "[me.icon*3]", "type": "icon", + "raw": "[me.icon*3]" }, { "path": "me", "pathType": "relative", - "raw": "[me.icon*3]", "type": "icon", + "raw": "[me.icon*3]" }, { "path": "me", "pathType": "relative", - "raw": "[me.icon*3]", "type": "icon", - }, - ], - "type": "line", - }, + "raw": "[me.icon*3]" + } + ] + } ] `; @@ -57,16 +55,16 @@ exports[`icon > Simple relative icon 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { "path": "me", "pathType": "relative", - "raw": "[me.icon]", "type": "icon", - }, - ], - "type": "line", - }, + "raw": "[me.icon]" + } + ] + } ] `; @@ -74,15 +72,15 @@ exports[`icon > Simple root icon 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { "path": "/icons/+1", "pathType": "root", - "raw": "[/icons/+1.icon]", "type": "icon", - }, - ], - "type": "line", - }, + "raw": "[/icons/+1.icon]" + } + ] + } ] `; diff --git a/tests/line/image.test.ts b/test/line/image.test.ts similarity index 68% rename from tests/line/image.test.ts rename to test/line/image.test.ts index f960c5f8..7987c564 100644 --- a/tests/line/image.test.ts +++ b/test/line/image.test.ts @@ -1,9 +1,9 @@ -import { describe, expect, it } from "vitest"; +import { describe, it } from "node:test"; import { parse } from "../../src/index.ts"; describe("image", () => { - it("Simple image", () => { - expect( + it("Simple image", ({ assert }) => { + assert.snapshot( parse( ` [http://example.com/image.png] @@ -13,19 +13,19 @@ describe("image", () => { hasTitle: false, }, ), - ).toMatchSnapshot(); + ); }); - it("HTTP jpeg image with special and japanese chars", () => { - expect( + it("HTTP jpeg image with special and japanese chars", ({ assert }) => { + assert.snapshot( parse("[http://example.com/~!@#$%^&*()_+`-={}\\'\"?,.<>|/画像.jpeg]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); - it("HTTPS svg, GIF and WebP image with link", () => { - expect( + it("HTTPS svg, GIF and WebP image with link", ({ assert }) => { + assert.snapshot( parse( ` [https://example.com/image.svg https://example.com/] @@ -36,20 +36,20 @@ describe("image", () => { hasTitle: false, }, ), - ).toMatchSnapshot(); + ); }); - it("Image with double image link", () => { - expect( + it("Image with double image link", ({ assert }) => { + assert.snapshot( parse( "[https://example.com/forward.png https://example.com/backward.png]", { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); - it("Gyazo image", () => { - expect( + it("Gyazo image", ({ assert }) => { + assert.snapshot( parse( ` [https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815] @@ -58,11 +58,11 @@ describe("image", () => { `.trim(), { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); - it("Gyazo image with link", () => { - expect( + it("Gyazo image with link", ({ assert }) => { + assert.snapshot( parse( ` [https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815 https://example.com] @@ -71,22 +71,22 @@ describe("image", () => { `.trim(), { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); - it("Image with GET parameters", () => { - expect( + it("Image with GET parameters", ({ assert }) => { + assert.snapshot( parse("[http://example.com/image.png?key1=value1&key2=value2]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); - it("Direct Gyazo image", () => { - expect( + it("Direct Gyazo image", ({ assert }) => { + assert.snapshot( parse("[https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815.png]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); }); diff --git a/tests/line/__snapshots__/image.test.ts.snap b/test/line/image.test.ts.snapshot similarity index 80% rename from tests/line/__snapshots__/image.test.ts.snap rename to test/line/image.test.ts.snapshot index a11c9abd..8da8e7b8 100644 --- a/tests/line/__snapshots__/image.test.ts.snap +++ b/test/line/image.test.ts.snapshot @@ -1,19 +1,17 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`image > Direct Gyazo image 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "link": "", + "type": "image", "raw": "[https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815.png]", "src": "https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815.png", - "type": "image", - }, - ], - "type": "line", - }, + "link": "" + } + ] + } ] `; @@ -21,40 +19,40 @@ exports[`image > Gyazo image 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "link": "", + "type": "image", "raw": "[https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815]", "src": "https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815/thumb/1000", - "type": "image", - }, - ], - "type": "line", + "link": "" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "link": "", + "type": "image", "raw": "[https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815]", "src": "https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815/thumb/1000", - "type": "image", - }, - ], - "type": "line", + "link": "" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "link": "", + "type": "image", "raw": "[https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815/raw]", "src": "https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815/raw", - "type": "image", - }, - ], - "type": "line", - }, + "link": "" + } + ] + } ] `; @@ -62,40 +60,40 @@ exports[`image > Gyazo image with link 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "link": "https://example.com", + "type": "image", "raw": "[https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815 https://example.com]", "src": "https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815/thumb/1000", - "type": "image", - }, - ], - "type": "line", + "link": "https://example.com" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "link": "https://example.com", + "type": "image", "raw": "[https://example.com https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815]", "src": "https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815/thumb/1000", - "type": "image", - }, - ], - "type": "line", + "link": "https://example.com" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "link": "https://gyazo.com/7057219f5b20ca8afd122945b72453d3", + "type": "image", "raw": "[https://gyazo.com/7057219f5b20ca8afd122945b72453d3 https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815]", "src": "https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815/thumb/1000", - "type": "image", - }, - ], - "type": "line", - }, + "link": "https://gyazo.com/7057219f5b20ca8afd122945b72453d3" + } + ] + } ] `; @@ -103,16 +101,16 @@ exports[`image > HTTP jpeg image with special and japanese chars 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "link": "", - "raw": "[http://example.com/~!@#$%^&*()_+\`-={}\\'"?,.<>|/画像.jpeg]", - "src": "http://example.com/~!@#$%^&*()_+\`-={}\\'"?,.<>|/画像.jpeg", "type": "image", - }, - ], - "type": "line", - }, + "raw": "[http://example.com/~!@#$%^&*()_+\`-={}\\\\'\\"?,.<>|/画像.jpeg]", + "src": "http://example.com/~!@#$%^&*()_+\`-={}\\\\'\\"?,.<>|/画像.jpeg", + "link": "" + } + ] + } ] `; @@ -120,40 +118,40 @@ exports[`image > HTTPS svg, GIF and WebP image with link 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "link": "https://example.com/", + "type": "image", "raw": "[https://example.com/image.svg https://example.com/]", "src": "https://example.com/image.svg", - "type": "image", - }, - ], - "type": "line", + "link": "https://example.com/" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "link": "https://example.com/", + "type": "image", "raw": "[https://example.com/ https://example.com/image.GIF]", "src": "https://example.com/image.GIF", - "type": "image", - }, - ], - "type": "line", + "link": "https://example.com/" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "link": "https://example.com", + "type": "image", "raw": "[https://example.com/image.webp https://example.com]", "src": "https://example.com/image.webp", - "type": "image", - }, - ], - "type": "line", - }, + "link": "https://example.com" + } + ] + } ] `; @@ -161,16 +159,16 @@ exports[`image > Image with GET parameters 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "link": "", + "type": "image", "raw": "[http://example.com/image.png?key1=value1&key2=value2]", "src": "http://example.com/image.png?key1=value1&key2=value2", - "type": "image", - }, - ], - "type": "line", - }, + "link": "" + } + ] + } ] `; @@ -178,16 +176,16 @@ exports[`image > Image with double image link 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "link": "https://example.com/forward.png", + "type": "image", "raw": "[https://example.com/forward.png https://example.com/backward.png]", "src": "https://example.com/backward.png", - "type": "image", - }, - ], - "type": "line", - }, + "link": "https://example.com/forward.png" + } + ] + } ] `; @@ -195,27 +193,27 @@ exports[`image > Simple image 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "link": "", + "type": "image", "raw": "[http://example.com/image.png]", "src": "http://example.com/image.png", - "type": "image", - }, - ], - "type": "line", + "link": "" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "link": "", + "type": "image", "raw": "[https://example.com/image.JPG]", "src": "https://example.com/image.JPG", - "type": "image", - }, - ], - "type": "line", - }, + "link": "" + } + ] + } ] `; diff --git a/test/line/index.test.ts b/test/line/index.test.ts new file mode 100644 index 00000000..4bbf5e25 --- /dev/null +++ b/test/line/index.test.ts @@ -0,0 +1,28 @@ +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("line", () => { + it("Line that have multi node", ({ assert }) => { + assert.snapshot(parse("[Link][Link]", { hasTitle: false })); + }); + + it("Decoration line includes internal link", ({ assert }) => { + assert.snapshot(parse("[* [Link]]", { hasTitle: false })); + }); + + it("Decoration line includes external link", ({ assert }) => { + assert.snapshot( + parse("[* [https://example.com example]]", { + hasTitle: false, + }), + ); + }); + + it("Multi `]`", ({ assert }) => { + assert.snapshot( + parse("[* [Link]`code`[Link]]", { + hasTitle: false, + }), + ); + }); +}); diff --git a/tests/line/__snapshots__/index.test.ts.snap b/test/line/index.test.ts.snapshot similarity index 78% rename from tests/line/__snapshots__/index.test.ts.snap rename to test/line/index.test.ts.snapshot index dcd03b76..dfff208b 100644 --- a/tests/line/__snapshots__/index.test.ts.snap +++ b/test/line/index.test.ts.snapshot @@ -1,30 +1,28 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`line > Decoration line includes external link 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[* [https://example.com example]]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { - "content": "example", - "href": "https://example.com", - "pathType": "absolute", - "raw": "[https://example.com example]", "type": "link", - }, - ], - "raw": "[* [https://example.com example]]", - "rawDecos": "*", - "type": "decoration", - }, - ], - "type": "line", - }, + "raw": "[https://example.com example]", + "pathType": "absolute", + "href": "https://example.com", + "content": "example" + } + ] + } + ] + } ] `; @@ -32,27 +30,27 @@ exports[`line > Decoration line includes internal link 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[* [Link]]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { - "content": "", - "href": "Link", - "pathType": "relative", - "raw": "[Link]", "type": "link", - }, - ], - "raw": "[* [Link]]", - "rawDecos": "*", - "type": "decoration", - }, - ], - "type": "line", - }, + "raw": "[Link]", + "pathType": "relative", + "href": "Link", + "content": "" + } + ] + } + ] + } ] `; @@ -60,24 +58,24 @@ exports[`line > Line that have multi node 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "content": "", - "href": "Link", - "pathType": "relative", - "raw": "[Link]", "type": "link", + "raw": "[Link]", + "pathType": "relative", + "href": "Link", + "content": "" }, { - "content": "", - "href": "Link", - "pathType": "relative", - "raw": "[Link]", "type": "link", - }, - ], - "type": "line", - }, + "raw": "[Link]", + "pathType": "relative", + "href": "Link", + "content": "" + } + ] + } ] `; @@ -85,41 +83,41 @@ exports[`line > Multi \`]\` 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[* [Link]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { - "raw": "[Link", - "text": "[Link", "type": "plain", - }, - ], - "raw": "[* [Link]", - "rawDecos": "*", - "type": "decoration", + "raw": "[Link", + "text": "[Link" + } + ] }, { - "raw": "\`code\`", - "text": "code", "type": "code", + "raw": "\`code\`", + "text": "code" }, { - "content": "", - "href": "Link", - "pathType": "relative", - "raw": "[Link]", "type": "link", + "raw": "[Link]", + "pathType": "relative", + "href": "Link", + "content": "" }, { - "raw": "]", - "text": "]", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "]", + "text": "]" + } + ] + } ] `; diff --git a/test/line/link.test.ts b/test/line/link.test.ts new file mode 100644 index 00000000..85beda64 --- /dev/null +++ b/test/line/link.test.ts @@ -0,0 +1,77 @@ +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("link", () => { + it("Simple absolute link", ({ assert }) => { + assert.snapshot( + parse("https://example.com/", { + hasTitle: false, + }), + ); + }); + + it("Simple absolute link with ahead non-space character", ({ assert }) => { + assert.snapshot( + parse("ahttps://example.com/", { + hasTitle: false, + }), + ); + }); + + it("Simple absolute link with bracket", ({ assert }) => { + assert.snapshot( + parse("[https://example.com/]", { + hasTitle: false, + }), + ); + }); + + it("Simple root link", ({ assert }) => { + assert.snapshot(parse("[/project/page]", { hasTitle: false })); + }); + + it("Simple relative link", ({ assert }) => { + assert.snapshot(parse("[page]", { hasTitle: false })); + }); + + it("Link with content", ({ assert }) => { + assert.snapshot( + parse( + ` +[https://example.com/ Example] +[Example https://example.com/] +[https://left.com/ center https://right.com/] +`.trim(), + { + hasTitle: false, + }, + ), + ); + }); + + it("Root and relative link path can include space", ({ assert }) => { + assert.snapshot( + parse( + ` +[page name] +[/project/page name] +`.trim(), + { hasTitle: false }, + ), + ); + }); + + it("Link with link", ({ assert }) => { + assert.snapshot( + parse("[https://example.com https://example.com]", { hasTitle: false }), + ); + }); + + it("Link with GET parameters", ({ assert }) => { + assert.snapshot( + parse("[http://example.com?key1=value1&key2=value2]", { + hasTitle: false, + }), + ); + }); +}); diff --git a/tests/line/__snapshots__/link.test.ts.snap b/test/line/link.test.ts.snapshot similarity index 82% rename from tests/line/__snapshots__/link.test.ts.snap rename to test/line/link.test.ts.snapshot index 6561989d..54c72c49 100644 --- a/tests/line/__snapshots__/link.test.ts.snap +++ b/test/line/link.test.ts.snapshot @@ -1,20 +1,18 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`link > Link with GET parameters 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "content": "", - "href": "http://example.com?key1=value1&key2=value2", - "pathType": "absolute", - "raw": "[http://example.com?key1=value1&key2=value2]", "type": "link", - }, - ], - "type": "line", - }, + "raw": "[http://example.com?key1=value1&key2=value2]", + "pathType": "absolute", + "href": "http://example.com?key1=value1&key2=value2", + "content": "" + } + ] + } ] `; @@ -22,43 +20,43 @@ exports[`link > Link with content 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "content": "Example", - "href": "https://example.com/", - "pathType": "absolute", - "raw": "[https://example.com/ Example]", "type": "link", - }, - ], - "type": "line", + "raw": "[https://example.com/ Example]", + "pathType": "absolute", + "href": "https://example.com/", + "content": "Example" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "content": "Example", - "href": "https://example.com/", - "pathType": "absolute", - "raw": "[Example https://example.com/]", "type": "link", - }, - ], - "type": "line", + "raw": "[Example https://example.com/]", + "pathType": "absolute", + "href": "https://example.com/", + "content": "Example" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "content": "center https://right.com/", - "href": "https://left.com/", - "pathType": "absolute", - "raw": "[https://left.com/ center https://right.com/]", "type": "link", - }, - ], - "type": "line", - }, + "raw": "[https://left.com/ center https://right.com/]", + "pathType": "absolute", + "href": "https://left.com/", + "content": "center https://right.com/" + } + ] + } ] `; @@ -66,17 +64,17 @@ exports[`link > Link with link 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "content": "https://example.com", - "href": "https://example.com", - "pathType": "absolute", - "raw": "[https://example.com https://example.com]", "type": "link", - }, - ], - "type": "line", - }, + "raw": "[https://example.com https://example.com]", + "pathType": "absolute", + "href": "https://example.com", + "content": "https://example.com" + } + ] + } ] `; @@ -84,30 +82,30 @@ exports[`link > Root and relative link path can include space 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "content": "", - "href": "page name", - "pathType": "relative", - "raw": "[page name]", "type": "link", - }, - ], - "type": "line", + "raw": "[page name]", + "pathType": "relative", + "href": "page name", + "content": "" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "content": "", - "href": "/project/page name", - "pathType": "root", - "raw": "[/project/page name]", "type": "link", - }, - ], - "type": "line", - }, + "raw": "[/project/page name]", + "pathType": "root", + "href": "/project/page name", + "content": "" + } + ] + } ] `; @@ -115,17 +113,17 @@ exports[`link > Simple absolute link 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "content": "", - "href": "https://example.com/", - "pathType": "absolute", - "raw": "https://example.com/", "type": "link", - }, - ], - "type": "line", - }, + "raw": "https://example.com/", + "pathType": "absolute", + "href": "https://example.com/", + "content": "" + } + ] + } ] `; @@ -133,22 +131,22 @@ exports[`link > Simple absolute link with ahead non-space character 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "a", - "text": "a", "type": "plain", + "raw": "a", + "text": "a" }, { - "content": "", - "href": "https://example.com/", - "pathType": "absolute", - "raw": "https://example.com/", "type": "link", - }, - ], - "type": "line", - }, + "raw": "https://example.com/", + "pathType": "absolute", + "href": "https://example.com/", + "content": "" + } + ] + } ] `; @@ -156,17 +154,17 @@ exports[`link > Simple absolute link with bracket 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "content": "", - "href": "https://example.com/", - "pathType": "absolute", - "raw": "[https://example.com/]", "type": "link", - }, - ], - "type": "line", - }, + "raw": "[https://example.com/]", + "pathType": "absolute", + "href": "https://example.com/", + "content": "" + } + ] + } ] `; @@ -174,17 +172,17 @@ exports[`link > Simple relative link 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "content": "", - "href": "page", - "pathType": "relative", - "raw": "[page]", "type": "link", - }, - ], - "type": "line", - }, + "raw": "[page]", + "pathType": "relative", + "href": "page", + "content": "" + } + ] + } ] `; @@ -192,16 +190,16 @@ exports[`link > Simple root link 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "content": "", - "href": "/project/page", - "pathType": "root", - "raw": "[/project/page]", "type": "link", - }, - ], - "type": "line", - }, + "raw": "[/project/page]", + "pathType": "root", + "href": "/project/page", + "content": "" + } + ] + } ] `; diff --git a/test/line/numberList.test.ts b/test/line/numberList.test.ts new file mode 100644 index 00000000..2a0144b6 --- /dev/null +++ b/test/line/numberList.test.ts @@ -0,0 +1,56 @@ +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("numberList", () => { + it("Minimum numberList", ({ assert }) => { + assert.snapshot( + parse("1. ", { + hasTitle: false, + }), + ); + }); + + it("Simple numberList", ({ assert }) => { + assert.snapshot( + parse("1. Simple numberList", { + hasTitle: false, + }), + ); + }); + + it("1. with decoration", ({ assert }) => { + assert.snapshot( + parse("1. [* deco]", { + hasTitle: false, + }), + ); + }); + + it("1. with code", ({ assert }) => { + assert.snapshot( + parse("1. `code`", { + hasTitle: false, + }), + ); + }); + + it("1. with no space is not numberList", ({ assert }) => { + assert.snapshot( + parse("1.not numberList", { + hasTitle: false, + }), + ); + }); + + it("No head 1. is not numberList", ({ assert }) => { + assert.snapshot( + parse("a 1. not numberList", { + hasTitle: false, + }), + ); + }); + + it("Quoted 1. is not numberList", ({ assert }) => { + assert.snapshot(parse("> 1. Quoted", { hasTitle: false })); + }); +}); diff --git a/tests/line/__snapshots__/numberList.test.ts.snap b/test/line/numberList.test.ts.snapshot similarity index 77% rename from tests/line/__snapshots__/numberList.test.ts.snap rename to test/line/numberList.test.ts.snapshot index 99553ea1..180239a4 100644 --- a/tests/line/__snapshots__/numberList.test.ts.snap +++ b/test/line/numberList.test.ts.snapshot @@ -1,26 +1,24 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`numberList > 1. with code 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "numberList", + "raw": "1. \`code\`", + "rawNumber": "1", + "number": 1, "nodes": [ { - "raw": "\`code\`", - "text": "code", "type": "code", - }, - ], - "number": 1, - "raw": "1. \`code\`", - "rawNumber": "1", - "type": "numberList", - }, - ], - "type": "line", - }, + "raw": "\`code\`", + "text": "code" + } + ] + } + ] + } ] `; @@ -28,33 +26,33 @@ exports[`numberList > 1. with decoration 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "numberList", + "raw": "1. [* deco]", + "rawNumber": "1", + "number": 1, "nodes": [ { + "type": "decoration", + "raw": "[* deco]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[* deco]", - "rawDecos": "*", - "type": "decoration", - }, - ], - "number": 1, - "raw": "1. [* deco]", - "rawNumber": "1", - "type": "numberList", - }, - ], - "type": "line", - }, + "raw": "deco", + "text": "deco" + } + ] + } + ] + } + ] + } ] `; @@ -62,15 +60,15 @@ exports[`numberList > 1. with no space is not numberList 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "1.not numberList", - "text": "1.not numberList", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "1.not numberList", + "text": "1.not numberList" + } + ] + } ] `; @@ -78,17 +76,17 @@ exports[`numberList > Minimum numberList 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "nodes": [], - "number": 1, + "type": "numberList", "raw": "1. ", "rawNumber": "1", - "type": "numberList", - }, - ], - "type": "line", - }, + "number": 1, + "nodes": [] + } + ] + } ] `; @@ -96,15 +94,15 @@ exports[`numberList > No head 1. is not numberList 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "a 1. not numberList", - "text": "a 1. not numberList", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "a 1. not numberList", + "text": "a 1. not numberList" + } + ] + } ] `; @@ -112,21 +110,21 @@ exports[`numberList > Quoted 1. is not numberList 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "quote", + "raw": "> 1. Quoted", "nodes": [ { - "raw": " 1. Quoted", - "text": " 1. Quoted", "type": "plain", - }, - ], - "raw": "> 1. Quoted", - "type": "quote", - }, - ], - "type": "line", - }, + "raw": " 1. Quoted", + "text": " 1. Quoted" + } + ] + } + ] + } ] `; @@ -134,22 +132,22 @@ exports[`numberList > Simple numberList 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "numberList", + "raw": "1. Simple numberList", + "rawNumber": "1", + "number": 1, "nodes": [ { - "raw": "Simple numberList", - "text": "Simple numberList", "type": "plain", - }, - ], - "number": 1, - "raw": "1. Simple numberList", - "rawNumber": "1", - "type": "numberList", - }, - ], - "type": "line", - }, + "raw": "Simple numberList", + "text": "Simple numberList" + } + ] + } + ] + } ] `; diff --git a/test/line/plain.test.ts b/test/line/plain.test.ts new file mode 100644 index 00000000..3facb625 --- /dev/null +++ b/test/line/plain.test.ts @@ -0,0 +1,16 @@ +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("plain", () => { + it("Simple plain text", ({ assert }) => { + assert.snapshot(parse("Plain text", { hasTitle: false })); + }); + + it("Blank line", ({ assert }) => { + assert.snapshot(parse("", { hasTitle: false })); + }); + + it("Keep tail space", ({ assert }) => { + assert.snapshot(parse("Tail space -> ", { hasTitle: false })); + }); +}); diff --git a/tests/line/__snapshots__/plain.test.ts.snap b/test/line/plain.test.ts.snapshot similarity index 68% rename from tests/line/__snapshots__/plain.test.ts.snap rename to test/line/plain.test.ts.snapshot index 3c2fc918..303fb350 100644 --- a/tests/line/__snapshots__/plain.test.ts.snap +++ b/test/line/plain.test.ts.snapshot @@ -1,12 +1,10 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`plain > Blank line 1`] = ` [ { "indent": 0, - "nodes": [], "type": "line", - }, + "nodes": [] + } ] `; @@ -14,15 +12,15 @@ exports[`plain > Keep tail space 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "Tail space -> ", - "text": "Tail space -> ", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "Tail space -> ", + "text": "Tail space -> " + } + ] + } ] `; @@ -30,14 +28,14 @@ exports[`plain > Simple plain text 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "Plain text", - "text": "Plain text", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "Plain text", + "text": "Plain text" + } + ] + } ] `; diff --git a/test/line/quote.test.ts b/test/line/quote.test.ts new file mode 100644 index 00000000..2fae0f08 --- /dev/null +++ b/test/line/quote.test.ts @@ -0,0 +1,12 @@ +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("quote", () => { + it("Simple quote", ({ assert }) => { + assert.snapshot(parse("> Simple quote", { hasTitle: false })); + }); + + it("Empty quote", ({ assert }) => { + assert.snapshot(parse(">", { hasTitle: false })); + }); +}); diff --git a/tests/line/__snapshots__/quote.test.ts.snap b/test/line/quote.test.ts.snapshot similarity index 69% rename from tests/line/__snapshots__/quote.test.ts.snap rename to test/line/quote.test.ts.snapshot index 4da88c37..f2ef9415 100644 --- a/tests/line/__snapshots__/quote.test.ts.snap +++ b/test/line/quote.test.ts.snapshot @@ -1,18 +1,16 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`quote > Empty quote 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "nodes": [], - "raw": ">", "type": "quote", - }, - ], - "type": "line", - }, + "raw": ">", + "nodes": [] + } + ] + } ] `; @@ -20,20 +18,20 @@ exports[`quote > Simple quote 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "quote", + "raw": "> Simple quote", "nodes": [ { - "raw": " Simple quote", - "text": " Simple quote", "type": "plain", - }, - ], - "raw": "> Simple quote", - "type": "quote", - }, - ], - "type": "line", - }, + "raw": " Simple quote", + "text": " Simple quote" + } + ] + } + ] + } ] `; diff --git a/test/line/strong.test.ts b/test/line/strong.test.ts new file mode 100644 index 00000000..7e81f95f --- /dev/null +++ b/test/line/strong.test.ts @@ -0,0 +1,16 @@ +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("strong", () => { + it("Simple strong", ({ assert }) => { + assert.snapshot(parse("[[Simple strong]]", { hasTitle: false })); + }); + + it("[[]] is not strong", ({ assert }) => { + assert.snapshot(parse("[[]]", { hasTitle: false })); + }); + + it("Decoration in Strong notation", ({ assert }) => { + assert.snapshot(parse("[[[! deco]]]", { hasTitle: false })); + }); +}); diff --git a/tests/line/__snapshots__/strong.test.ts.snap b/test/line/strong.test.ts.snapshot similarity index 73% rename from tests/line/__snapshots__/strong.test.ts.snap rename to test/line/strong.test.ts.snapshot index ce24c593..574549cd 100644 --- a/tests/line/__snapshots__/strong.test.ts.snap +++ b/test/line/strong.test.ts.snapshot @@ -1,54 +1,36 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - -exports[`strong > [[]] is not strong 1`] = ` -[ - { - "indent": 0, - "nodes": [ - { - "raw": "[[]]", - "text": "[[]]", - "type": "plain", - }, - ], - "type": "line", - }, -] -`; - exports[`strong > Decoration in Strong notation 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[[", - "text": "[[", "type": "plain", + "raw": "[[", + "text": "[[" }, { + "type": "decoration", + "raw": "[! deco]", + "rawDecos": "!", "decos": [ - "!", + "!" ], "nodes": [ { - "raw": "deco", - "text": "deco", "type": "plain", - }, - ], - "raw": "[! deco]", - "rawDecos": "!", - "type": "decoration", + "raw": "deco", + "text": "deco" + } + ] }, { - "raw": "]]", - "text": "]]", "type": "plain", - }, - ], - "type": "line", - }, + "raw": "]]", + "text": "]]" + } + ] + } ] `; @@ -56,20 +38,36 @@ exports[`strong > Simple strong 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[Simple strong]]", "nodes": [ { - "raw": "Simple strong", - "text": "Simple strong", "type": "plain", - }, - ], - "raw": "[[Simple strong]]", - "type": "strong", - }, - ], + "raw": "Simple strong", + "text": "Simple strong" + } + ] + } + ] + } +] +`; + +exports[`strong > [[]] is not strong 1`] = ` +[ + { + "indent": 0, "type": "line", - }, + "nodes": [ + { + "type": "plain", + "raw": "[[]]", + "text": "[[]]" + } + ] + } ] `; diff --git a/test/line/strongIcon.test.ts b/test/line/strongIcon.test.ts new file mode 100644 index 00000000..b7b72d5c --- /dev/null +++ b/test/line/strongIcon.test.ts @@ -0,0 +1,39 @@ +import { deepStrictEqual } from "node:assert/strict"; +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("strongIcon", () => { + it("Simple root strong icon", ({ assert }) => { + assert.snapshot( + parse("[[/icons/+1.icon]]", { + hasTitle: false, + }), + ); + }); + + it("Simple relative strong icon", ({ assert }) => { + assert.snapshot(parse("[[me.icon]]", { hasTitle: false })); + }); + + it("Multiple icons", ({ assert }) => { + assert.snapshot(parse("[[me.icon*3]]", { hasTitle: false })); + }); + + it("Strong icon and internal link on same line", ({ assert }) => { + assert.snapshot( + parse("[Internal link][[me.icon]]", { + hasTitle: false, + }), + ); + }); + + it("Each multiple strong icon must be different Object", ({ assert }) => { + const [block] = parse("[[me.icon*2]]", { hasTitle: false }); + if (block === undefined || block.type !== "line") { + throw new Error("fail"); + } + + assert.equal(block.nodes.length, 2); + deepStrictEqual(block.nodes[0], block.nodes[1]); + }); +}); diff --git a/tests/line/__snapshots__/strongIcon.test.ts.snap b/test/line/strongIcon.test.ts.snapshot similarity index 76% rename from tests/line/__snapshots__/strongIcon.test.ts.snap rename to test/line/strongIcon.test.ts.snapshot index c0c50591..145e647c 100644 --- a/tests/line/__snapshots__/strongIcon.test.ts.snap +++ b/test/line/strongIcon.test.ts.snapshot @@ -1,31 +1,29 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`strongIcon > Multiple icons 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { "path": "me", "pathType": "relative", - "raw": "[[me.icon*3]]", "type": "strongIcon", + "raw": "[[me.icon*3]]" }, { "path": "me", "pathType": "relative", - "raw": "[[me.icon*3]]", "type": "strongIcon", + "raw": "[[me.icon*3]]" }, { "path": "me", "pathType": "relative", - "raw": "[[me.icon*3]]", "type": "strongIcon", - }, - ], - "type": "line", - }, + "raw": "[[me.icon*3]]" + } + ] + } ] `; @@ -33,16 +31,16 @@ exports[`strongIcon > Simple relative strong icon 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { "path": "me", "pathType": "relative", - "raw": "[[me.icon]]", "type": "strongIcon", - }, - ], - "type": "line", - }, + "raw": "[[me.icon]]" + } + ] + } ] `; @@ -50,16 +48,16 @@ exports[`strongIcon > Simple root strong icon 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { "path": "/icons/+1", "pathType": "root", - "raw": "[[/icons/+1.icon]]", "type": "strongIcon", - }, - ], - "type": "line", - }, + "raw": "[[/icons/+1.icon]]" + } + ] + } ] `; @@ -67,22 +65,22 @@ exports[`strongIcon > Strong icon and internal link on same line 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "content": "", - "href": "Internal link", - "pathType": "relative", - "raw": "[Internal link]", "type": "link", + "raw": "[Internal link]", + "pathType": "relative", + "href": "Internal link", + "content": "" }, { "path": "me", "pathType": "relative", - "raw": "[[me.icon]]", "type": "strongIcon", - }, - ], - "type": "line", - }, + "raw": "[[me.icon]]" + } + ] + } ] `; diff --git a/tests/line/strongImage.test.ts b/test/line/strongImage.test.ts similarity index 65% rename from tests/line/strongImage.test.ts rename to test/line/strongImage.test.ts index c9a9213f..13cbfd85 100644 --- a/tests/line/strongImage.test.ts +++ b/test/line/strongImage.test.ts @@ -1,9 +1,9 @@ -import { describe, expect, it } from "vitest"; +import { describe, it } from "node:test"; import { parse } from "../../src/index.ts"; describe("strongImage", () => { - it("Simple strong image", () => { - expect( + it("Simple strong image", ({ assert }) => { + assert.snapshot( parse( ` [[http://example.com/image.png]] @@ -16,30 +16,30 @@ describe("strongImage", () => { hasTitle: false, }, ), - ).toMatchSnapshot(); + ); }); - it("HTTP jpeg strong image with special and japanese chars", () => { - expect( + it("HTTP jpeg strong image with special and japanese chars", ({ assert }) => { + assert.snapshot( parse("[[http://example.com/~!@#$%^&*()_+`-={}\\'\"?,.<>|/画像.jpeg]]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); - it("Gyazo image", () => { - expect( + it("Gyazo image", ({ assert }) => { + assert.snapshot( parse("[[https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815]]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); - it("Direct Gyazo image", () => { - expect( + it("Direct Gyazo image", ({ assert }) => { + assert.snapshot( parse("[[https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815.png]]", { hasTitle: false, }), - ).toMatchSnapshot(); + ); }); }); diff --git a/tests/line/__snapshots__/strongImage.test.ts.snap b/test/line/strongImage.test.ts.snapshot similarity index 71% rename from tests/line/__snapshots__/strongImage.test.ts.snap rename to test/line/strongImage.test.ts.snapshot index e5f79e01..e613628f 100644 --- a/tests/line/__snapshots__/strongImage.test.ts.snap +++ b/test/line/strongImage.test.ts.snapshot @@ -1,18 +1,16 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`strongImage > Direct Gyazo image 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[[https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815.png]]", - "src": "https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815.png", "type": "strongImage", - }, - ], - "type": "line", - }, + "raw": "[[https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815.png]]", + "src": "https://i.gyazo.com/0f82099330f378fe4917a1b4a5fe8815.png" + } + ] + } ] `; @@ -20,15 +18,15 @@ exports[`strongImage > Gyazo image 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[[https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815]]", - "src": "https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815/thumb/1000", "type": "strongImage", - }, - ], - "type": "line", - }, + "raw": "[[https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815]]", + "src": "https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815/thumb/1000" + } + ] + } ] `; @@ -36,15 +34,15 @@ exports[`strongImage > HTTP jpeg strong image with special and japanese chars 1` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[[http://example.com/~!@#$%^&*()_+\`-={}\\'"?,.<>|/画像.jpeg]]", - "src": "http://example.com/~!@#$%^&*()_+\`-={}\\'"?,.<>|/画像.jpeg", "type": "strongImage", - }, - ], - "type": "line", - }, + "raw": "[[http://example.com/~!@#$%^&*()_+\`-={}\\\\'\\"?,.<>|/画像.jpeg]]", + "src": "http://example.com/~!@#$%^&*()_+\`-={}\\\\'\\"?,.<>|/画像.jpeg" + } + ] + } ] `; @@ -52,58 +50,58 @@ exports[`strongImage > Simple strong image 1`] = ` [ { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[[http://example.com/image.png]]", - "src": "http://example.com/image.png", "type": "strongImage", - }, - ], - "type": "line", + "raw": "[[http://example.com/image.png]]", + "src": "http://example.com/image.png" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[[https://example.com/image.JPG]]", - "src": "https://example.com/image.JPG", "type": "strongImage", - }, - ], - "type": "line", + "raw": "[[https://example.com/image.JPG]]", + "src": "https://example.com/image.JPG" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[[https://example.com/image.svg]]", - "src": "https://example.com/image.svg", "type": "strongImage", - }, - ], - "type": "line", + "raw": "[[https://example.com/image.svg]]", + "src": "https://example.com/image.svg" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[[https://example.com/image.GIF]]", - "src": "https://example.com/image.GIF", "type": "strongImage", - }, - ], - "type": "line", + "raw": "[[https://example.com/image.GIF]]", + "src": "https://example.com/image.GIF" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "raw": "[[https://example.com/image.webp]]", - "src": "https://example.com/image.webp", "type": "strongImage", - }, - ], - "type": "line", - }, + "raw": "[[https://example.com/image.webp]]", + "src": "https://example.com/image.webp" + } + ] + } ] `; diff --git a/test/page/index.test.ts b/test/page/index.test.ts new file mode 100644 index 00000000..388d7cb1 --- /dev/null +++ b/test/page/index.test.ts @@ -0,0 +1,23 @@ +import * as fs from "node:fs"; +import path from "node:path"; +import { describe, it } from "node:test"; +import { parse } from "../../src/index.ts"; + +describe("page", () => { + it("Empty page", ({ assert }) => { + const input = ""; + assert.snapshot(parse(input, { hasTitle: true })); + }); + + it("Title Block without `hasTitle` option", ({ assert }) => { + const input = "Title"; + assert.snapshot(parse(input)); + }); + + it("https://scrapbox.io/help/Syntax", ({ assert }) => { + const input = fs + .readFileSync(path.resolve(import.meta.dirname, "input.txt")) + .toString(); + assert.snapshot(parse(input, { hasTitle: true })); + }); +}); diff --git a/tests/page/__snapshots__/index.test.ts.snap b/test/page/index.test.ts.snapshot similarity index 76% rename from tests/page/__snapshots__/index.test.ts.snap rename to test/page/index.test.ts.snapshot index b1b6c923..d0f6f7e7 100644 --- a/tests/page/__snapshots__/index.test.ts.snap +++ b/test/page/index.test.ts.snapshot @@ -1,1269 +1,1263 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`page > Empty page 1`] = ` [ { - "text": "", "type": "title", - }, + "text": "" + } ] `; exports[`page > Title Block without \`hasTitle\` option 1`] = ` [ { - "text": "Title", "type": "title", - }, + "text": "Title" + } ] `; exports[`page > https://scrapbox.io/help/Syntax 1`] = ` [ { - "text": "Syntax", "type": "title", + "text": "Syntax" }, { "indent": 0, + "type": "line", "nodes": [ { - "link": "", + "type": "image", "raw": "[https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815]", "src": "https://gyazo.com/0f82099330f378fe4917a1b4a5fe8815/thumb/1000", - "type": "image", - }, - ], - "type": "line", + "link": "" + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[Internal Links]]", "nodes": [ { - "raw": "Internal Links", - "text": "Internal Links", "type": "plain", - }, - ], - "raw": "[[Internal Links]]", - "type": "strong", + "raw": "Internal Links", + "text": "Internal Links" + } + ] }, { - "raw": " (linking to another page on scrapbox)", - "text": " (linking to another page on scrapbox)", "type": "plain", - }, - ], - "type": "line", + "raw": " (linking to another page on scrapbox)", + "text": " (linking to another page on scrapbox)" + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "\`[link]\`", - "text": "[link]", "type": "code", + "raw": "\`[link]\`", + "text": "[link]" }, { - "raw": " ⇒ ", - "text": " ⇒ ", "type": "plain", + "raw": " ⇒ ", + "text": " ⇒ " }, { - "content": "", - "href": "Link", - "pathType": "relative", - "raw": "[Link]", "type": "link", - }, - ], - "type": "line", + "raw": "[Link]", + "pathType": "relative", + "href": "Link", + "content": "" + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[External Links]]", "nodes": [ { - "raw": "External Links", - "text": "External Links", "type": "plain", - }, - ], - "raw": "[[External Links]]", - "type": "strong", + "raw": "External Links", + "text": "External Links" + } + ] }, { - "raw": " (linking to another web page)", - "text": " (linking to another web page)", "type": "plain", - }, - ], - "type": "line", + "raw": " (linking to another web page)", + "text": " (linking to another web page)" + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "\`http://google.com\`", - "text": "http://google.com", "type": "code", + "raw": "\`http://google.com\`", + "text": "http://google.com" }, { - "raw": " ⇒ ", - "text": " ⇒ ", "type": "plain", + "raw": " ⇒ ", + "text": " ⇒ " }, { - "content": "", - "href": "http://google.com", - "pathType": "absolute", - "raw": "http://google.com", "type": "link", - }, - ], - "type": "line", + "raw": "http://google.com", + "pathType": "absolute", + "href": "http://google.com", + "content": "" + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "\`[http://google.com Google]\`", - "text": "[http://google.com Google]", "type": "code", + "raw": "\`[http://google.com Google]\`", + "text": "[http://google.com Google]" }, { - "raw": " ⇒ ", - "text": " ⇒ ", "type": "plain", + "raw": " ⇒ ", + "text": " ⇒ " }, { - "content": "Google", - "href": "http://google.com", - "pathType": "absolute", - "raw": "[http://google.com Google]", "type": "link", - }, - ], - "type": "line", + "raw": "[http://google.com Google]", + "pathType": "absolute", + "href": "http://google.com", + "content": "Google" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "raw": "or", - "text": "or", "type": "plain", - }, - ], - "type": "line", + "raw": "or", + "text": "or" + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "\`[Google http://google.com]\`", - "text": "[Google http://google.com]", "type": "code", + "raw": "\`[Google http://google.com]\`", + "text": "[Google http://google.com]" }, { - "raw": " ⇒ ", - "text": " ⇒ ", "type": "plain", + "raw": " ⇒ ", + "text": " ⇒ " }, { - "content": "Google", - "href": "http://google.com", - "pathType": "absolute", - "raw": "[Google http://google.com]", "type": "link", - }, - ], - "type": "line", + "raw": "[Google http://google.com]", + "pathType": "absolute", + "href": "http://google.com", + "content": "Google" + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[Images]]", "nodes": [ { - "raw": "Images", - "text": "Images", "type": "plain", - }, - ], - "raw": "[[Images]]", - "type": "strong", - }, - ], - "type": "line", + "raw": "Images", + "text": "Images" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "Direct image link ↓", - "text": "Direct image link ↓", "type": "plain", + "raw": "Direct image link ↓", + "text": "Direct image link ↓" }, { - "raw": "\`[https://gyazo.com/da78df293f9e83a74b5402411e2f2e01.png]\`", - "text": "[https://gyazo.com/da78df293f9e83a74b5402411e2f2e01.png]", "type": "code", - }, - ], - "type": "line", + "raw": "\`[https://gyazo.com/da78df293f9e83a74b5402411e2f2e01.png]\`", + "text": "[https://gyazo.com/da78df293f9e83a74b5402411e2f2e01.png]" + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "link": "", + "type": "image", "raw": "[https://i.gyazo.com/da78df293f9e83a74b5402411e2f2e01.png]", "src": "https://i.gyazo.com/da78df293f9e83a74b5402411e2f2e01.png", - "type": "image", - }, - ], - "type": "line", + "link": "" + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[Clickable Thumbnail Links]]", "nodes": [ { - "raw": "Clickable Thumbnail Links", - "text": "Clickable Thumbnail Links", "type": "plain", - }, - ], - "raw": "[[Clickable Thumbnail Links]]", - "type": "strong", - }, - ], - "type": "line", + "raw": "Clickable Thumbnail Links", + "text": "Clickable Thumbnail Links" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "↓ ", - "text": "↓ ", "type": "plain", + "raw": "↓ ", + "text": "↓ " }, { - "raw": "\`[http://cutedog.com https://i.gyazo.com/da78df293f9e83a74b5402411e2f2e01.png]\`", - "text": "[http://cutedog.com https://i.gyazo.com/da78df293f9e83a74b5402411e2f2e01.png]", "type": "code", + "raw": "\`[http://cutedog.com https://i.gyazo.com/da78df293f9e83a74b5402411e2f2e01.png]\`", + "text": "[http://cutedog.com https://i.gyazo.com/da78df293f9e83a74b5402411e2f2e01.png]" }, { - "raw": " ", - "text": " ", "type": "plain", - }, - ], - "type": "line", + "raw": " ", + "text": " " + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "link": "http://cutedog.com", + "type": "image", "raw": "[http://cutedog.com https://i.gyazo.com/da78df293f9e83a74b5402411e2f2e01.png]", "src": "https://i.gyazo.com/da78df293f9e83a74b5402411e2f2e01.png", - "type": "image", - }, - ], - "type": "line", + "link": "http://cutedog.com" + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "Adding the link at the end also works, as before:", - "text": "Adding the link at the end also works, as before:", "type": "plain", - }, - ], - "type": "line", + "raw": "Adding the link at the end also works, as before:", + "text": "Adding the link at the end also works, as before:" + } + ] }, { "indent": 2, + "type": "line", "nodes": [ { - "raw": "\`[https://i.gyazo.com/da78df293f9e83a74b5402411e2f2e01.png http://cutedog.com]\`", - "text": "[https://i.gyazo.com/da78df293f9e83a74b5402411e2f2e01.png http://cutedog.com]", "type": "code", - }, - ], - "type": "line", + "raw": "\`[https://i.gyazo.com/da78df293f9e83a74b5402411e2f2e01.png http://cutedog.com]\`", + "text": "[https://i.gyazo.com/da78df293f9e83a74b5402411e2f2e01.png http://cutedog.com]" + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[Linking to other scrapbox projects]]", "nodes": [ { - "raw": "Linking to other scrapbox projects", - "text": "Linking to other scrapbox projects", "type": "plain", - }, - ], - "raw": "[[Linking to other scrapbox projects]]", - "type": "strong", - }, - ], - "type": "line", + "raw": "Linking to other scrapbox projects", + "text": "Linking to other scrapbox projects" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "\`[/projectname/pagename]\`", - "text": "[/projectname/pagename]", "type": "code", + "raw": "\`[/projectname/pagename]\`", + "text": "[/projectname/pagename]" }, { - "raw": " ⇛ ", - "text": " ⇛ ", "type": "plain", + "raw": " ⇛ ", + "text": " ⇛ " }, { - "content": "", - "href": "/icons/check", - "pathType": "root", - "raw": "[/icons/check]", "type": "link", - }, - ], - "type": "line", + "raw": "[/icons/check]", + "pathType": "root", + "href": "/icons/check", + "content": "" + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "\`[/projectname]\`", - "text": "[/projectname]", "type": "code", + "raw": "\`[/projectname]\`", + "text": "[/projectname]" }, { - "raw": " ⇛ ", - "text": " ⇛ ", "type": "plain", + "raw": " ⇛ ", + "text": " ⇛ " }, { - "content": "", - "href": "/icons", - "pathType": "root", - "raw": "[/icons]", "type": "link", - }, - ], - "type": "line", + "raw": "[/icons]", + "pathType": "root", + "href": "/icons", + "content": "" + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[Icons]]", "nodes": [ { - "raw": "Icons", - "text": "Icons", "type": "plain", - }, - ], - "raw": "[[Icons]]", - "type": "strong", - }, - ], - "type": "line", + "raw": "Icons", + "text": "Icons" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "\`[ben.icon]\`", - "text": "[ben.icon]", "type": "code", + "raw": "\`[ben.icon]\`", + "text": "[ben.icon]" }, { - "raw": " ⇛ ", - "text": " ⇛ ", "type": "plain", + "raw": " ⇛ ", + "text": " ⇛ " }, { "path": "ben", "pathType": "relative", - "raw": "[ben.icon]", "type": "icon", - }, - ], - "type": "line", + "raw": "[ben.icon]" + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "\`[/icons/todo.icon]\`", - "text": "[/icons/todo.icon]", "type": "code", + "raw": "\`[/icons/todo.icon]\`", + "text": "[/icons/todo.icon]" }, { - "raw": " ⇛ ", - "text": " ⇛ ", "type": "plain", + "raw": " ⇛ ", + "text": " ⇛ " }, { "path": "/icons/todo", "pathType": "root", - "raw": "[/icons/todo.icon]", "type": "icon", - }, - ], - "type": "line", + "raw": "[/icons/todo.icon]" + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[Bold text]]", "nodes": [ { - "raw": "Bold text", - "text": "Bold text", "type": "plain", - }, - ], - "raw": "[[Bold text]]", - "type": "strong", - }, - ], - "type": "line", + "raw": "Bold text", + "text": "Bold text" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "\`[[Bold]]\`", - "text": "[[Bold]]", "type": "code", + "raw": "\`[[Bold]]\`", + "text": "[[Bold]]" }, { - "raw": " or ", - "text": " or ", "type": "plain", + "raw": " or ", + "text": " or " }, { - "raw": "\`[* Bold]\`", - "text": "[* Bold]", "type": "code", + "raw": "\`[* Bold]\`", + "text": "[* Bold]" }, { - "raw": "⇒ ", - "text": "⇒ ", "type": "plain", + "raw": "⇒ ", + "text": "⇒ " }, { + "type": "strong", + "raw": "[[Bold]]", "nodes": [ { - "raw": "Bold", - "text": "Bold", "type": "plain", - }, - ], - "raw": "[[Bold]]", - "type": "strong", - }, - ], - "type": "line", + "raw": "Bold", + "text": "Bold" + } + ] + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[Italic text]]", "nodes": [ { - "raw": "Italic text", - "text": "Italic text", "type": "plain", - }, - ], - "raw": "[[Italic text]]", - "type": "strong", - }, - ], - "type": "line", + "raw": "Italic text", + "text": "Italic text" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "\`[/ italic]\`", - "text": "[/ italic]", "type": "code", + "raw": "\`[/ italic]\`", + "text": "[/ italic]" }, { - "raw": "⇛ ", - "text": "⇛ ", "type": "plain", + "raw": "⇛ ", + "text": "⇛ " }, { + "type": "decoration", + "raw": "[/ italic]", + "rawDecos": "/", "decos": [ - "/", + "/" ], "nodes": [ { - "raw": "italic", - "text": "italic", "type": "plain", - }, - ], - "raw": "[/ italic]", - "rawDecos": "/", - "type": "decoration", - }, - ], - "type": "line", + "raw": "italic", + "text": "italic" + } + ] + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[ Strikethrough text]]", "nodes": [ { - "raw": " Strikethrough text", - "text": " Strikethrough text", "type": "plain", - }, - ], - "raw": "[[ Strikethrough text]]", - "type": "strong", - }, - ], - "type": "line", + "raw": " Strikethrough text", + "text": " Strikethrough text" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "\`[- strikethrough]\`", - "text": "[- strikethrough]", "type": "code", + "raw": "\`[- strikethrough]\`", + "text": "[- strikethrough]" }, { - "raw": "⇛ ", - "text": "⇛ ", "type": "plain", + "raw": "⇛ ", + "text": "⇛ " }, { + "type": "decoration", + "raw": "[- strikethrough]", + "rawDecos": "-", "decos": [ - "-", + "-" ], "nodes": [ { - "raw": "strikethrough", - "text": "strikethrough", "type": "plain", - }, - ], - "raw": "[- strikethrough]", - "rawDecos": "-", - "type": "decoration", - }, - ], - "type": "line", + "raw": "strikethrough", + "text": "strikethrough" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "link": "", + "type": "image", "raw": "[https://gyazo.com/00ab07461d502db91c8ae170276d1396]", "src": "https://gyazo.com/00ab07461d502db91c8ae170276d1396/thumb/1000", - "type": "image", - }, - ], - "type": "line", + "link": "" + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[Bullet points]]", "nodes": [ { - "raw": "Bullet points", - "text": "Bullet points", "type": "plain", - }, - ], - "raw": "[[Bullet points]]", - "type": "strong", - }, - ], - "type": "line", + "raw": "Bullet points", + "text": "Bullet points" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "Press space or tab on a new line to indent and create a bullet point", - "text": "Press space or tab on a new line to indent and create a bullet point", "type": "plain", - }, - ], - "type": "line", + "raw": "Press space or tab on a new line to indent and create a bullet point", + "text": "Press space or tab on a new line to indent and create a bullet point" + } + ] }, { "indent": 2, + "type": "line", "nodes": [ { - "raw": "Press backspace to remove the indent / bullet point", - "text": "Press backspace to remove the indent / bullet point", "type": "plain", - }, - ], - "type": "line", + "raw": "Press backspace to remove the indent / bullet point", + "text": "Press backspace to remove the indent / bullet point" + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[Internal links serve triple duty]]", "nodes": [ { - "raw": "Internal links serve triple duty", - "text": "Internal links serve triple duty", "type": "plain", - }, - ], - "raw": "[[Internal links serve triple duty]]", - "type": "strong", - }, - ], - "type": "line", + "raw": "Internal links serve triple duty", + "text": "Internal links serve triple duty" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "\`[Links]\`", - "text": "[Links]", "type": "code", + "raw": "\`[Links]\`", + "text": "[Links]" }, { - "raw": " or ", - "text": " or ", "type": "plain", + "raw": " or ", + "text": " or " }, { - "raw": "\`#links\`", - "text": "#links", "type": "code", + "raw": "\`#links\`", + "text": "#links" }, { - "raw": " are two ways to make links. They do three things", - "text": " are two ways to make links. They do three things", "type": "plain", - }, - ], - "type": "line", + "raw": " are two ways to make links. They do three things", + "text": " are two ways to make links. They do three things" + } + ] }, { "indent": 2, + "type": "line", "nodes": [ { - "raw": "An internal link to a page", - "text": "An internal link to a page", "type": "plain", - }, - ], - "type": "line", + "raw": "An internal link to a page", + "text": "An internal link to a page" + } + ] }, { "indent": 2, + "type": "line", "nodes": [ { - "raw": "A ", - "text": "A ", "type": "plain", + "raw": "A ", + "text": "A " }, { - "content": "", - "href": "Bi-directional link", - "pathType": "relative", - "raw": "[Bi-directional link]", "type": "link", + "raw": "[Bi-directional link]", + "pathType": "relative", + "href": "Bi-directional link", + "content": "" }, { - "raw": " back to the source", - "text": " back to the source", "type": "plain", - }, - ], - "type": "line", + "raw": " back to the source", + "text": " back to the source" + } + ] }, { "indent": 2, + "type": "line", "nodes": [ { - "raw": "A ", - "text": "A ", "type": "plain", + "raw": "A ", + "text": "A " }, { - "content": "", - "href": "2-hop link", - "pathType": "relative", - "raw": "[2-hop link]", "type": "link", + "raw": "[2-hop link]", + "pathType": "relative", + "href": "2-hop link", + "content": "" }, { - "raw": " so you can find more related pages", - "text": " so you can find more related pages", "type": "plain", - }, - ], - "type": "line", + "raw": " so you can find more related pages", + "text": " so you can find more related pages" + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[Block quote]]", "nodes": [ { - "raw": "Block quote", - "text": "Block quote", "type": "plain", - }, - ], - "raw": "[[Block quote]]", - "type": "strong", - }, - ], - "type": "line", + "raw": "Block quote", + "text": "Block quote" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "quote", + "raw": "> use the right caret \`>\` at the beginning of a line to get a block quote ", "nodes": [ { - "raw": " use the right caret ", - "text": " use the right caret ", "type": "plain", + "raw": " use the right caret ", + "text": " use the right caret " }, { - "raw": "\`>\`", - "text": ">", "type": "code", + "raw": "\`>\`", + "text": ">" }, { - "raw": " at the beginning of a line to get a block quote ", - "text": " at the beginning of a line to get a block quote ", "type": "plain", - }, - ], - "raw": "> use the right caret \`>\` at the beginning of a line to get a block quote ", - "type": "quote", - }, - ], - "type": "line", + "raw": " at the beginning of a line to get a block quote ", + "text": " at the beginning of a line to get a block quote " + } + ] + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[* Mouse based styling]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { - "raw": "Mouse based styling", - "text": "Mouse based styling", "type": "plain", - }, - ], - "raw": "[* Mouse based styling]", - "rawDecos": "*", - "type": "decoration", - }, - ], - "type": "line", + "raw": "Mouse based styling", + "text": "Mouse based styling" + } + ] + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { - "link": "", + "type": "image", "raw": "[https://gyazo.com/a515ab169b1e371641f7e04bfa92adbc]", "src": "https://gyazo.com/a515ab169b1e371641f7e04bfa92adbc/thumb/1000", - "type": "image", - }, - ], - "type": "line", + "link": "" + } + ] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[[Code notation]]]", "nodes": [ { - "content": "", - "href": "Code notation", - "pathType": "relative", - "raw": "[Code notation]", "type": "link", - }, - ], - "raw": "[[[Code notation]]]", - "type": "strong", - }, - ], - "type": "line", + "raw": "[Code notation]", + "pathType": "relative", + "href": "Code notation", + "content": "" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "Use backquotes or backticks, \`, to highlight code ", - "text": "Use backquotes or backticks, \`, to highlight code ", "type": "plain", - }, - ], - "type": "line", + "raw": "Use backquotes or backticks, \`, to highlight code ", + "text": "Use backquotes or backticks, \`, to highlight code " + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "e.g. ", - "text": "e.g. ", "type": "plain", + "raw": "e.g. ", + "text": "e.g. " }, { - "raw": "\`function() { return true }\`", - "text": "function() { return true }", "type": "code", - }, - ], - "type": "line", + "raw": "\`function() { return true }\`", + "text": "function() { return true }" + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[[Code blocks]]]", "nodes": [ { - "content": "", - "href": "Code blocks", - "pathType": "relative", - "raw": "[Code blocks]", "type": "link", - }, - ], - "raw": "[[[Code blocks]]]", - "type": "strong", - }, - ], - "type": "line", + "raw": "[Code blocks]", + "pathType": "relative", + "href": "Code blocks", + "content": "" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "Typing ", - "text": "Typing ", "type": "plain", + "raw": "Typing ", + "text": "Typing " }, { - "raw": "\`code:filename.extension\`", - "text": "code:filename.extension", "type": "code", + "raw": "\`code:filename.extension\`", + "text": "code:filename.extension" }, { - "raw": "or", - "text": "or", "type": "plain", + "raw": "or", + "text": "or" }, { - "raw": "\`code:filename\`", - "text": "code:filename", "type": "code", + "raw": "\`code:filename\`", + "text": "code:filename" }, { - "raw": "can be used to create a new code snippet and and display it as a block", - "text": "can be used to create a new code snippet and and display it as a block", "type": "plain", - }, - ], - "type": "line", + "raw": "can be used to create a new code snippet and and display it as a block", + "text": "can be used to create a new code snippet and and display it as a block" + } + ] }, { "indent": 2, + "type": "line", "nodes": [ { - "raw": "Language names may be abbreviated", - "text": "Language names may be abbreviated", "type": "plain", - }, - ], - "type": "line", + "raw": "Language names may be abbreviated", + "text": "Language names may be abbreviated" + } + ] }, { - "content": "function () { - alert(document.location.href) - console.log("hello") - // You can also write comments! -}", - "fileName": "hello.js", "indent": 1, "type": "codeBlock", + "fileName": "hello.js", + "content": "function () {\\n alert(document.location.href)\\n console.log(\\"hello\\")\\n // You can also write comments!\\n}" }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "strong", + "raw": "[[[Tables]]]", "nodes": [ { - "content": "", - "href": "Tables", - "pathType": "relative", - "raw": "[Tables]", "type": "link", - }, - ], - "raw": "[[[Tables]]]", - "type": "strong", - }, - ], - "type": "line", + "raw": "[Tables]", + "pathType": "relative", + "href": "Tables", + "content": "" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "Type table: tablename to create a table", - "text": "Type table: tablename to create a table", "type": "plain", - }, - ], - "type": "line", + "raw": "Type table: tablename to create a table", + "text": "Type table: tablename to create a table" + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "Use tab to move to the next column, use enter to move to the next row.", - "text": "Use tab to move to the next column, use enter to move to the next row.", "type": "plain", - }, - ], - "type": "line", + "raw": "Use tab to move to the next column, use enter to move to the next row.", + "text": "Use tab to move to the next column, use enter to move to the next row." + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "An example:", - "text": "An example:", "type": "plain", - }, - ], - "type": "line", + "raw": "An example:", + "text": "An example:" + } + ] }, { + "indent": 0, + "type": "table", + "fileName": "hello", "cells": [ [ [ { - "raw": "1", - "text": "1", "type": "plain", - }, + "raw": "1", + "text": "1" + } ], [ { - "raw": "2", - "text": "2", "type": "plain", - }, + "raw": "2", + "text": "2" + } ], [ { - "raw": "3", - "text": "3", "type": "plain", - }, - ], + "raw": "3", + "text": "3" + } + ] ], [ [ { - "raw": "1 ", - "text": "1 ", "type": "plain", - }, + "raw": "1 ", + "text": "1 " + } ], [ { - "raw": "2 ", - "text": "2 ", "type": "plain", - }, + "raw": "2 ", + "text": "2 " + } ], [ { - "raw": "3", - "text": "3", "type": "plain", - }, - ], + "raw": "3", + "text": "3" + } + ] ], [ [ { - "raw": "------", - "text": "------", "type": "plain", - }, + "raw": "------", + "text": "------" + } ], [ { - "raw": "------", - "text": "------", "type": "plain", - }, + "raw": "------", + "text": "------" + } ], [ { - "raw": "------", - "text": "------", "type": "plain", - }, - ], + "raw": "------", + "text": "------" + } + ] ], [ [ { - "raw": "a", - "text": "a", "type": "plain", - }, + "raw": "a", + "text": "a" + } ], [ { - "raw": "b", - "text": "b", "type": "plain", - }, + "raw": "b", + "text": "b" + } ], [ { - "raw": "c", - "text": "c", "type": "plain", - }, - ], - ], - ], - "fileName": "hello", - "indent": 0, - "type": "table", + "raw": "c", + "text": "c" + } + ] + ] + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[* [Mathematical notation]]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { - "content": "", - "href": "Mathematical notation", - "pathType": "relative", - "raw": "[Mathematical notation]", "type": "link", - }, - ], - "raw": "[* [Mathematical notation]]", - "rawDecos": "*", - "type": "decoration", - }, - ], - "type": "line", + "raw": "[Mathematical notation]", + "pathType": "relative", + "href": "Mathematical notation", + "content": "" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "Using ", - "text": "Using ", "type": "plain", + "raw": "Using ", + "text": "Using " }, { - "content": "TeX", - "href": "https://en.wikipedia.org/wiki/TeX", - "pathType": "absolute", - "raw": "[TeX https://en.wikipedia.org/wiki/TeX]", "type": "link", + "raw": "[TeX https://en.wikipedia.org/wiki/TeX]", + "pathType": "absolute", + "href": "https://en.wikipedia.org/wiki/TeX", + "content": "TeX" }, { - "raw": " inside of brackets with a dollar sign ", - "text": " inside of brackets with a dollar sign ", "type": "plain", + "raw": " inside of brackets with a dollar sign ", + "text": " inside of brackets with a dollar sign " }, { - "raw": "\`[$ TeX here ]\`", - "text": "[$ TeX here ]", "type": "code", + "raw": "\`[$ TeX here ]\`", + "text": "[$ TeX here ]" }, { - "raw": ", you can format math or science formulas, like so: ", - "text": ", you can format math or science formulas, like so: ", "type": "plain", + "raw": ", you can format math or science formulas, like so: ", + "text": ", you can format math or science formulas, like so: " }, { - "formula": "E = mc^2", - "raw": "[$ E = mc^2]", "type": "formula", - }, - ], - "type": "line", + "raw": "[$ E = mc^2]", + "formula": "E = mc^2" + } + ] }, { "indent": 0, - "nodes": [], "type": "line", + "nodes": [] }, { "indent": 0, + "type": "line", "nodes": [ { + "type": "decoration", + "raw": "[* [Userscript]]", + "rawDecos": "*", "decos": [ - "*-1", + "*-1" ], "nodes": [ { - "content": "", - "href": "Userscript", - "pathType": "relative", - "raw": "[Userscript]", "type": "link", - }, - ], - "raw": "[* [Userscript]]", - "rawDecos": "*", - "type": "decoration", - }, - ], - "type": "line", + "raw": "[Userscript]", + "pathType": "relative", + "href": "Userscript", + "content": "" + } + ] + } + ] }, { "indent": 1, + "type": "line", "nodes": [ { - "raw": "You can even add javascript to customize Scrapbox to your liking.", - "text": "You can even add javascript to customize Scrapbox to your liking.", "type": "plain", - }, - ], - "type": "line", + "raw": "You can even add javascript to customize Scrapbox to your liking.", + "text": "You can even add javascript to customize Scrapbox to your liking." + } + ] }, { "indent": 0, - "nodes": [], "type": "line", - }, + "nodes": [] + } ] `; diff --git a/tests/page/input.txt b/test/page/input.txt similarity index 100% rename from tests/page/input.txt rename to test/page/input.txt diff --git a/tests/table/index.test.ts b/test/table/index.test.ts similarity index 79% rename from tests/table/index.test.ts rename to test/table/index.test.ts index c25cd7b4..ddb76b8f 100644 --- a/tests/table/index.test.ts +++ b/test/table/index.test.ts @@ -1,10 +1,10 @@ /* eslint-disable no-tabs, no-irregular-whitespace */ -import { describe, expect, it } from "vitest"; +import { describe, it } from "node:test"; import { parse } from "../../src/index.ts"; describe("Table", () => { - it("Simple table", () => { - expect( + it("Simple table", ({ assert }) => { + assert.snapshot( parse( ` table:hello @@ -15,11 +15,11 @@ ${"\t"}a${"\t"}b${"\t"}c `.trim(), { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); - it("Bulleted table", () => { - expect( + it("Bulleted table", ({ assert }) => { + assert.snapshot( parse( ` table:bulleted ${"\t"}1${"\t"}2${"\t"}3 @@ -28,22 +28,22 @@ ${"\t"}a${"\t"}b${"\t"}c ${"\t"}a${"\t"}b${"\t"}c`, { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); - it("Table with empty cells", () => { - expect( + it("Table with empty cells", ({ assert }) => { + assert.snapshot( parse( `table:${" "} ${"\t"} ${"\t"} ${"\t"}${" "} ${"\t"}${"\t"}${"\t"}`, { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); - it("Staggered table", () => { - expect( + it("Staggered table", ({ assert }) => { + assert.snapshot( parse( `table:Staggered ${"\t"}1${"\t"}2${"\t"}3${"\t"}4 @@ -53,11 +53,11 @@ ${"\t"}1${"\t"}2 ${"\t"}`, { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); - it("Consecutive table", () => { - expect( + it("Consecutive table", ({ assert }) => { + assert.snapshot( parse( ` table:hello @@ -73,11 +73,11 @@ ${"\t"}a${"\t"}b${"\t"}c `.trim(), { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); - it("Node in table cells", () => { - expect( + it("Node in table cells", ({ assert }) => { + assert.snapshot( parse( ` table:node in table cells @@ -105,6 +105,6 @@ ${"\t"}[[strong]] `.trim(), { hasTitle: false }, ), - ).toMatchSnapshot(); + ); }); }); diff --git a/tests/table/__snapshots__/index.test.ts.snap b/test/table/index.test.ts.snapshot similarity index 67% rename from tests/table/__snapshots__/index.test.ts.snap rename to test/table/index.test.ts.snapshot index 0e2ec43e..10ebaf79 100644 --- a/tests/table/__snapshots__/index.test.ts.snap +++ b/test/table/index.test.ts.snapshot @@ -1,749 +1,747 @@ -// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html - exports[`Table > Bulleted table 1`] = ` [ { + "indent": 1, + "type": "table", + "fileName": "bulleted", "cells": [ [ [ { - "raw": "1", - "text": "1", "type": "plain", - }, + "raw": "1", + "text": "1" + } ], [ { - "raw": "2", - "text": "2", "type": "plain", - }, + "raw": "2", + "text": "2" + } ], [ { - "raw": "3", - "text": "3", "type": "plain", - }, - ], + "raw": "3", + "text": "3" + } + ] ], [ [ { - "raw": "1 ", - "text": "1 ", "type": "plain", - }, + "raw": "1 ", + "text": "1 " + } ], [ { - "raw": "2 ", - "text": "2 ", "type": "plain", - }, + "raw": "2 ", + "text": "2 " + } ], [ { - "raw": "3", - "text": "3", "type": "plain", - }, - ], + "raw": "3", + "text": "3" + } + ] ], [ [ { - "raw": "------", - "text": "------", "type": "plain", - }, + "raw": "------", + "text": "------" + } ], [ { - "raw": "------", - "text": "------", "type": "plain", - }, + "raw": "------", + "text": "------" + } ], [ { - "raw": "------", - "text": "------", "type": "plain", - }, - ], + "raw": "------", + "text": "------" + } + ] ], [ [ { - "raw": "a", - "text": "a", "type": "plain", - }, + "raw": "a", + "text": "a" + } ], [ { - "raw": "b", - "text": "b", "type": "plain", - }, + "raw": "b", + "text": "b" + } ], [ { - "raw": "c", - "text": "c", "type": "plain", - }, - ], - ], - ], - "fileName": "bulleted", - "indent": 1, - "type": "table", - }, + "raw": "c", + "text": "c" + } + ] + ] + ] + } ] `; exports[`Table > Consecutive table 1`] = ` [ { + "indent": 0, + "type": "table", + "fileName": "hello", "cells": [ [ [ { - "raw": "1", - "text": "1", "type": "plain", - }, + "raw": "1", + "text": "1" + } ], [ { - "raw": "2", - "text": "2", "type": "plain", - }, + "raw": "2", + "text": "2" + } ], [ { - "raw": "3", - "text": "3", "type": "plain", - }, - ], + "raw": "3", + "text": "3" + } + ] ], [ [ { - "raw": "1 ", - "text": "1 ", "type": "plain", - }, + "raw": "1 ", + "text": "1 " + } ], [ { - "raw": "2 ", - "text": "2 ", "type": "plain", - }, + "raw": "2 ", + "text": "2 " + } ], [ { - "raw": "3", - "text": "3", "type": "plain", - }, - ], + "raw": "3", + "text": "3" + } + ] ], [ [ { - "raw": "------", - "text": "------", "type": "plain", - }, + "raw": "------", + "text": "------" + } ], [ { - "raw": "------", - "text": "------", "type": "plain", - }, + "raw": "------", + "text": "------" + } ], [ { - "raw": "------", - "text": "------", "type": "plain", - }, - ], + "raw": "------", + "text": "------" + } + ] ], [ [ { - "raw": "a", - "text": "a", "type": "plain", - }, + "raw": "a", + "text": "a" + } ], [ { - "raw": "b", - "text": "b", "type": "plain", - }, + "raw": "b", + "text": "b" + } ], [ { - "raw": "c", - "text": "c", "type": "plain", - }, - ], - ], - ], - "fileName": "hello", - "indent": 0, - "type": "table", + "raw": "c", + "text": "c" + } + ] + ] + ] }, { + "indent": 0, + "type": "table", + "fileName": "hello", "cells": [ [ [ { - "raw": "1", - "text": "1", "type": "plain", - }, + "raw": "1", + "text": "1" + } ], [ { - "raw": "2", - "text": "2", "type": "plain", - }, + "raw": "2", + "text": "2" + } ], [ { - "raw": "3", - "text": "3", "type": "plain", - }, - ], + "raw": "3", + "text": "3" + } + ] ], [ [ { - "raw": "1 ", - "text": "1 ", "type": "plain", - }, + "raw": "1 ", + "text": "1 " + } ], [ { - "raw": "2 ", - "text": "2 ", "type": "plain", - }, + "raw": "2 ", + "text": "2 " + } ], [ { - "raw": "3", - "text": "3", "type": "plain", - }, - ], + "raw": "3", + "text": "3" + } + ] ], [ [ { - "raw": "------", - "text": "------", "type": "plain", - }, + "raw": "------", + "text": "------" + } ], [ { - "raw": "------", - "text": "------", "type": "plain", - }, + "raw": "------", + "text": "------" + } ], [ { - "raw": "------", - "text": "------", "type": "plain", - }, - ], + "raw": "------", + "text": "------" + } + ] ], [ [ { - "raw": "a", - "text": "a", "type": "plain", - }, + "raw": "a", + "text": "a" + } ], [ { - "raw": "b", - "text": "b", "type": "plain", - }, + "raw": "b", + "text": "b" + } ], [ { - "raw": "c", - "text": "c", "type": "plain", - }, - ], - ], - ], - "fileName": "hello", - "indent": 0, - "type": "table", - }, + "raw": "c", + "text": "c" + } + ] + ] + ] + } ] `; exports[`Table > Node in table cells 1`] = ` [ { + "indent": 0, + "type": "table", + "fileName": "node in table cells", "cells": [ [ [ { - "raw": "#hashtag", - "text": "#hashtag", "type": "plain", - }, - ], + "raw": "#hashtag", + "text": "#hashtag" + } + ] ], [ [ { - "raw": "[* deco]", - "text": "[* deco]", "type": "plain", - }, - ], + "raw": "[* deco]", + "text": "[* deco]" + } + ] ], [ [ { - "raw": "[ ]", - "text": "[ ]", "type": "plain", - }, - ], + "raw": "[ ]", + "text": "[ ]" + } + ] ], [ [ { - "raw": "\`code\`", - "text": "\`code\`", "type": "plain", - }, - ], + "raw": "\`code\`", + "text": "\`code\`" + } + ] ], [ [ { - "raw": "https://external.com", - "text": "https://external.com", "type": "plain", - }, - ], + "raw": "https://external.com", + "text": "https://external.com" + } + ] ], [ [ { - "raw": "[https://external.com]", - "text": "[https://external.com]", "type": "plain", - }, - ], + "raw": "[https://external.com]", + "text": "[https://external.com]" + } + ] ], [ [ { - "raw": "[left https://external.com]", - "text": "[left https://external.com]", "type": "plain", - }, - ], + "raw": "[left https://external.com]", + "text": "[left https://external.com]" + } + ] ], [ [ { - "raw": "[https://external.com right]", - "text": "[https://external.com right]", "type": "plain", - }, - ], + "raw": "[https://external.com right]", + "text": "[https://external.com right]" + } + ] ], [ [ { - "raw": "[$ x]", - "text": "[$ x]", "type": "plain", - }, - ], + "raw": "[$ x]", + "text": "[$ x]" + } + ] ], [ [ { - "raw": "[N35.6812362,E139.7649361]", - "text": "[N35.6812362,E139.7649361]", "type": "plain", - }, - ], + "raw": "[N35.6812362,E139.7649361]", + "text": "[N35.6812362,E139.7649361]" + } + ] ], [ [ { - "raw": "#hashTag", - "text": "#hashTag", "type": "plain", - }, - ], + "raw": "#hashTag", + "text": "#hashTag" + } + ] ], [ [ { - "raw": "? helpfeel", - "text": "? helpfeel", "type": "plain", - }, - ], + "raw": "? helpfeel", + "text": "? helpfeel" + } + ] ], [ [ { - "raw": "$ commandLine", - "text": "$ commandLine", "type": "plain", - }, - ], + "raw": "$ commandLine", + "text": "$ commandLine" + } + ] ], [ [ { "path": "progfay", "pathType": "relative", - "raw": "[progfay.icon]", "type": "icon", - }, - ], + "raw": "[progfay.icon]" + } + ] ], [ [ { - "raw": "[https://image.com/image.png]", - "text": "[https://image.com/image.png]", "type": "plain", - }, - ], + "raw": "[https://image.com/image.png]", + "text": "[https://image.com/image.png]" + } + ] ], [ [ { - "content": "", - "href": "link", - "pathType": "relative", - "raw": "[link]", "type": "link", - }, - ], + "raw": "[link]", + "pathType": "relative", + "href": "link", + "content": "" + } + ] ], [ [ { - "raw": "plain", - "text": "plain", "type": "plain", - }, - ], + "raw": "plain", + "text": "plain" + } + ] ], [ [ { - "raw": "> quote", - "text": "> quote", "type": "plain", - }, - ], + "raw": "> quote", + "text": "> quote" + } + ] ], [ [ { - "raw": "[[progfay.icon]]", - "text": "[[progfay.icon]]", "type": "plain", - }, - ], + "raw": "[[progfay.icon]]", + "text": "[[progfay.icon]]" + } + ] ], [ [ { - "raw": "[[https://image.com/image.png]]", - "text": "[[https://image.com/image.png]]", "type": "plain", - }, - ], + "raw": "[[https://image.com/image.png]]", + "text": "[[https://image.com/image.png]]" + } + ] ], [ [ { - "raw": "[[strong]]", - "text": "[[strong]]", "type": "plain", - }, - ], - ], - ], - "fileName": "node in table cells", - "indent": 0, - "type": "table", - }, + "raw": "[[strong]]", + "text": "[[strong]]" + } + ] + ] + ] + } ] `; exports[`Table > Simple table 1`] = ` [ { + "indent": 0, + "type": "table", + "fileName": "hello", "cells": [ [ [ { - "raw": "1", - "text": "1", "type": "plain", - }, + "raw": "1", + "text": "1" + } ], [ { - "raw": "2", - "text": "2", "type": "plain", - }, + "raw": "2", + "text": "2" + } ], [ { - "raw": "3", - "text": "3", "type": "plain", - }, - ], + "raw": "3", + "text": "3" + } + ] ], [ [ { - "raw": "1 ", - "text": "1 ", "type": "plain", - }, + "raw": "1 ", + "text": "1 " + } ], [ { - "raw": "2 ", - "text": "2 ", "type": "plain", - }, + "raw": "2 ", + "text": "2 " + } ], [ { - "raw": "3", - "text": "3", "type": "plain", - }, - ], + "raw": "3", + "text": "3" + } + ] ], [ [ { - "raw": "------", - "text": "------", "type": "plain", - }, + "raw": "------", + "text": "------" + } ], [ { - "raw": "------", - "text": "------", "type": "plain", - }, + "raw": "------", + "text": "------" + } ], [ { - "raw": "------", - "text": "------", "type": "plain", - }, - ], + "raw": "------", + "text": "------" + } + ] ], [ [ { - "raw": "a", - "text": "a", "type": "plain", - }, + "raw": "a", + "text": "a" + } ], [ { - "raw": "b", - "text": "b", "type": "plain", - }, + "raw": "b", + "text": "b" + } ], [ { - "raw": "c", - "text": "c", "type": "plain", - }, - ], - ], - ], - "fileName": "hello", - "indent": 0, - "type": "table", - }, + "raw": "c", + "text": "c" + } + ] + ] + ] + } ] `; exports[`Table > Staggered table 1`] = ` [ { + "indent": 0, + "type": "table", + "fileName": "Staggered", "cells": [ [ [ { - "raw": "1", - "text": "1", "type": "plain", - }, + "raw": "1", + "text": "1" + } ], [ { - "raw": "2", - "text": "2", "type": "plain", - }, + "raw": "2", + "text": "2" + } ], [ { - "raw": "3", - "text": "3", "type": "plain", - }, + "raw": "3", + "text": "3" + } ], [ { - "raw": "4", - "text": "4", "type": "plain", - }, - ], + "raw": "4", + "text": "4" + } + ] ], [ [ { - "raw": "1", - "text": "1", "type": "plain", - }, + "raw": "1", + "text": "1" + } ], [ { - "raw": "2", - "text": "2", "type": "plain", - }, + "raw": "2", + "text": "2" + } ], [ { - "raw": "3", - "text": "3", "type": "plain", - }, - ], + "raw": "3", + "text": "3" + } + ] ], [ [ { - "raw": "1", - "text": "1", "type": "plain", - }, - ], + "raw": "1", + "text": "1" + } + ] ], [ [ { - "raw": "1", - "text": "1", "type": "plain", - }, + "raw": "1", + "text": "1" + } ], [ { - "raw": "2", - "text": "2", "type": "plain", - }, - ], + "raw": "2", + "text": "2" + } + ] ], [ - [], - ], - ], - "fileName": "Staggered", - "indent": 0, - "type": "table", - }, + [] + ] + ] + } ] `; exports[`Table > Table with empty cells 1`] = ` [ { + "indent": 0, + "type": "table", + "fileName": " ", "cells": [ [ [ { - "raw": " ", - "text": " ", "type": "plain", - }, + "raw": " ", + "text": " " + } ], [ { - "raw": " ", - "text": " ", "type": "plain", - }, + "raw": " ", + "text": " " + } ], [ { - "raw": " ", - "text": " ", "type": "plain", - }, - ], + "raw": " ", + "text": " " + } + ] ], [ [], [], - [], - ], - ], - "fileName": " ", - "indent": 0, - "type": "table", - }, + [] + ] + ] + } ] `; diff --git a/tests/title/index.test.ts b/test/title/index.test.ts similarity index 50% rename from tests/title/index.test.ts rename to test/title/index.test.ts index 39a1d3fb..bce8f281 100644 --- a/tests/title/index.test.ts +++ b/test/title/index.test.ts @@ -1,26 +1,27 @@ -import { describe, expect, it } from "vitest"; +import assert from "node:assert/strict"; +import { describe, it } from "node:test"; import { getTitle } from "../../src/index.ts"; describe("title", () => { it("Get title from simple page", () => { const title = getTitle("title\nline\nline\n"); - expect(title).toEqual("title"); + assert.strictEqual(title, "title"); }); it("Get title from empty page", () => { - expect(getTitle("")).toEqual("Untitled"); - expect(getTitle("  \t")).toEqual("Untitled"); - expect(getTitle("\n")).toEqual("Untitled"); - expect(getTitle("\n  \t")).toEqual("Untitled"); + assert.strictEqual(getTitle(""), "Untitled"); + assert.strictEqual(getTitle("  \t"), "Untitled"); + assert.strictEqual(getTitle("\n"), "Untitled"); + assert.strictEqual(getTitle("\n  \t"), "Untitled"); }); it("Get title from title only page", () => { const title = getTitle("title"); - expect(title).toEqual("title"); + assert.strictEqual(title, "title"); }); it("Get title from huge page", () => { const title = getTitle(`${" \n".repeat(10 ** 8)}title`); - expect(title).toEqual("title"); + assert.strictEqual(title, "title"); }); }); diff --git a/tests/line/blank.test.ts b/tests/line/blank.test.ts deleted file mode 100644 index 71af63cb..00000000 --- a/tests/line/blank.test.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* eslint-disable no-irregular-whitespace */ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("blank", () => { - it("Simple half-space blank", () => { - expect(parse("[ ]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Simple double-byte space blank", () => { - expect(parse("[ ]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Simple tab blank", () => { - expect(parse("[\t]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Multi char blank", () => { - expect(parse("[   \t \t ]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Blank in the sentence", () => { - expect( - parse("sentence[ ]sentence", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); - - it("[] is not blank", () => { - expect(parse("[]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Blank in the [*** ]", () => { - expect(parse("[*** [ ]]", { hasTitle: false })).toMatchSnapshot(); - }); -}); diff --git a/tests/line/code.test.ts b/tests/line/code.test.ts deleted file mode 100644 index 685f9693..00000000 --- a/tests/line/code.test.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("code", () => { - it("Simple code with backquote", () => { - expect(parse("`Simple code`", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Empty code with backquote", () => { - expect(parse("``", { hasTitle: false })).toMatchSnapshot(); - }); -}); diff --git a/tests/line/commandLine.test.ts b/tests/line/commandLine.test.ts deleted file mode 100644 index 5aebc73f..00000000 --- a/tests/line/commandLine.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("commandLine", () => { - it("Simple command with $", () => { - expect(parse("$ command", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Simple command with %", () => { - expect(parse("% command", { hasTitle: false })).toMatchSnapshot(); - }); - - it("`$` is not command", () => { - expect(parse("$", { hasTitle: false })).toMatchSnapshot(); - }); - - it("`$ ` is not command", () => { - expect(parse("$ ", { hasTitle: false })).toMatchSnapshot(); - }); - - it("`$s` is not command", () => { - expect(parse("$not command", { hasTitle: false })).toMatchSnapshot(); - }); -}); diff --git a/tests/line/formula.test.ts b/tests/line/formula.test.ts deleted file mode 100644 index 04ab4b52..00000000 --- a/tests/line/formula.test.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("formula", () => { - it("Simple formula", () => { - expect( - parse("[$ \\frac{3}{2}^N]", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); - - it("Formula includes [] with tail half-space", () => { - expect(parse("[$ [x] ]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Formula includes [] without tail half-space", () => { - expect(parse("[$ [x]]", { hasTitle: false })).toMatchSnapshot(); - }); -}); diff --git a/tests/line/hashTag.test.ts b/tests/line/hashTag.test.ts deleted file mode 100644 index 449ef260..00000000 --- a/tests/line/hashTag.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("hashTag", () => { - it("Simple hashTag", () => { - expect(parse("#tag", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Only `#` is not hashTag", () => { - expect(parse("#", { hasTitle: false })).toMatchSnapshot(); - }); - - it("HashTag includes `#`", () => { - expect(parse("#hash#Tag", { hasTitle: false })).toMatchSnapshot(); - }); - - it("HashTag in sentence with spaces", () => { - expect(parse("This is a #tag .", { hasTitle: false })).toMatchSnapshot(); - }); - - it("HashTag in sentence without spaces is not hashTag", () => { - expect(parse("→#notTag←", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Multiple hashTag", () => { - expect(parse("#hoge #fuga #piyo", { hasTitle: false })).toMatchSnapshot(); - }); -}); diff --git a/tests/line/helpfeel.test.ts b/tests/line/helpfeel.test.ts deleted file mode 100644 index 16c6e596..00000000 --- a/tests/line/helpfeel.test.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("helpfeel", () => { - it("Simple helpfeel", () => { - expect(parse("? Simple helpfeel", { hasTitle: false })).toMatchSnapshot(); - }); - - it("No head `?` is not helpfeel", () => { - expect(parse("a ? not helpfeel", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Quoted ? is not helpfeel", () => { - expect(parse("> ? Quoted", { hasTitle: false })).toMatchSnapshot(); - }); -}); diff --git a/tests/line/icon.test.ts b/tests/line/icon.test.ts deleted file mode 100644 index cbe7f6b9..00000000 --- a/tests/line/icon.test.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("icon", () => { - it("Simple root icon", () => { - expect(parse("[/icons/+1.icon]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Simple relative icon", () => { - expect(parse("[me.icon]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Multiple icons", () => { - expect(parse("[me.icon*3]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Icon and internal link on same line", () => { - expect( - parse("[Internal link][me.icon]", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); - - it("Each multiple icon must be different Object", () => { - const [block] = parse("[me.icon*2]", { hasTitle: false }); - - if (block === undefined || block.type !== "line") { - throw new Error("fail"); - } - - expect(block.nodes.length).toBe(2); - expect(block.nodes[0]).not.toBe(block.nodes[1]); - }); -}); diff --git a/tests/line/index.test.ts b/tests/line/index.test.ts deleted file mode 100644 index 5553e304..00000000 --- a/tests/line/index.test.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("line", () => { - it("Line that have multi node", () => { - expect(parse("[Link][Link]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Decoration line includes internal link", () => { - expect(parse("[* [Link]]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Decoration line includes external link", () => { - expect( - parse("[* [https://example.com example]]", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); - - it("Multi `]`", () => { - expect( - parse("[* [Link]`code`[Link]]", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); -}); diff --git a/tests/line/link.test.ts b/tests/line/link.test.ts deleted file mode 100644 index 99a46e81..00000000 --- a/tests/line/link.test.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("link", () => { - it("Simple absolute link", () => { - expect( - parse("https://example.com/", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); - - it("Simple absolute link with ahead non-space character", () => { - expect( - parse("ahttps://example.com/", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); - - it("Simple absolute link with bracket", () => { - expect( - parse("[https://example.com/]", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); - - it("Simple root link", () => { - expect(parse("[/project/page]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Simple relative link", () => { - expect(parse("[page]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Link with content", () => { - expect( - parse( - ` -[https://example.com/ Example] -[Example https://example.com/] -[https://left.com/ center https://right.com/] -`.trim(), - { - hasTitle: false, - }, - ), - ).toMatchSnapshot(); - }); - - it("Root and relative link path can include space", () => { - expect( - parse( - ` -[page name] -[/project/page name] -`.trim(), - { hasTitle: false }, - ), - ).toMatchSnapshot(); - }); - - it("Link with link", () => { - expect( - parse("[https://example.com https://example.com]", { hasTitle: false }), - ).toMatchSnapshot(); - }); - - it("Link with GET parameters", () => { - expect( - parse("[http://example.com?key1=value1&key2=value2]", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); -}); diff --git a/tests/line/numberList.test.ts b/tests/line/numberList.test.ts deleted file mode 100644 index 0eceace7..00000000 --- a/tests/line/numberList.test.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("numberList", () => { - it("Minimum numberList", () => { - expect( - parse("1. ", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); - - it("Simple numberList", () => { - expect( - parse("1. Simple numberList", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); - - it("1. with decoration", () => { - expect(parse("1. [* deco]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("1. with code", () => { - expect(parse("1. `code`", { hasTitle: false })).toMatchSnapshot(); - }); - - it("1. with no space is not numberList", () => { - expect( - parse("1.not numberList", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); - - it("No head 1. is not numberList", () => { - expect( - parse("a 1. not numberList", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); - - it("Quoted 1. is not numberList", () => { - expect(parse("> 1. Quoted", { hasTitle: false })).toMatchSnapshot(); - }); -}); diff --git a/tests/line/plain.test.ts b/tests/line/plain.test.ts deleted file mode 100644 index 7dc615e4..00000000 --- a/tests/line/plain.test.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("plain", () => { - it("Simple plain text", () => { - expect(parse("Plain text", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Blank line", () => { - expect(parse("", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Keep tail space", () => { - expect(parse("Tail space -> ", { hasTitle: false })).toMatchSnapshot(); - }); -}); diff --git a/tests/line/quote.test.ts b/tests/line/quote.test.ts deleted file mode 100644 index e2991f5a..00000000 --- a/tests/line/quote.test.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("quote", () => { - it("Simple quote", () => { - expect(parse("> Simple quote", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Empty quote", () => { - expect(parse(">", { hasTitle: false })).toMatchSnapshot(); - }); -}); diff --git a/tests/line/strong.test.ts b/tests/line/strong.test.ts deleted file mode 100644 index 80a086c2..00000000 --- a/tests/line/strong.test.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("strong", () => { - it("Simple strong", () => { - expect(parse("[[Simple strong]]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("[[]] is not strong", () => { - expect(parse("[[]]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Decoration in Strong notation", () => { - expect(parse("[[[! deco]]]", { hasTitle: false })).toMatchSnapshot(); - }); -}); diff --git a/tests/line/strongIcon.test.ts b/tests/line/strongIcon.test.ts deleted file mode 100644 index 45b6973c..00000000 --- a/tests/line/strongIcon.test.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("strongIcon", () => { - it("Simple root strong icon", () => { - expect( - parse("[[/icons/+1.icon]]", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); - - it("Simple relative strong icon", () => { - expect(parse("[[me.icon]]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Multiple icons", () => { - expect(parse("[[me.icon*3]]", { hasTitle: false })).toMatchSnapshot(); - }); - - it("Strong icon and internal link on same line", () => { - expect( - parse("[Internal link][[me.icon]]", { - hasTitle: false, - }), - ).toMatchSnapshot(); - }); - - it("Each multiple strong icon must be different Object", () => { - const [block] = parse("[[me.icon*2]]", { hasTitle: false }); - if (block === undefined || block.type !== "line") { - throw new Error("fail"); - } - - expect(block.nodes.length).toBe(2); - expect(block.nodes[0]).not.toBe(block.nodes[1]); - }); -}); diff --git a/tests/page/index.test.ts b/tests/page/index.test.ts deleted file mode 100644 index dd095d79..00000000 --- a/tests/page/index.test.ts +++ /dev/null @@ -1,23 +0,0 @@ -import * as fs from "node:fs"; -import path from "node:path"; -import { describe, expect, it } from "vitest"; -import { parse } from "../../src/index.ts"; - -describe("page", () => { - it("Empty page", () => { - const input = ""; - expect(parse(input, { hasTitle: true })).toMatchSnapshot(); - }); - - it("Title Block without `hasTitle` option", () => { - const input = "Title"; - expect(parse(input)).toMatchSnapshot(); - }); - - it("https://scrapbox.io/help/Syntax", () => { - const input = fs - .readFileSync(path.resolve("tests/page/input.txt")) - .toString(); - expect(parse(input, { hasTitle: true })).toMatchSnapshot(); - }); -}); diff --git a/vite.config.ts b/vite.config.ts index 01d36b33..d5428709 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,4 +1,3 @@ -/// import { resolve } from "node:path"; import { type LibraryFormats, defineConfig } from "vite"; @@ -26,10 +25,4 @@ export default defineConfig({ }, }, }, - test: { - include: ["**/tests/**/*.test.ts"], - coverage: { - include: ["src/**/*.ts"], - }, - }, });