diff --git a/eslint.config.mjs b/eslint.config.mjs index 50af403..2768ff4 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -1,31 +1,50 @@ -import eslint from "@eslint/js"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import { includeIgnoreFile } from "@eslint/compat"; +import stylistic from "@stylistic/eslint-plugin"; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); +const gitignorePath = path.resolve(__dirname, ".gitignore"); export default [ + includeIgnoreFile(gitignorePath), { - files: ["**/*.js"], - ignores: [ - "node_modules/**/*", - "build/**/*", - "dist/**/*", - ".output/**/*", - "docs/**/*", - ], + files: ["**/*.js", "**/*.mjs"], + plugins: { + "@stylistic": stylistic + }, rules: { - ...eslint.configs.recommended.rules, - "indent": ["error", 2, { "SwitchCase": 1 }], - "linebreak-style": ["error", "windows"], - "quotes": ["error", "double"], - "semi": ["error", "always"], - "camelcase": "off", - "arrow-spacing": ["error", { "before": true, "after": true }], - "no-console": ["error", { - "allow": ["info", "warn"] - }], - "brace-style": ["error", "stroustrup", { "allowSingleLine": true }], - "no-multi-spaces": "error", - "space-before-blocks": "error", - "no-trailing-spaces": "error", - "no-undef": "off" + "camelcase": ["error"], + "no-console": ["error", { allow: ["info", "warn"] }], + "@stylistic/indent": ["error", 2, { SwitchCase: 1 }], + "@stylistic/linebreak-style": ["error", process.platform === "win32" ? "windows" : "unix"], + "@stylistic/quotes": ["error", "double"], + "@stylistic/semi": ["error", "always"], + "@stylistic/no-extra-semi": "error", + "@stylistic/comma-dangle": ["error", "never"], + "@stylistic/space-before-function-paren": ["error", "always"], + "@stylistic/multiline-ternary": ["error", "never"], + "@stylistic/member-delimiter-style": ["error", { multiline: { delimiter: "semi" }, singleline: { delimiter: "comma" } }], + "@stylistic/arrow-spacing": ["error", { before: true, after: true }], + "@stylistic/brace-style": ["error", "stroustrup", { allowSingleLine: true }], + "@stylistic/no-multi-spaces": "error", + "@stylistic/space-before-blocks": "error", + "@stylistic/no-trailing-spaces": "error", + "@stylistic/array-bracket-spacing": ["error", "never"], + "@stylistic/block-spacing": ["error", "always"], + "@stylistic/comma-spacing": ["error", { after: true, before: false }], + "@stylistic/comma-style": ["error", "last"], + "@stylistic/key-spacing": ["error", { afterColon: true, beforeColon: false }], + "@stylistic/keyword-spacing": ["error", { after: true, before: true }], + "@stylistic/object-curly-newline": "off", + "@stylistic/object-curly-spacing": ["error", "always"], + "@stylistic/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }], + "@stylistic/one-component-per-file": "off", + "@stylistic/require-default-prop": "off", + "@stylistic/space-in-parens": ["error", "never"], + "@stylistic/template-curly-spacing": "error", + "@stylistic/quote-props": ["error", "consistent-as-needed"] } } ]; diff --git a/package.json b/package.json index 5a1493d..4c448ce 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,8 @@ "lint": "eslint --fix" }, "devDependencies": { + "@eslint/compat": "^1.2.1", + "@stylistic/eslint-plugin": "^2.9.0", "@vitest/coverage-v8": "^2.1.3", "clean-jsdoc-theme": "^4.3.0", "dotenv": "^16.4.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c8207c3..52d0264 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,6 +8,12 @@ importers: .: devDependencies: + '@eslint/compat': + specifier: ^1.2.1 + version: 1.2.1(eslint@9.13.0) + '@stylistic/eslint-plugin': + specifier: ^2.9.0 + version: 2.9.0(eslint@9.13.0)(typescript@4.9.5) '@vitest/coverage-v8': specifier: ^2.1.3 version: 2.1.3(vitest@2.1.3(@edge-runtime/vm@3.2.0)(@types/node@16.18.11)(terser@5.36.0)) @@ -240,6 +246,15 @@ packages: resolution: {integrity: sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + '@eslint/compat@1.2.1': + resolution: {integrity: sha512-JbHG2TWuCeNzh87fXo+/46Z1LEo9DBA9T188d0fZgGxAD+cNyS6sx9fdiyxjGPBMyQVRlCutTByZ6a5+YMkF7g==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^9.10.0 + peerDependenciesMeta: + eslint: + optional: true + '@eslint/config-array@0.18.0': resolution: {integrity: sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} @@ -427,6 +442,12 @@ packages: '@sinclair/typebox@0.25.24': resolution: {integrity: sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==} + '@stylistic/eslint-plugin@2.9.0': + resolution: {integrity: sha512-OrDyFAYjBT61122MIY1a3SfEgy3YCMgt2vL4eoPmvTwDBwyQhAXurxNQznlRD/jESNfYWfID8Ej+31LljvF7Xg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: '>=8.40.0' + '@tootallnate/once@2.0.0': resolution: {integrity: sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==} engines: {node: '>= 10'} @@ -464,6 +485,33 @@ packages: '@types/node@16.18.11': resolution: {integrity: sha512-3oJbGBUWuS6ahSnEq1eN2XrCyf4YsWI8OyCvo7c64zQJNplk3mO84t53o8lfTk+2ji59g5ycfc6qQ3fdHliHuA==} + '@typescript-eslint/scope-manager@8.11.0': + resolution: {integrity: sha512-Uholz7tWhXmA4r6epo+vaeV7yjdKy5QFCERMjs1kMVsLRKIrSdM6o21W2He9ftp5PP6aWOVpD5zvrvuHZC0bMQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@typescript-eslint/types@8.11.0': + resolution: {integrity: sha512-tn6sNMHf6EBAYMvmPUaKaVeYvhUsrE6x+bXQTxjQRp360h1giATU0WvgeEys1spbvb5R+VpNOZ+XJmjD8wOUHw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@typescript-eslint/typescript-estree@8.11.0': + resolution: {integrity: sha512-yHC3s1z1RCHoCz5t06gf7jH24rr3vns08XXhfEqzYpd6Hll3z/3g23JRi0jM8A47UFKNc3u/y5KIMx8Ynbjohg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '*' + peerDependenciesMeta: + typescript: + optional: true + + '@typescript-eslint/utils@8.11.0': + resolution: {integrity: sha512-CYiX6WZcbXNJV7UNB4PLDIBtSdRmRI/nb0FMyqHPTQD1rMjA0foPLaPUV39C/MxkTd/QKSeX+Gb34PPsDVC35g==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 + + '@typescript-eslint/visitor-keys@8.11.0': + resolution: {integrity: sha512-EaewX6lxSjRJnc+99+dqzTeoDZUfyrA52d2/HRrkI830kgovWsmIiTfmr0NZorzqic7ga+1bS60lRBUgR3n/Bw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + '@vercel/build-utils@8.4.11': resolution: {integrity: sha512-bs6FwEhdWJ8+Wtey2jtAobgktk148Ipbc1VfTv1awUI5yEfhIGN87x20NfNsE+48vKlai/HkwHeubpMUwiS8Lw==} @@ -1842,6 +1890,10 @@ packages: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + picomatch@4.0.2: + resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} + engines: {node: '>=12'} + postcss@8.4.47: resolution: {integrity: sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==} engines: {node: ^10 || ^12 || >=14} @@ -2140,6 +2192,12 @@ packages: resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} hasBin: true + ts-api-utils@1.3.0: + resolution: {integrity: sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==} + engines: {node: '>=16'} + peerDependencies: + typescript: '>=4.2.0' + ts-morph@12.0.0: resolution: {integrity: sha512-VHC8XgU2fFW7yO1f/b3mxKDje1vmyzFXHWzOYmKEkCEwcLjDtbdLgBQviqj4ZwP4MJkQtRo6Ha2I29lq/B+VxA==} @@ -2490,6 +2548,10 @@ snapshots: '@eslint-community/regexpp@4.11.1': {} + '@eslint/compat@1.2.1(eslint@9.13.0)': + optionalDependencies: + eslint: 9.13.0 + '@eslint/config-array@0.18.0': dependencies: '@eslint/object-schema': 2.1.4 @@ -2662,6 +2724,18 @@ snapshots: '@sinclair/typebox@0.25.24': {} + '@stylistic/eslint-plugin@2.9.0(eslint@9.13.0)(typescript@4.9.5)': + dependencies: + '@typescript-eslint/utils': 8.11.0(eslint@9.13.0)(typescript@4.9.5) + eslint: 9.13.0 + eslint-visitor-keys: 4.1.0 + espree: 10.2.0 + estraverse: 5.3.0 + picomatch: 4.0.2 + transitivePeerDependencies: + - supports-color + - typescript + '@tootallnate/once@2.0.0': {} '@ts-morph/common@0.11.1': @@ -2694,6 +2768,44 @@ snapshots: '@types/node@16.18.11': {} + '@typescript-eslint/scope-manager@8.11.0': + dependencies: + '@typescript-eslint/types': 8.11.0 + '@typescript-eslint/visitor-keys': 8.11.0 + + '@typescript-eslint/types@8.11.0': {} + + '@typescript-eslint/typescript-estree@8.11.0(typescript@4.9.5)': + dependencies: + '@typescript-eslint/types': 8.11.0 + '@typescript-eslint/visitor-keys': 8.11.0 + debug: 4.3.7 + fast-glob: 3.3.2 + is-glob: 4.0.3 + minimatch: 9.0.5 + semver: 7.6.3 + ts-api-utils: 1.3.0(typescript@4.9.5) + optionalDependencies: + typescript: 4.9.5 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/utils@8.11.0(eslint@9.13.0)(typescript@4.9.5)': + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@9.13.0) + '@typescript-eslint/scope-manager': 8.11.0 + '@typescript-eslint/types': 8.11.0 + '@typescript-eslint/typescript-estree': 8.11.0(typescript@4.9.5) + eslint: 9.13.0 + transitivePeerDependencies: + - supports-color + - typescript + + '@typescript-eslint/visitor-keys@8.11.0': + dependencies: + '@typescript-eslint/types': 8.11.0 + eslint-visitor-keys: 3.4.3 + '@vercel/build-utils@8.4.11': {} '@vercel/error-utils@2.0.2': {} @@ -4167,6 +4279,8 @@ snapshots: picomatch@2.3.1: {} + picomatch@4.0.2: {} + postcss@8.4.47: dependencies: nanoid: 3.3.7 @@ -4492,6 +4606,10 @@ snapshots: tree-kill@1.2.2: {} + ts-api-utils@1.3.0(typescript@4.9.5): + dependencies: + typescript: 4.9.5 + ts-morph@12.0.0: dependencies: '@ts-morph/common': 0.11.1 diff --git a/resources/themes.json b/resources/themes.json index 346343e..373c120 100644 --- a/resources/themes.json +++ b/resources/themes.json @@ -1,16 +1,16 @@ { "default": { - "primary_color": "0969da", - "text_color": "434d58", - "bg_color": "fffefe", - "icon_color": "586069", - "border_color": "e4e2e2" + "primaryColor": "0969da", + "textColor": "434d58", + "bgColor": "fffefe", + "iconColor": "586069", + "borderColor": "e4e2e2" }, "dark": { - "primary_color": "58a6ff", - "text_color": "c9d1d9", - "bg_color": "0d1117", - "icon_color": "58a6ff", - "border_color": "30363d" + "primaryColor": "58a6ff", + "textColor": "c9d1d9", + "bgColor": "0d1117", + "iconColor": "58a6ff", + "borderColor": "30363d" } } diff --git a/src/card.js b/src/card.js index bbee1bc..5e5e3eb 100644 --- a/src/card.js +++ b/src/card.js @@ -15,10 +15,10 @@ const { X_LEFT, X_RIGHT, Y_DOWN, MAX_GISTS, DEFAULT_THEME, DEFAULT_TITLE, CARD_W * @param {string} query.theme Theme name * @param {number} query.n Number of gists to display * @param {string} query.title Title of the card - * @param {Object[]} gists_response Gists response + * @param {Object[]} gistsResponse Gists response * @returns {Object} Card object */ -export const getCard = (query, gists_response) => { +export const getCard = (query, gistsResponse) => { const { theme = DEFAULT_THEME, n = MAX_GISTS, title = DEFAULT_TITLE } = query; // get query parameters let gists = []; // array of gists let x = X_LEFT; // x position of gist @@ -26,17 +26,17 @@ export const getCard = (query, gists_response) => { let i = 0; // counter let newLine = false; // new line flag - gists_response.filter((gist) => gist.public).some((gist) => { + gistsResponse.filter((gist) => gist.public).some((gist) => { let filename = Object.keys(gist.files)[0]; // gist filename let language = gist.files[filename].language; // gist language - let lang_color = getLanguageColor(language); // gist language color + let langColor = getLanguageColor(language); // gist language color gists.push({ - "filename": filename, // gist filename - "language": language, // gist language - "lang_color": lang_color, // gist language color - "y" : y, // y position of gist - "x" : x // x position of gist + filename: filename, // gist filename + language: language, // gist language + langColor: langColor, // gist language color + y: y, // y position of gist + x: x // x position of gist }); if (x == X_LEFT && !newLine) { @@ -63,12 +63,12 @@ export const getCard = (query, gists_response) => { height = (i % 2 == 0) ? height - Y_DOWN : height; // height of the card return { // card - "theme": getTheme(theme), // theme - "gists": gists, - "value": { - "title": title || DEFAULT_TITLE, - "height": height, - "width": CARD_WIDTH + theme: getTheme(theme), // theme + gists: gists, + value: { + title: title || DEFAULT_TITLE, + height: height, + width: CARD_WIDTH } }; }; diff --git a/src/gistsList.js b/src/gistsList.js index 44ddcb1..3861af7 100644 --- a/src/gistsList.js +++ b/src/gistsList.js @@ -15,7 +15,7 @@ dotenv.config(); // load environment variables * @returns {Promise<{data: any[]}>} Gists object */ export const getGists = async (user) => { - const req = await $fetch(`https://api.github.com/users/${user}/gists`, { headers: { Authorization: `Bearer ${process.env.token}` } }).catch(() => null); + const req = await $fetch(`https://api.github.com/users/${user}/gists`, { headers: { Authorization: `Bearer ${process.env.token}` } }).catch(() => null); if (!req || !req.length) return []; return req; diff --git a/src/pin.js b/src/pin.js index ebe89ef..9340c8b 100644 --- a/src/pin.js +++ b/src/pin.js @@ -14,16 +14,16 @@ const { DEFAULT_THEME, BREAK_SIZE, PIN_WIDTH, PIN_HEIGHT, PIN_STATS_Y, CHARS_WRA * @param {Object} query Query object * @param {string} query.theme Theme name * @param {boolean} query.owner Owner flag - * @param {Object} gist_response Gist response object - * @param {Object} gist_response.data Gist data - * @param {Object} gist_response.data.viewer Viewer object - * @param {Object} gist_response.data.viewer.gist Gist object + * @param {Object} gistResponse Gist response object + * @param {Object} gistResponse.data Gist data + * @param {Object} gistResponse.data.viewer Viewer object + * @param {Object} gistResponse.data.viewer.gist Gist object * @returns {Object} Pin object */ -export const getPin = async (query, gist_response) => { +export const getPin = async (query, gistResponse) => { const { theme = DEFAULT_THEME, owner = false } = query; // get query parameters - const gist = gist_response.data.viewer.gist; + const gist = gistResponse.data.viewer.gist; const user = gist?.owner?.login; const description = gist?.description; const stars = gist?.stargazers?.totalCount; @@ -37,28 +37,28 @@ export const getPin = async (query, gist_response) => { color = getLanguageColor(gist.files[0].language.name); } - const broken_description = wrapDescription(description, CHARS_WRAP); // wrap description - const breaks = (broken_description.match(/dy/g) || []).length; // number of breaks + const brokenDescription = wrapDescription(description, CHARS_WRAP); // wrap description + const breaks = (brokenDescription.match(/dy/g) || []).length; // number of breaks const height = PIN_HEIGHT + (breaks * BREAK_SIZE); // pin height - const y_stats = PIN_STATS_Y + (breaks * BREAK_SIZE); // y position of stats + const yStats = PIN_STATS_Y + (breaks * BREAK_SIZE); // y position of stats return { // pin - "theme": getTheme(theme), // get theme - "gist": { - "user": user, - "filename": filename, // gist filename - "description": description, - "broken_description": broken_description, - "language": language, // gist language - "lang_color": color, // gist language color - "stars": stars, - "forks": forks + theme: getTheme(theme), // get theme + gist: { + user: user, + filename: filename, // gist filename + description: description, + brokenDescription: brokenDescription, + language: language, // gist language + langColor: color, // gist language color + stars: stars, + forks: forks }, - "value": { - "height": height, - "width": PIN_WIDTH, - "y_stats": y_stats, - "owner": owner ? JSON.parse(owner) : false + value: { + height: height, + width: PIN_WIDTH, + yStats: yStats, + owner: owner ? JSON.parse(owner) : false } }; }; diff --git a/templates/card.hbs b/templates/card.hbs index 7fa2ee7..aefe0da 100644 --- a/templates/card.hbs +++ b/templates/card.hbs @@ -1,16 +1,16 @@ {{ value.title }} - + - {{ value.title }} + {{ value.title }} {{#each gists}} - - {{ this.filename }} + + {{ this.filename }} {{/each}} diff --git a/templates/pin.hbs b/templates/pin.hbs index eb30be1..f243176 100644 --- a/templates/pin.hbs +++ b/templates/pin.hbs @@ -5,51 +5,51 @@ {{ gist.filename }} Gist Pin {{/if}} {{ gist.description }} - + - + {{#if value.owner}} - {{ gist.user }}/{{ gist.filename }} + {{ gist.user }}/{{ gist.filename }} {{else}} - {{ gist.filename }} + {{ gist.filename }} {{/if}} - - {{{ gist.broken_description }}} + + {{{ gist.brokenDescription }}} - + - - {{ gist.language }} + + {{ gist.language }} {{#if gist.stars}} - + - {{ gist.stars }} + {{ gist.stars }} {{/if}} {{#if gist.forks}} - + - {{ gist.forks }} + {{ gist.forks }} {{/if}} diff --git a/tests/card.test.js b/tests/card.test.js index 54ac260..d7b553e 100644 --- a/tests/card.test.js +++ b/tests/card.test.js @@ -7,38 +7,38 @@ const fakeGists = [ files: { "reduce_dataset.js": { filename: "reduce_dataset.js", - language: "JavaScript", - }, - }, + language: "JavaScript" + } + } }, { public: true, files: { "submissions.gs": { filename: "submissions.gs", - language: "JavaScript", - }, - }, + language: "JavaScript" + } + } }, { public: true, files: { "provincias.json": { filename: "provincias.json", - language: "JSON", - }, - }, + language: "JSON" + } + } } ]; -const defined_card = [ +const definedCard = [ { n: 3 }, { title: "" }, { title: "Yizack Gists" }, - { theme: "dark" }, + { theme: "dark" } ]; -const empty_card = [ +const emptyCard = [ { n: 0 }, { theme: "dark" }, { user: "_" }, @@ -46,14 +46,14 @@ const empty_card = [ ]; describe("getCard", () => { - defined_card.forEach((query) => { + definedCard.forEach((query) => { it(`${JSON.stringify(query)} - should return card`, async () => { const card = getCard(query, fakeGists); expect(card).toBeDefined(); }); }); - empty_card.forEach((query) => { + emptyCard.forEach((query) => { it(`${JSON.stringify(query)} - should return empty card`, async () => { const card = getCard(query, []); expect(card.gists).toStrictEqual([]); diff --git a/tests/getTheme.test.js b/tests/getTheme.test.js index 66cb0ba..fe73355 100644 --- a/tests/getTheme.test.js +++ b/tests/getTheme.test.js @@ -3,18 +3,18 @@ import { getTheme } from "./../src/functions.js"; const themes = { default: { - "primary_color": "0969da", - "text_color": "434d58", - "bg_color": "fffefe", - "icon_color": "586069", - "border_color": "e4e2e2" + primaryColor: "0969da", + textColor: "434d58", + bgColor: "fffefe", + iconColor: "586069", + borderColor: "e4e2e2" }, dark: { - "primary_color": "58a6ff", - "text_color": "c9d1d9", - "bg_color": "0d1117", - "icon_color": "58a6ff", - "border_color": "30363d" + primaryColor: "58a6ff", + textColor: "c9d1d9", + bgColor: "0d1117", + iconColor: "58a6ff", + borderColor: "30363d" } }; diff --git a/tests/gist.test.js b/tests/gist.test.js index 12c897f..c94b038 100644 --- a/tests/gist.test.js +++ b/tests/gist.test.js @@ -41,7 +41,7 @@ vi.mock("ofetch", async (importOriginal) => { const mod = await importOriginal(); return { ...mod, - $fetch: vi.fn(), + $fetch: vi.fn() }; }); diff --git a/tests/gistsList.test.js b/tests/gistsList.test.js index 8a26394..5a726fa 100644 --- a/tests/gistsList.test.js +++ b/tests/gistsList.test.js @@ -7,25 +7,25 @@ const fakeGists = [ files: { "reduce_dataset.js": { filename: "reduce_dataset.js", - language: "JavaScript", - }, - }, + language: "JavaScript" + } + } }, { files: { "submissions.gs": { filename: "submissions.gs", - language: "JavaScript", - }, - }, + language: "JavaScript" + } + } }, { files: { "provincias.json": { filename: "provincias.json", - language: "JSON", - }, - }, + language: "JSON" + } + } } ]; @@ -33,7 +33,7 @@ vi.mock("ofetch", async (importOriginal) => { const mod = await importOriginal(); return { ...mod, - $fetch: vi.fn(), + $fetch: vi.fn() }; }); diff --git a/tests/pin.test.js b/tests/pin.test.js index 2d6a6f6..e8f5657 100644 --- a/tests/pin.test.js +++ b/tests/pin.test.js @@ -32,25 +32,25 @@ const fakeGist = { const fakeNULL = { data: { viewer: { gist: null } } }; -const defined_pin = [ +const definedPin = [ { id: "cbe7cef5572e6b832da0e9bd3454b312" }, { id: "cbe7cef5572e6b832da0e9bd3454b312", owner: "true" } ]; -const empty_pin = [ +const emptyPin = [ { id: "_" }, { } ]; describe("getPin", () => { - defined_pin.forEach((query) => { + definedPin.forEach((query) => { it(`${JSON.stringify(query)} - should return pin`, async () => { const pin = await getPin(query, fakeGist); expect(pin).toBeDefined(); }); }); - empty_pin.forEach((query) => { + emptyPin.forEach((query) => { it(`${JSON.stringify(query)} - should return empty pin`, async () => { const pin = await getPin(query, fakeNULL); expect(pin.filename).toBeUndefined();