From 8bd5b44022d29b660234f769e532e8a860b98165 Mon Sep 17 00:00:00 2001 From: Paul Robert Lloyd Date: Tue, 26 Nov 2024 21:57:56 +0000 Subject: [PATCH] style: lint javascript --- helpers/database/index.js | 2 +- helpers/mock-agent/endpoint-auth.js | 2 +- helpers/mock-agent/endpoint-image.js | 2 +- helpers/mock-agent/endpoint-micropub.js | 2 +- helpers/mock-agent/syndicator-mastodon.js | 2 +- helpers/publication/index.js | 2 +- helpers/server/index.js | 5 +++-- helpers/session/index.js | 3 ++- packages/create-indiekit/bin/create.js | 1 + packages/create-indiekit/index.js | 5 ++++- packages/create-indiekit/lib/docker.js | 1 + packages/create-indiekit/lib/files.js | 3 ++- packages/create-indiekit/lib/utils.js | 1 + packages/create-indiekit/test/unit/docker.js | 1 + packages/create-indiekit/test/unit/files.js | 1 + packages/create-indiekit/test/unit/package.js | 1 + packages/create-indiekit/test/unit/setup-prompts.js | 1 + packages/create-indiekit/test/unit/utils.js | 1 + packages/endpoint-auth/index.js | 1 + packages/endpoint-auth/lib/controllers/authorization.js | 1 + packages/endpoint-auth/lib/controllers/consent.js | 2 ++ packages/endpoint-auth/lib/controllers/password.js | 1 + packages/endpoint-auth/lib/middleware/code.js | 1 + packages/endpoint-auth/lib/middleware/secret.js | 1 + packages/endpoint-auth/lib/middleware/validation.js | 1 + packages/endpoint-auth/lib/password.js | 1 + packages/endpoint-auth/lib/token.js | 1 + .../test/integration/200-authorization-documentation.js | 5 +++-- .../test/integration/200-authorization-invalid-client-id.js | 3 ++- .../integration/200-authorization-invalid-redirect-uri.js | 3 ++- .../integration/200-authorization-invalid-response-type.js | 3 ++- .../test/integration/200-authorization-no-response-type.js | 3 ++- .../test/integration/200-authorization-profile-json.js | 4 +++- .../integration/200-authorization-profile-url-encoded.js | 4 +++- .../test/integration/200-consent-authenticate.js | 4 +++- .../endpoint-auth/test/integration/200-consent-authorize.js | 4 +++- .../test/integration/200-introspect-token-active.js | 3 ++- .../test/integration/200-introspect-token-inactive.js | 3 ++- packages/endpoint-auth/test/integration/200-metadata.js | 3 ++- .../test/integration/200-new-password-response.js | 5 +++-- packages/endpoint-auth/test/integration/200-new-password.js | 5 +++-- .../endpoint-auth/test/integration/200-token-grant-json.js | 4 +++- .../test/integration/200-token-grant-url-encoded.js | 4 +++- packages/endpoint-auth/test/integration/200-token-verify.js | 3 ++- .../endpoint-auth/test/integration/302-authorization.js | 3 ++- .../test/integration/302-consent-setup-password.js | 3 ++- .../integration/302-consent-submit-authenticate-with-me.js | 4 +++- .../test/integration/302-consent-submit-authenticate.js | 4 +++- .../test/integration/302-consent-submit-authorize.js | 4 +++- .../test/integration/302-well-known-change-password.js | 3 ++- .../test/integration/400-consent-invalid-request-uri.js | 3 ++- .../test/integration/400-consent-no-request-uri.js | 3 ++- .../test/integration/400-token-grant-invalid-grant-type.js | 3 ++- .../test/integration/400-token-grant-invalid-pkce-code.js | 4 +++- .../integration/400-token-grant-invalid-redirect-uri.js | 4 +++- .../test/integration/400-token-grant-no-client-id.js | 3 ++- .../test/integration/400-token-grant-no-code.js | 3 ++- .../test/integration/400-token-grant-no-redirect-uri.js | 3 ++- .../test/integration/401-token-grant-invalid-client-id.js | 4 +++- .../test/integration/401-token-grant-invalid-token.js | 3 ++- .../test/integration/422-consent-password-invalid.js | 5 +++-- .../test/integration/422-consent-password-missing.js | 5 +++-- .../test/integration/422-new-password-response.js | 5 +++-- .../test/integration/500-authorization-documentation.js | 3 ++- .../test/integration/501-token-grant-missing-secret.js | 3 ++- packages/endpoint-auth/test/unit/client.js | 2 ++ packages/endpoint-auth/test/unit/password.js | 1 + packages/endpoint-auth/test/unit/pkce.js | 1 + .../endpoint-auth/test/unit/pushed-authorization-request.js | 2 ++ packages/endpoint-auth/test/unit/redirect.js | 1 + packages/endpoint-auth/test/unit/scope.js | 2 ++ packages/endpoint-auth/test/unit/token.js | 1 + packages/endpoint-auth/test/unit/utils.js | 2 ++ packages/endpoint-files/index.js | 2 ++ packages/endpoint-files/lib/controllers/files.js | 1 + packages/endpoint-files/lib/controllers/form.js | 2 ++ packages/endpoint-files/lib/middleware/file-data.js | 2 ++ packages/endpoint-files/lib/utils.js | 1 + packages/endpoint-files/test/integration/200-file.js | 5 +++-- .../test/integration/200-files-no-database.js | 5 +++-- packages/endpoint-files/test/integration/200-files.js | 5 +++-- packages/endpoint-files/test/integration/200-get-delete.js | 5 +++-- packages/endpoint-files/test/integration/200-get-upload.js | 5 +++-- packages/endpoint-files/test/integration/302-get-delete.js | 3 ++- packages/endpoint-files/test/integration/302-get-upload.js | 3 ++- packages/endpoint-files/test/integration/302-post-delete.js | 3 ++- packages/endpoint-files/test/integration/302-post-upload.js | 3 ++- .../test/integration/401-post-delete-unauthorized.js | 3 ++- .../test/integration/401-post-upload-unauthorized.js | 5 +++-- packages/endpoint-files/test/integration/404-file.js | 3 ++- packages/endpoint-files/test/integration/422-post-upload.js | 5 +++-- packages/endpoint-files/test/unit/utils.js | 1 + packages/endpoint-json-feed/index.js | 2 ++ .../endpoint-json-feed/test/integration/200-feed-json.js | 3 ++- packages/endpoint-json-feed/test/unit/json-feed.js | 2 ++ packages/endpoint-media/index.js | 1 + packages/endpoint-media/lib/controllers/action.js | 1 + packages/endpoint-media/lib/controllers/query.js | 1 + packages/endpoint-media/lib/file.js | 1 + packages/endpoint-media/lib/media-data.js | 1 + packages/endpoint-media/lib/utils.js | 1 + .../endpoint-media/test/integration/200-action-upload.js | 3 ++- .../test/integration/200-query-source-no-database.js | 3 ++- .../endpoint-media/test/integration/200-query-source.js | 3 ++- .../endpoint-media/test/integration/202-action-delete.js | 3 ++- .../test/integration/400-action-delete-no-url.js | 3 ++- .../test/integration/400-action-upload-no-file.js | 3 ++- .../endpoint-media/test/integration/400-query-invalid.js | 3 ++- .../test/integration/400-query-source-url-no-database.js | 3 ++- .../test/integration/400-query-source-url-not-found.js | 3 ++- .../test/integration/401-action-upload-invalid-token.js | 3 ++- .../integration/403-action-upload-insufficient-scope.js | 3 ++- .../test/integration/404-action-delete-not-found.js | 3 ++- .../integration/415-action-upload-unsupported-media-type.js | 3 ++- .../test/integration/501-query-unsupported.js | 3 ++- .../test/integration/501-upload-unsupported-post-type.js | 3 ++- packages/endpoint-media/test/unit/file.js | 4 +++- packages/endpoint-media/test/unit/media-content.js | 4 +++- packages/endpoint-media/test/unit/media-data.js | 2 ++ packages/endpoint-media/test/unit/media-type-count.js | 2 ++ packages/endpoint-media/test/unit/scope.js | 1 + packages/endpoint-media/test/unit/utils.js | 1 + packages/endpoint-micropub/index.js | 1 + packages/endpoint-micropub/lib/controllers/action.js | 3 ++- packages/endpoint-micropub/lib/controllers/query.js | 1 + packages/endpoint-micropub/lib/jf2.js | 1 + packages/endpoint-micropub/lib/post-content.js | 1 + packages/endpoint-micropub/lib/post-data.js | 6 ++++-- packages/endpoint-micropub/lib/update.js | 1 + packages/endpoint-micropub/lib/utils.js | 1 + .../test/integration/200-action-update-ignored.js | 3 ++- .../test/integration/200-query-category.js | 3 ++- .../endpoint-micropub/test/integration/200-query-config.js | 3 ++- .../test/integration/200-query-media-endpoint.js | 3 ++- .../test/integration/200-query-post-types.js | 3 ++- .../test/integration/200-query-source-no-database.js | 3 ++- .../test/integration/200-query-source-url-property.js | 3 ++- .../test/integration/200-query-source-url.js | 3 ++- .../endpoint-micropub/test/integration/200-query-source.js | 3 ++- .../test/integration/200-query-syndicate-to.js | 3 ++- .../test/integration/202-action-create-draft.js | 3 ++- .../test/integration/202-action-create-form-encoded.js | 3 ++- .../test/integration/202-action-create-json.js | 3 ++- .../endpoint-micropub/test/integration/202-action-delete.js | 3 ++- .../test/integration/202-action-undelete.js | 3 ++- .../endpoint-micropub/test/integration/202-action-update.js | 3 ++- .../test/integration/400-action-delete-no-url.js | 3 ++- .../test/integration/400-action-update-no-operation.js | 3 ++- .../endpoint-micropub/test/integration/400-query-invalid.js | 3 ++- .../test/integration/400-query-source-url-no-database.js | 3 ++- .../test/integration/400-query-source-url-not-found.js | 3 ++- .../test/integration/401-action-invalid-token.js | 3 ++- .../test/integration/403-action-insufficient-scope.js | 3 ++- .../403-action-update-draft-insufficient-scope.js | 3 ++- .../test/integration/404-action-delete-not-found.js | 3 ++- .../test/integration/501-action-unsupported-post-type.js | 3 ++- .../test/integration/501-query-unsupported.js | 3 ++- packages/endpoint-micropub/test/unit/config.js | 4 +++- packages/endpoint-micropub/test/unit/jf2.js | 2 ++ packages/endpoint-micropub/test/unit/markdown.js | 1 + packages/endpoint-micropub/test/unit/media.js | 4 +++- packages/endpoint-micropub/test/unit/mf2.js | 2 ++ packages/endpoint-micropub/test/unit/post-content.js | 4 +++- packages/endpoint-micropub/test/unit/post-data.js | 2 ++ packages/endpoint-micropub/test/unit/post-type-count.js | 2 ++ packages/endpoint-micropub/test/unit/post-type-discovery.js | 1 + packages/endpoint-micropub/test/unit/scope.js | 1 + packages/endpoint-micropub/test/unit/update.js | 1 + packages/endpoint-micropub/test/unit/utils.js | 1 + packages/endpoint-posts/index.js | 4 +++- packages/endpoint-posts/lib/controllers/delete.js | 1 + packages/endpoint-posts/lib/controllers/form.js | 4 +++- packages/endpoint-posts/lib/controllers/new.js | 3 ++- packages/endpoint-posts/lib/controllers/post.js | 1 + packages/endpoint-posts/lib/controllers/posts.js | 2 ++ packages/endpoint-posts/lib/middleware/post-data.js | 2 ++ packages/endpoint-posts/lib/utils.js | 2 ++ packages/endpoint-posts/test/integration/200-get-create.js | 5 +++-- packages/endpoint-posts/test/integration/200-get-delete.js | 5 +++-- packages/endpoint-posts/test/integration/200-get-new.js | 5 +++-- packages/endpoint-posts/test/integration/200-post.js | 5 +++-- .../test/integration/200-posts-no-database.js | 5 +++-- packages/endpoint-posts/test/integration/200-posts.js | 5 +++-- packages/endpoint-posts/test/integration/302-get-create.js | 3 ++- packages/endpoint-posts/test/integration/302-get-delete.js | 5 +++-- packages/endpoint-posts/test/integration/302-post-create.js | 3 ++- packages/endpoint-posts/test/integration/302-post-delete.js | 5 +++-- packages/endpoint-posts/test/integration/404-post.js | 3 ++- packages/endpoint-posts/test/integration/422-post-create.js | 5 +++-- packages/endpoint-posts/test/integration/500-post-create.js | 5 +++-- packages/endpoint-posts/test/unit/utils.js | 2 ++ packages/endpoint-share/index.js | 1 + packages/endpoint-share/test/integration/200-get-share.js | 5 +++-- packages/endpoint-share/test/integration/302-post-share.js | 3 ++- packages/endpoint-share/test/integration/400-post-share.js | 5 +++-- packages/endpoint-share/test/integration/422-post-share.js | 5 +++-- packages/endpoint-syndicate/index.js | 1 + packages/endpoint-syndicate/lib/controllers/syndicate.js | 1 + packages/endpoint-syndicate/lib/token.js | 1 + .../test/integration/200-no-post-record-for-url.js | 3 ++- .../test/integration/200-no-post-records.js | 3 ++- .../test/integration/200-no-posts-awaiting-syndication.js | 3 ++- .../test/integration/200-no-syndication-targets.js | 3 ++- .../test/integration/200-syndicates-recent-post.js | 5 +++-- .../integration/200-syndicates-url-for-multiple-targets.js | 3 ++- .../test/integration/200-syndicates-url-for-target.js | 3 ++- .../endpoint-syndicate/test/integration/200-target-error.js | 3 ++- .../test/integration/302-syndicates-url-with-redirect.js | 3 ++- .../integration/403-syndicates-url-missing-update-scope.js | 3 ++- .../endpoint-syndicate/test/integration/500-no-database.js | 3 ++- packages/endpoint-syndicate/test/unit/token.js | 2 ++ packages/endpoint-syndicate/test/unit/utils.js | 2 ++ packages/error/test/index.js | 1 + packages/frontend/components/file-input/index.js | 1 + packages/frontend/lib/esbuild.js | 1 + packages/frontend/lib/lightningcss.js | 1 + packages/frontend/lib/markdown-it.js | 2 +- packages/frontend/lib/nunjucks.js | 2 ++ packages/frontend/lib/sharp.js | 2 ++ packages/frontend/test/unit/components/tag-input.js | 1 + packages/frontend/test/unit/filters/array.js | 1 + packages/frontend/test/unit/filters/locale.js | 1 + packages/frontend/test/unit/filters/string.js | 1 + packages/frontend/test/unit/filters/url.js | 1 + packages/frontend/test/unit/globals/attributes.js | 1 + packages/frontend/test/unit/globals/classes.js | 1 + packages/frontend/test/unit/globals/error-list.js | 1 + packages/frontend/test/unit/globals/field-data.js | 1 + packages/frontend/test/unit/globals/icon.js | 1 + packages/frontend/test/unit/globals/item-id.js | 1 + packages/frontend/test/unit/globals/summary-row.js | 1 + packages/frontend/test/unit/theme.js | 2 ++ packages/indiekit/bin/cli.js | 4 +++- packages/indiekit/config/express.js | 3 ++- packages/indiekit/index.js | 4 +++- packages/indiekit/lib/config.js | 3 ++- packages/indiekit/lib/controllers/manifest.js | 1 + packages/indiekit/lib/controllers/plugin.js | 1 + packages/indiekit/lib/indieauth.js | 4 +++- packages/indiekit/lib/locale-catalog.js | 1 + packages/indiekit/lib/middleware/locals.js | 1 + packages/indiekit/lib/routes.js | 4 +++- packages/indiekit/lib/utils.js | 2 +- packages/indiekit/test/index.js | 2 ++ packages/indiekit/test/integration/200-app-icon.js | 3 ++- packages/indiekit/test/integration/200-client.js | 3 ++- packages/indiekit/test/integration/200-feed-jf2.js | 3 ++- packages/indiekit/test/integration/200-homepage-view.js | 5 +++-- packages/indiekit/test/integration/200-manifest.js | 3 ++- packages/indiekit/test/integration/200-offline-view.js | 3 ++- packages/indiekit/test/integration/200-plugin-list.js | 5 +++-- packages/indiekit/test/integration/200-plugin-view.js | 5 +++-- packages/indiekit/test/integration/200-robots.js | 3 ++- packages/indiekit/test/integration/200-scripts.js | 3 ++- packages/indiekit/test/integration/200-session-auth.js | 3 ++- packages/indiekit/test/integration/200-session-localised.js | 5 +++-- packages/indiekit/test/integration/200-session-login.js | 3 ++- packages/indiekit/test/integration/200-shortcut-icon.js | 3 ++- packages/indiekit/test/integration/200-status-view.js | 5 +++-- packages/indiekit/test/integration/200-styles.js | 3 ++- .../indiekit/test/integration/302-session-login-auth.js | 3 ++- .../indiekit/test/integration/302-session-login-redirect.js | 3 ++- packages/indiekit/test/integration/302-session-logout.js | 3 ++- packages/indiekit/test/integration/302-status-redirect.js | 3 ++- .../indiekit/test/integration/400-session-missing-code.js | 3 ++- .../indiekit/test/integration/400-session-missing-state.js | 3 ++- .../test/integration/401-session-auth-invalid-token.js | 3 ++- .../test/integration/403-session-auth-invalid-redirect.js | 3 ++- .../test/integration/403-session-auth-invalid-state.js | 3 ++- packages/indiekit/test/integration/404-not-found.js | 3 ++- packages/indiekit/test/server.js | 2 ++ packages/indiekit/test/unit/cache.js | 4 +++- packages/indiekit/test/unit/categories.js | 4 +++- packages/indiekit/test/unit/endpoints.js | 2 ++ packages/indiekit/test/unit/indieauth.js | 4 +++- packages/indiekit/test/unit/middleware/error.js | 4 +++- packages/indiekit/test/unit/middleware/force-https.js | 2 ++ .../indiekit/test/unit/middleware/internationalisation.js | 2 ++ packages/indiekit/test/unit/middleware/locals.js | 2 ++ packages/indiekit/test/unit/mongodb.js | 2 ++ packages/indiekit/test/unit/navigation.js | 2 ++ packages/indiekit/test/unit/plugins.js | 1 + packages/indiekit/test/unit/post-template.js | 2 ++ packages/indiekit/test/unit/post-types.js | 2 ++ packages/indiekit/test/unit/shortcuts.js | 2 ++ packages/indiekit/test/unit/state.js | 1 + packages/indiekit/test/unit/store.js | 1 + packages/indiekit/test/unit/tokens.js | 2 ++ packages/indiekit/test/unit/utils.js | 1 + packages/preset-eleventy/test/index.js | 2 ++ packages/preset-eleventy/test/unit/post-template.js | 2 ++ packages/preset-eleventy/test/unit/post-types.js | 1 + packages/preset-hugo/lib/post-template.js | 2 +- packages/preset-hugo/test/index.js | 2 ++ packages/preset-hugo/test/unit/post-template.js | 2 ++ packages/preset-hugo/test/unit/post-types.js | 1 + packages/preset-jekyll/test/index.js | 2 ++ packages/preset-jekyll/test/unit/post-template.js | 2 ++ packages/preset-jekyll/test/unit/post-types.js | 1 + packages/store-bitbucket/index.js | 3 ++- packages/store-bitbucket/test/index.js | 4 +++- packages/store-file-system/index.js | 3 ++- packages/store-file-system/test/index.js | 4 +++- packages/store-ftp/index.js | 1 + packages/store-ftp/test/index.js | 2 ++ packages/store-gitea/index.js | 3 ++- packages/store-gitea/test/index.js | 2 ++ packages/store-github/index.js | 5 +++-- packages/store-github/test/index.js | 2 ++ packages/store-gitlab/index.js | 5 +++-- packages/store-gitlab/test/index.js | 2 ++ packages/store-s3/index.js | 3 ++- packages/store-s3/test/index.js | 4 +++- packages/syndicator-internet-archive/index.js | 2 ++ packages/syndicator-internet-archive/test/index.js | 4 +++- .../test/unit/internet-archive.js | 2 ++ packages/syndicator-mastodon/index.js | 2 ++ packages/syndicator-mastodon/lib/mastodon.js | 1 + packages/syndicator-mastodon/lib/utils.js | 3 ++- packages/syndicator-mastodon/test/index.js | 2 ++ packages/syndicator-mastodon/test/unit/mastodon.js | 2 ++ packages/syndicator-mastodon/test/unit/utils.js | 2 ++ packages/util/lib/date.js | 2 +- packages/util/lib/string.js | 1 + packages/util/test/unit/collection.js | 4 +++- packages/util/test/unit/date.js | 2 ++ packages/util/test/unit/object.js | 1 + packages/util/test/unit/string.js | 1 + packages/util/test/unit/url.js | 1 + packages/util/test/unit/validation-schema.js | 2 ++ 330 files changed, 640 insertions(+), 230 deletions(-) diff --git a/helpers/database/index.js b/helpers/database/index.js index 3e45932d6..f305908dc 100644 --- a/helpers/database/index.js +++ b/helpers/database/index.js @@ -1,5 +1,5 @@ -import { MongoMemoryServer } from "mongodb-memory-server"; import { getMongodbClient } from "@indiekit/indiekit/lib/mongodb.js"; +import { MongoMemoryServer } from "mongodb-memory-server"; export const testDatabase = async () => { const mongoServer = await MongoMemoryServer.create(); diff --git a/helpers/mock-agent/endpoint-auth.js b/helpers/mock-agent/endpoint-auth.js index c5c60ce96..301906c92 100644 --- a/helpers/mock-agent/endpoint-auth.js +++ b/helpers/mock-agent/endpoint-auth.js @@ -1,5 +1,5 @@ -import { MockAgent } from "undici"; import { getFixture } from "@indiekit-test/fixtures"; +import { MockAgent } from "undici"; /** * @returns {import("undici").MockAgent} Undici MockAgent diff --git a/helpers/mock-agent/endpoint-image.js b/helpers/mock-agent/endpoint-image.js index 6b8c815c2..1f12f9c0f 100644 --- a/helpers/mock-agent/endpoint-image.js +++ b/helpers/mock-agent/endpoint-image.js @@ -1,5 +1,5 @@ -import { MockAgent } from "undici"; import { getFixture } from "@indiekit-test/fixtures"; +import { MockAgent } from "undici"; /** * @returns {import("undici").MockAgent} Undici MockAgent diff --git a/helpers/mock-agent/endpoint-micropub.js b/helpers/mock-agent/endpoint-micropub.js index 61b127d83..8bef781aa 100644 --- a/helpers/mock-agent/endpoint-micropub.js +++ b/helpers/mock-agent/endpoint-micropub.js @@ -1,6 +1,6 @@ -import { MockAgent } from "undici"; import { getFixture } from "@indiekit-test/fixtures"; import { testToken } from "@indiekit-test/token"; +import { MockAgent } from "undici"; /** * @returns {import("undici").MockAgent} Undici MockAgent diff --git a/helpers/mock-agent/syndicator-mastodon.js b/helpers/mock-agent/syndicator-mastodon.js index 492fc8bd3..9e71ee2f7 100644 --- a/helpers/mock-agent/syndicator-mastodon.js +++ b/helpers/mock-agent/syndicator-mastodon.js @@ -1,5 +1,5 @@ -import { MockAgent } from "undici"; import { getFixture } from "@indiekit-test/fixtures"; +import { MockAgent } from "undici"; /** * @returns {import("undici").MockAgent} Undici MockAgent diff --git a/helpers/publication/index.js b/helpers/publication/index.js index c67fb57b8..89212ae8c 100644 --- a/helpers/publication/index.js +++ b/helpers/publication/index.js @@ -1,5 +1,5 @@ -import TestStore from "@indiekit-test/store"; import JekyllPreset from "@indiekit/preset-jekyll"; +import TestStore from "@indiekit-test/store"; export const publication = { categories: `https://website.example/categories.json`, diff --git a/helpers/server/index.js b/helpers/server/index.js index 466fd12b4..0fcc7b9a0 100644 --- a/helpers/server/index.js +++ b/helpers/server/index.js @@ -1,9 +1,10 @@ import { mock } from "node:test"; + import "dotenv/config.js"; -import getPort from "get-port"; +import { Indiekit } from "@indiekit/indiekit"; import { testConfig } from "@indiekit-test/config"; import { testDatabase } from "@indiekit-test/database"; -import { Indiekit } from "@indiekit/indiekit"; +import getPort from "get-port"; const { mongoUri } = await testDatabase(); const defaultOptions = { mongodbUrl: mongoUri }; diff --git a/helpers/session/index.js b/helpers/session/index.js index e16f5ede3..5c3eeb160 100644 --- a/helpers/session/index.js +++ b/helpers/session/index.js @@ -1,6 +1,7 @@ import process from "node:process"; -import mockSession from "mock-session"; + import { testToken } from "@indiekit-test/token"; +import mockSession from "mock-session"; export const testCookie = (options) => { return mockSession("test", process.env.SECRET, { diff --git a/packages/create-indiekit/bin/create.js b/packages/create-indiekit/bin/create.js index 84728a9c9..af93ce7ca 100755 --- a/packages/create-indiekit/bin/create.js +++ b/packages/create-indiekit/bin/create.js @@ -1,5 +1,6 @@ #!/usr/bin/env node import process from "node:process"; + import { init } from "../index.js"; import { checkNodeVersion } from "../lib/utils.js"; diff --git a/packages/create-indiekit/index.js b/packages/create-indiekit/index.js index c59e8e698..91669754a 100644 --- a/packages/create-indiekit/index.js +++ b/packages/create-indiekit/index.js @@ -1,11 +1,14 @@ #!/usr/bin/env node import { createRequire } from "node:module"; + import create from "base-create"; import chalk from "chalk"; import prompts from "prompts"; -import { setupPrompts } from "./lib/setup-prompts.js"; + import { getFiles } from "./lib/files.js"; import { getPackageValues } from "./lib/package.js"; +import { setupPrompts } from "./lib/setup-prompts.js"; + // eslint-ignore import/order const require = createRequire(import.meta.url); const { name, version, bugs } = require("./package.json"); diff --git a/packages/create-indiekit/lib/docker.js b/packages/create-indiekit/lib/docker.js index 1d13e1cf0..b9ab34bf6 100644 --- a/packages/create-indiekit/lib/docker.js +++ b/packages/create-indiekit/lib/docker.js @@ -1,4 +1,5 @@ import YAML from "yaml"; + import { getPlugin } from "./utils.js"; /** diff --git a/packages/create-indiekit/lib/files.js b/packages/create-indiekit/lib/files.js index 03a7d3db4..4769abc46 100644 --- a/packages/create-indiekit/lib/files.js +++ b/packages/create-indiekit/lib/files.js @@ -1,7 +1,8 @@ #!/usr/bin/env node import { readFile } from "node:fs/promises"; -import process from "node:process"; import path from "node:path"; +import process from "node:process"; + import { getDockerComposeFileContent, getDockerEnvironment } from "./docker.js"; /** diff --git a/packages/create-indiekit/lib/utils.js b/packages/create-indiekit/lib/utils.js index 72f4d82b0..ddc21f7ab 100644 --- a/packages/create-indiekit/lib/utils.js +++ b/packages/create-indiekit/lib/utils.js @@ -1,5 +1,6 @@ #!/usr/bin/env node import process from "node:process"; + import chalk from "chalk"; import prompts from "prompts"; diff --git a/packages/create-indiekit/test/unit/docker.js b/packages/create-indiekit/test/unit/docker.js index a2e56f850..08042e79a 100644 --- a/packages/create-indiekit/test/unit/docker.js +++ b/packages/create-indiekit/test/unit/docker.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getDockerComposeFileContent, getDockerEnvironment, diff --git a/packages/create-indiekit/test/unit/files.js b/packages/create-indiekit/test/unit/files.js index 73f4b29fb..872eed6d0 100644 --- a/packages/create-indiekit/test/unit/files.js +++ b/packages/create-indiekit/test/unit/files.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it, mock } from "node:test"; + import { getFileContents, getFiles } from "../../lib/files.js"; describe("create-indiekit/lib/files", () => { diff --git a/packages/create-indiekit/test/unit/package.js b/packages/create-indiekit/test/unit/package.js index b1ae6d13d..94bb97bdc 100644 --- a/packages/create-indiekit/test/unit/package.js +++ b/packages/create-indiekit/test/unit/package.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it, mock } from "node:test"; + import { getPackageValues } from "../../lib/package.js"; describe("create-indiekit/lib/package", () => { diff --git a/packages/create-indiekit/test/unit/setup-prompts.js b/packages/create-indiekit/test/unit/setup-prompts.js index 08836d920..355d3946f 100644 --- a/packages/create-indiekit/test/unit/setup-prompts.js +++ b/packages/create-indiekit/test/unit/setup-prompts.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { setupPrompts } from "../../lib/setup-prompts.js"; describe("create-indiekit/lib/setup-prompts", () => { diff --git a/packages/create-indiekit/test/unit/utils.js b/packages/create-indiekit/test/unit/utils.js index 33e76b3d8..0957118af 100644 --- a/packages/create-indiekit/test/unit/utils.js +++ b/packages/create-indiekit/test/unit/utils.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it, mock } from "node:test"; + import { addPluginConfig, checkNodeVersion, diff --git a/packages/endpoint-auth/index.js b/packages/endpoint-auth/index.js index dbc1812aa..620258aa7 100644 --- a/packages/endpoint-auth/index.js +++ b/packages/endpoint-auth/index.js @@ -1,4 +1,5 @@ import express from "express"; + import { authorizationController } from "./lib/controllers/authorization.js"; import { consentController } from "./lib/controllers/consent.js"; import { documentationController } from "./lib/controllers/documentation.js"; diff --git a/packages/endpoint-auth/lib/controllers/authorization.js b/packages/endpoint-auth/lib/controllers/authorization.js index 4eb1b267a..f33cedff7 100644 --- a/packages/endpoint-auth/lib/controllers/authorization.js +++ b/packages/endpoint-auth/lib/controllers/authorization.js @@ -1,5 +1,6 @@ import { IndiekitError } from "@indiekit/error"; import { getCanonicalUrl } from "@indiekit/util"; + import { getClientInformation } from "../client.js"; import { createRequestUri } from "../pushed-authorization-request.js"; import { validateRedirect } from "../redirect.js"; diff --git a/packages/endpoint-auth/lib/controllers/consent.js b/packages/endpoint-auth/lib/controllers/consent.js index 1f1083588..9c74f5e06 100644 --- a/packages/endpoint-auth/lib/controllers/consent.js +++ b/packages/endpoint-auth/lib/controllers/consent.js @@ -1,6 +1,8 @@ import process from "node:process"; + import { IndiekitError } from "@indiekit/error"; import { validationResult } from "express-validator"; + import { getRequestUriData } from "../pushed-authorization-request.js"; import { getScopeItems } from "../scope.js"; import { signToken } from "../token.js"; diff --git a/packages/endpoint-auth/lib/controllers/password.js b/packages/endpoint-auth/lib/controllers/password.js index 217c5580b..11ae084b7 100644 --- a/packages/endpoint-auth/lib/controllers/password.js +++ b/packages/endpoint-auth/lib/controllers/password.js @@ -1,4 +1,5 @@ import { validationResult } from "express-validator"; + import { createPasswordHash } from "../password.js"; export const passwordController = { diff --git a/packages/endpoint-auth/lib/middleware/code.js b/packages/endpoint-auth/lib/middleware/code.js index 821daf05c..ef925d01b 100644 --- a/packages/endpoint-auth/lib/middleware/code.js +++ b/packages/endpoint-auth/lib/middleware/code.js @@ -1,5 +1,6 @@ import { IndiekitError } from "@indiekit/error"; import { getCanonicalUrl } from "@indiekit/util"; + import { verifyCode } from "../pkce.js"; import { validateRedirect } from "../redirect.js"; import { verifyToken } from "../token.js"; diff --git a/packages/endpoint-auth/lib/middleware/secret.js b/packages/endpoint-auth/lib/middleware/secret.js index 683051d61..9f4c0edc0 100644 --- a/packages/endpoint-auth/lib/middleware/secret.js +++ b/packages/endpoint-auth/lib/middleware/secret.js @@ -1,4 +1,5 @@ import process from "node:process"; + import { IndiekitError } from "@indiekit/error"; /** diff --git a/packages/endpoint-auth/lib/middleware/validation.js b/packages/endpoint-auth/lib/middleware/validation.js index 97d84e383..2625a9905 100644 --- a/packages/endpoint-auth/lib/middleware/validation.js +++ b/packages/endpoint-auth/lib/middleware/validation.js @@ -1,4 +1,5 @@ import { check } from "express-validator"; + import { verifyPassword } from "../password.js"; export const consentValidator = [ diff --git a/packages/endpoint-auth/lib/password.js b/packages/endpoint-auth/lib/password.js index ed232440a..1e02eb8cb 100644 --- a/packages/endpoint-auth/lib/password.js +++ b/packages/endpoint-auth/lib/password.js @@ -1,4 +1,5 @@ import process from "node:process"; + import bcrypt from "bcrypt"; /** diff --git a/packages/endpoint-auth/lib/token.js b/packages/endpoint-auth/lib/token.js index 1434a1d4f..6022ee7fd 100644 --- a/packages/endpoint-auth/lib/token.js +++ b/packages/endpoint-auth/lib/token.js @@ -1,4 +1,5 @@ import process from "node:process"; + import jwt from "jsonwebtoken"; /** diff --git a/packages/endpoint-auth/test/integration/200-authorization-documentation.js b/packages/endpoint-auth/test/integration/200-authorization-documentation.js index b03406bfd..42d1a69f9 100644 --- a/packages/endpoint-auth/test/integration/200-authorization-documentation.js +++ b/packages/endpoint-auth/test/integration/200-authorization-documentation.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/integration/200-authorization-invalid-client-id.js b/packages/endpoint-auth/test/integration/200-authorization-invalid-client-id.js index a505d7d4a..2eafaba22 100644 --- a/packages/endpoint-auth/test/integration/200-authorization-invalid-client-id.js +++ b/packages/endpoint-auth/test/integration/200-authorization-invalid-client-id.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("endpoint-auth"); const server = await testServer(); diff --git a/packages/endpoint-auth/test/integration/200-authorization-invalid-redirect-uri.js b/packages/endpoint-auth/test/integration/200-authorization-invalid-redirect-uri.js index e4ad9de34..a298421e4 100644 --- a/packages/endpoint-auth/test/integration/200-authorization-invalid-redirect-uri.js +++ b/packages/endpoint-auth/test/integration/200-authorization-invalid-redirect-uri.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("endpoint-auth"); const server = await testServer(); diff --git a/packages/endpoint-auth/test/integration/200-authorization-invalid-response-type.js b/packages/endpoint-auth/test/integration/200-authorization-invalid-response-type.js index 178514f3a..fbd644953 100644 --- a/packages/endpoint-auth/test/integration/200-authorization-invalid-response-type.js +++ b/packages/endpoint-auth/test/integration/200-authorization-invalid-response-type.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("endpoint-auth"); const server = await testServer(); diff --git a/packages/endpoint-auth/test/integration/200-authorization-no-response-type.js b/packages/endpoint-auth/test/integration/200-authorization-no-response-type.js index d295525aa..362305dfa 100644 --- a/packages/endpoint-auth/test/integration/200-authorization-no-response-type.js +++ b/packages/endpoint-auth/test/integration/200-authorization-no-response-type.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("endpoint-auth"); const server = await testServer(); diff --git a/packages/endpoint-auth/test/integration/200-authorization-profile-json.js b/packages/endpoint-auth/test/integration/200-authorization-profile-json.js index 31d5388c0..b0260d15e 100644 --- a/packages/endpoint-auth/test/integration/200-authorization-profile-json.js +++ b/packages/endpoint-auth/test/integration/200-authorization-profile-json.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; + import { signToken } from "../../lib/token.js"; await mockAgent("endpoint-auth"); diff --git a/packages/endpoint-auth/test/integration/200-authorization-profile-url-encoded.js b/packages/endpoint-auth/test/integration/200-authorization-profile-url-encoded.js index 64923bd96..fee0e7e41 100644 --- a/packages/endpoint-auth/test/integration/200-authorization-profile-url-encoded.js +++ b/packages/endpoint-auth/test/integration/200-authorization-profile-url-encoded.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; + import { signToken } from "../../lib/token.js"; await mockAgent("endpoint-auth"); diff --git a/packages/endpoint-auth/test/integration/200-consent-authenticate.js b/packages/endpoint-auth/test/integration/200-consent-authenticate.js index a553dec15..31bd77aa4 100644 --- a/packages/endpoint-auth/test/integration/200-consent-authenticate.js +++ b/packages/endpoint-auth/test/integration/200-consent-authenticate.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; + import { createPasswordHash } from "../../lib/password.js"; await mockAgent("endpoint-auth"); diff --git a/packages/endpoint-auth/test/integration/200-consent-authorize.js b/packages/endpoint-auth/test/integration/200-consent-authorize.js index 516ec09c3..2d1e6dbf8 100644 --- a/packages/endpoint-auth/test/integration/200-consent-authorize.js +++ b/packages/endpoint-auth/test/integration/200-consent-authorize.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; + import { createPasswordHash } from "../../lib/password.js"; await mockAgent("endpoint-auth"); diff --git a/packages/endpoint-auth/test/integration/200-introspect-token-active.js b/packages/endpoint-auth/test/integration/200-introspect-token-active.js index 94f4dc546..3dacc04ef 100644 --- a/packages/endpoint-auth/test/integration/200-introspect-token-active.js +++ b/packages/endpoint-auth/test/integration/200-introspect-token-active.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/integration/200-introspect-token-inactive.js b/packages/endpoint-auth/test/integration/200-introspect-token-inactive.js index d9242c67c..79f1d9b1b 100644 --- a/packages/endpoint-auth/test/integration/200-introspect-token-inactive.js +++ b/packages/endpoint-auth/test/integration/200-introspect-token-inactive.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/integration/200-metadata.js b/packages/endpoint-auth/test/integration/200-metadata.js index 3b6edc08e..d360d5fb3 100644 --- a/packages/endpoint-auth/test/integration/200-metadata.js +++ b/packages/endpoint-auth/test/integration/200-metadata.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/integration/200-new-password-response.js b/packages/endpoint-auth/test/integration/200-new-password-response.js index 4f619fe94..c81c6ae53 100644 --- a/packages/endpoint-auth/test/integration/200-new-password-response.js +++ b/packages/endpoint-auth/test/integration/200-new-password-response.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/integration/200-new-password.js b/packages/endpoint-auth/test/integration/200-new-password.js index cdcf4f070..a49a5cf0d 100644 --- a/packages/endpoint-auth/test/integration/200-new-password.js +++ b/packages/endpoint-auth/test/integration/200-new-password.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/integration/200-token-grant-json.js b/packages/endpoint-auth/test/integration/200-token-grant-json.js index 87105c075..4aff4aae0 100644 --- a/packages/endpoint-auth/test/integration/200-token-grant-json.js +++ b/packages/endpoint-auth/test/integration/200-token-grant-json.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; + import { signToken } from "../../lib/token.js"; await mockAgent("endpoint-auth"); diff --git a/packages/endpoint-auth/test/integration/200-token-grant-url-encoded.js b/packages/endpoint-auth/test/integration/200-token-grant-url-encoded.js index b438291f3..6705a34f3 100644 --- a/packages/endpoint-auth/test/integration/200-token-grant-url-encoded.js +++ b/packages/endpoint-auth/test/integration/200-token-grant-url-encoded.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; + import { signToken } from "../../lib/token.js"; await mockAgent("endpoint-auth"); diff --git a/packages/endpoint-auth/test/integration/200-token-verify.js b/packages/endpoint-auth/test/integration/200-token-verify.js index 2626163ff..1ab5618fc 100644 --- a/packages/endpoint-auth/test/integration/200-token-verify.js +++ b/packages/endpoint-auth/test/integration/200-token-verify.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/integration/302-authorization.js b/packages/endpoint-auth/test/integration/302-authorization.js index aa8ed1be7..1d2a44d18 100644 --- a/packages/endpoint-auth/test/integration/302-authorization.js +++ b/packages/endpoint-auth/test/integration/302-authorization.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("endpoint-auth"); const server = await testServer(); diff --git a/packages/endpoint-auth/test/integration/302-consent-setup-password.js b/packages/endpoint-auth/test/integration/302-consent-setup-password.js index 4d6794ee5..5cb6c96dd 100644 --- a/packages/endpoint-auth/test/integration/302-consent-setup-password.js +++ b/packages/endpoint-auth/test/integration/302-consent-setup-password.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("endpoint-auth"); const server = await testServer(); diff --git a/packages/endpoint-auth/test/integration/302-consent-submit-authenticate-with-me.js b/packages/endpoint-auth/test/integration/302-consent-submit-authenticate-with-me.js index 61d2c9a54..70c5ae542 100644 --- a/packages/endpoint-auth/test/integration/302-consent-submit-authenticate-with-me.js +++ b/packages/endpoint-auth/test/integration/302-consent-submit-authenticate-with-me.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; + import { createPasswordHash } from "../../lib/password.js"; await mockAgent("endpoint-auth"); diff --git a/packages/endpoint-auth/test/integration/302-consent-submit-authenticate.js b/packages/endpoint-auth/test/integration/302-consent-submit-authenticate.js index 874dfc22d..c93fa6fd9 100644 --- a/packages/endpoint-auth/test/integration/302-consent-submit-authenticate.js +++ b/packages/endpoint-auth/test/integration/302-consent-submit-authenticate.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; + import { createPasswordHash } from "../../lib/password.js"; await mockAgent("endpoint-auth"); diff --git a/packages/endpoint-auth/test/integration/302-consent-submit-authorize.js b/packages/endpoint-auth/test/integration/302-consent-submit-authorize.js index e135d9f91..980d2e734 100644 --- a/packages/endpoint-auth/test/integration/302-consent-submit-authorize.js +++ b/packages/endpoint-auth/test/integration/302-consent-submit-authorize.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; + import { createPasswordHash } from "../../lib/password.js"; await mockAgent("endpoint-auth"); diff --git a/packages/endpoint-auth/test/integration/302-well-known-change-password.js b/packages/endpoint-auth/test/integration/302-well-known-change-password.js index ceb507c84..0251ec92e 100644 --- a/packages/endpoint-auth/test/integration/302-well-known-change-password.js +++ b/packages/endpoint-auth/test/integration/302-well-known-change-password.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("endpoint-auth"); const server = await testServer(); diff --git a/packages/endpoint-auth/test/integration/400-consent-invalid-request-uri.js b/packages/endpoint-auth/test/integration/400-consent-invalid-request-uri.js index 37c3497f8..723b8def8 100644 --- a/packages/endpoint-auth/test/integration/400-consent-invalid-request-uri.js +++ b/packages/endpoint-auth/test/integration/400-consent-invalid-request-uri.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/integration/400-consent-no-request-uri.js b/packages/endpoint-auth/test/integration/400-consent-no-request-uri.js index 0815d026e..306020333 100644 --- a/packages/endpoint-auth/test/integration/400-consent-no-request-uri.js +++ b/packages/endpoint-auth/test/integration/400-consent-no-request-uri.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/integration/400-token-grant-invalid-grant-type.js b/packages/endpoint-auth/test/integration/400-token-grant-invalid-grant-type.js index dcf6fa96f..feab0ef26 100644 --- a/packages/endpoint-auth/test/integration/400-token-grant-invalid-grant-type.js +++ b/packages/endpoint-auth/test/integration/400-token-grant-invalid-grant-type.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("endpoint-auth"); const server = await testServer(); diff --git a/packages/endpoint-auth/test/integration/400-token-grant-invalid-pkce-code.js b/packages/endpoint-auth/test/integration/400-token-grant-invalid-pkce-code.js index d367df3a6..b1719dbaf 100644 --- a/packages/endpoint-auth/test/integration/400-token-grant-invalid-pkce-code.js +++ b/packages/endpoint-auth/test/integration/400-token-grant-invalid-pkce-code.js @@ -1,9 +1,11 @@ import { strict as assert } from "node:assert"; import { createHash } from "node:crypto"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; + import { signToken } from "../../lib/token.js"; await mockAgent("endpoint-auth"); diff --git a/packages/endpoint-auth/test/integration/400-token-grant-invalid-redirect-uri.js b/packages/endpoint-auth/test/integration/400-token-grant-invalid-redirect-uri.js index 27d509495..4154dae94 100644 --- a/packages/endpoint-auth/test/integration/400-token-grant-invalid-redirect-uri.js +++ b/packages/endpoint-auth/test/integration/400-token-grant-invalid-redirect-uri.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; + import { signToken } from "../../lib/token.js"; await mockAgent("endpoint-auth"); diff --git a/packages/endpoint-auth/test/integration/400-token-grant-no-client-id.js b/packages/endpoint-auth/test/integration/400-token-grant-no-client-id.js index 5c3bdb76e..112c3cdd3 100644 --- a/packages/endpoint-auth/test/integration/400-token-grant-no-client-id.js +++ b/packages/endpoint-auth/test/integration/400-token-grant-no-client-id.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("endpoint-auth"); const server = await testServer(); diff --git a/packages/endpoint-auth/test/integration/400-token-grant-no-code.js b/packages/endpoint-auth/test/integration/400-token-grant-no-code.js index 906435b3f..92f438844 100644 --- a/packages/endpoint-auth/test/integration/400-token-grant-no-code.js +++ b/packages/endpoint-auth/test/integration/400-token-grant-no-code.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/integration/400-token-grant-no-redirect-uri.js b/packages/endpoint-auth/test/integration/400-token-grant-no-redirect-uri.js index a1e052091..d090ed056 100644 --- a/packages/endpoint-auth/test/integration/400-token-grant-no-redirect-uri.js +++ b/packages/endpoint-auth/test/integration/400-token-grant-no-redirect-uri.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/integration/401-token-grant-invalid-client-id.js b/packages/endpoint-auth/test/integration/401-token-grant-invalid-client-id.js index c808d2f22..e3373d129 100644 --- a/packages/endpoint-auth/test/integration/401-token-grant-invalid-client-id.js +++ b/packages/endpoint-auth/test/integration/401-token-grant-invalid-client-id.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; + import { signToken } from "../../lib/token.js"; await mockAgent("endpoint-auth"); diff --git a/packages/endpoint-auth/test/integration/401-token-grant-invalid-token.js b/packages/endpoint-auth/test/integration/401-token-grant-invalid-token.js index c427f7fc8..145645091 100644 --- a/packages/endpoint-auth/test/integration/401-token-grant-invalid-token.js +++ b/packages/endpoint-auth/test/integration/401-token-grant-invalid-token.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("endpoint-auth"); const server = await testServer(); diff --git a/packages/endpoint-auth/test/integration/422-consent-password-invalid.js b/packages/endpoint-auth/test/integration/422-consent-password-invalid.js index 54e0dd160..4b9e40d24 100644 --- a/packages/endpoint-auth/test/integration/422-consent-password-invalid.js +++ b/packages/endpoint-auth/test/integration/422-consent-password-invalid.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; await mockAgent("endpoint-auth"); const server = await testServer(); diff --git a/packages/endpoint-auth/test/integration/422-consent-password-missing.js b/packages/endpoint-auth/test/integration/422-consent-password-missing.js index dc11b2ae7..4012642e2 100644 --- a/packages/endpoint-auth/test/integration/422-consent-password-missing.js +++ b/packages/endpoint-auth/test/integration/422-consent-password-missing.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; await mockAgent("endpoint-auth"); const server = await testServer(); diff --git a/packages/endpoint-auth/test/integration/422-new-password-response.js b/packages/endpoint-auth/test/integration/422-new-password-response.js index 6ec425a45..0278a2a42 100644 --- a/packages/endpoint-auth/test/integration/422-new-password-response.js +++ b/packages/endpoint-auth/test/integration/422-new-password-response.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/integration/500-authorization-documentation.js b/packages/endpoint-auth/test/integration/500-authorization-documentation.js index 454d58c63..cb5a4407e 100644 --- a/packages/endpoint-auth/test/integration/500-authorization-documentation.js +++ b/packages/endpoint-auth/test/integration/500-authorization-documentation.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/integration/501-token-grant-missing-secret.js b/packages/endpoint-auth/test/integration/501-token-grant-missing-secret.js index 08e35ccdf..18e902510 100644 --- a/packages/endpoint-auth/test/integration/501-token-grant-missing-secret.js +++ b/packages/endpoint-auth/test/integration/501-token-grant-missing-secret.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-auth/test/unit/client.js b/packages/endpoint-auth/test/unit/client.js index 214ba33ed..20d95a42b 100644 --- a/packages/endpoint-auth/test/unit/client.js +++ b/packages/endpoint-auth/test/unit/client.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { mockAgent } from "@indiekit-test/mock-agent"; + import { getClientInformation } from "../../lib/client.js"; await mockAgent("endpoint-auth"); diff --git a/packages/endpoint-auth/test/unit/password.js b/packages/endpoint-auth/test/unit/password.js index 2e96cad49..b7cb32be4 100644 --- a/packages/endpoint-auth/test/unit/password.js +++ b/packages/endpoint-auth/test/unit/password.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { createPasswordHash, verifyPassword } from "../../lib/password.js"; describe("endpoint-auth/lib/client", () => { diff --git a/packages/endpoint-auth/test/unit/pkce.js b/packages/endpoint-auth/test/unit/pkce.js index 325f5b739..7c72f27f2 100644 --- a/packages/endpoint-auth/test/unit/pkce.js +++ b/packages/endpoint-auth/test/unit/pkce.js @@ -1,6 +1,7 @@ import { strict as assert } from "node:assert"; import { createHash, randomBytes } from "node:crypto"; import { describe, it } from "node:test"; + import { verifyCode } from "../../lib/pkce.js"; describe("endpoint-auth/lib/pkce", () => { diff --git a/packages/endpoint-auth/test/unit/pushed-authorization-request.js b/packages/endpoint-auth/test/unit/pushed-authorization-request.js index 2d000af5d..058c17d59 100644 --- a/packages/endpoint-auth/test/unit/pushed-authorization-request.js +++ b/packages/endpoint-auth/test/unit/pushed-authorization-request.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { mockRequest } from "mock-req-res"; + import { createRequestUri, getRequestUriData, diff --git a/packages/endpoint-auth/test/unit/redirect.js b/packages/endpoint-auth/test/unit/redirect.js index 28387a5b2..2f119150d 100644 --- a/packages/endpoint-auth/test/unit/redirect.js +++ b/packages/endpoint-auth/test/unit/redirect.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { validateRedirect } from "../../lib/redirect.js"; describe("endpoint-auth/lib/redirect", () => { diff --git a/packages/endpoint-auth/test/unit/scope.js b/packages/endpoint-auth/test/unit/scope.js index 8b2214934..f1721f38c 100644 --- a/packages/endpoint-auth/test/unit/scope.js +++ b/packages/endpoint-auth/test/unit/scope.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { mockResponse } from "mock-req-res"; + import { getScopeItems } from "../../lib/scope.js"; describe("endpoint-auth/lib/scope", () => { diff --git a/packages/endpoint-auth/test/unit/token.js b/packages/endpoint-auth/test/unit/token.js index 9a3e0c17d..2af481df2 100644 --- a/packages/endpoint-auth/test/unit/token.js +++ b/packages/endpoint-auth/test/unit/token.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { signToken, verifyToken } from "../../lib/token.js"; describe("endpoint-auth/lib/token", () => { diff --git a/packages/endpoint-auth/test/unit/utils.js b/packages/endpoint-auth/test/unit/utils.js index dd59a2543..b64245fe2 100644 --- a/packages/endpoint-auth/test/unit/utils.js +++ b/packages/endpoint-auth/test/unit/utils.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { mockRequest } from "mock-req-res"; + import { getRequestParameters } from "../../lib/utils.js"; describe("endpoint-auth/lib/utils", () => { diff --git a/packages/endpoint-files/index.js b/packages/endpoint-files/index.js index 1af2f7f9d..542096fc0 100644 --- a/packages/endpoint-files/index.js +++ b/packages/endpoint-files/index.js @@ -1,5 +1,7 @@ import path from "node:path"; + import express from "express"; + import { deleteController } from "./lib/controllers/delete.js"; import { fileController } from "./lib/controllers/file.js"; import { filesController } from "./lib/controllers/files.js"; diff --git a/packages/endpoint-files/lib/controllers/files.js b/packages/endpoint-files/lib/controllers/files.js index c70c9e441..26ac124da 100644 --- a/packages/endpoint-files/lib/controllers/files.js +++ b/packages/endpoint-files/lib/controllers/files.js @@ -1,4 +1,5 @@ import path from "node:path"; + import { endpoint } from "../endpoint.js"; import { getFileName } from "../utils.js"; diff --git a/packages/endpoint-files/lib/controllers/form.js b/packages/endpoint-files/lib/controllers/form.js index b485a00dc..0373838b7 100644 --- a/packages/endpoint-files/lib/controllers/form.js +++ b/packages/endpoint-files/lib/controllers/form.js @@ -1,5 +1,7 @@ import path from "node:path"; + import { validationResult } from "express-validator"; + import { endpoint } from "../endpoint.js"; export const formController = { diff --git a/packages/endpoint-files/lib/middleware/file-data.js b/packages/endpoint-files/lib/middleware/file-data.js index fa5c3e153..d4dec7269 100644 --- a/packages/endpoint-files/lib/middleware/file-data.js +++ b/packages/endpoint-files/lib/middleware/file-data.js @@ -1,5 +1,7 @@ import path from "node:path"; + import { IndiekitError } from "@indiekit/error"; + import { getFileProperties, getFileName } from "../utils.js"; export const fileData = { diff --git a/packages/endpoint-files/lib/utils.js b/packages/endpoint-files/lib/utils.js index 419a10f88..cc94b6533 100644 --- a/packages/endpoint-files/lib/utils.js +++ b/packages/endpoint-files/lib/utils.js @@ -1,4 +1,5 @@ import { Buffer } from "node:buffer"; + import { endpoint } from "./endpoint.js"; /** diff --git a/packages/endpoint-files/test/integration/200-file.js b/packages/endpoint-files/test/integration/200-file.js index f499a0e36..5b851c746 100644 --- a/packages/endpoint-files/test/integration/200-file.js +++ b/packages/endpoint-files/test/integration/200-file.js @@ -1,10 +1,11 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import { JSDOM } from "jsdom"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; await mockAgent("endpoint-files"); const server = await testServer({ diff --git a/packages/endpoint-files/test/integration/200-files-no-database.js b/packages/endpoint-files/test/integration/200-files-no-database.js index 667f429c8..d36a7c23a 100644 --- a/packages/endpoint-files/test/integration/200-files-no-database.js +++ b/packages/endpoint-files/test/integration/200-files-no-database.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer({ mongodbUrl: false }); const request = supertest.agent(server); diff --git a/packages/endpoint-files/test/integration/200-files.js b/packages/endpoint-files/test/integration/200-files.js index bb9200f6f..923cbc573 100644 --- a/packages/endpoint-files/test/integration/200-files.js +++ b/packages/endpoint-files/test/integration/200-files.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-files/test/integration/200-get-delete.js b/packages/endpoint-files/test/integration/200-get-delete.js index 2298c8d45..baa135e1a 100644 --- a/packages/endpoint-files/test/integration/200-get-delete.js +++ b/packages/endpoint-files/test/integration/200-get-delete.js @@ -1,10 +1,11 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; await mockAgent("endpoint-files"); const server = await testServer({ diff --git a/packages/endpoint-files/test/integration/200-get-upload.js b/packages/endpoint-files/test/integration/200-get-upload.js index eeb75b105..fd98e3033 100644 --- a/packages/endpoint-files/test/integration/200-get-upload.js +++ b/packages/endpoint-files/test/integration/200-get-upload.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-files/test/integration/302-get-delete.js b/packages/endpoint-files/test/integration/302-get-delete.js index 9a8c1c69f..c5c5504eb 100644 --- a/packages/endpoint-files/test/integration/302-get-delete.js +++ b/packages/endpoint-files/test/integration/302-get-delete.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import supertest from "supertest"; await mockAgent("endpoint-files"); const server = await testServer({ diff --git a/packages/endpoint-files/test/integration/302-get-upload.js b/packages/endpoint-files/test/integration/302-get-upload.js index d6ded6493..93f411523 100644 --- a/packages/endpoint-files/test/integration/302-get-upload.js +++ b/packages/endpoint-files/test/integration/302-get-upload.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-files/test/integration/302-post-delete.js b/packages/endpoint-files/test/integration/302-post-delete.js index 629c8c471..671cf911d 100644 --- a/packages/endpoint-files/test/integration/302-post-delete.js +++ b/packages/endpoint-files/test/integration/302-post-delete.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import supertest from "supertest"; await mockAgent("endpoint-files"); const server = await testServer({ diff --git a/packages/endpoint-files/test/integration/302-post-upload.js b/packages/endpoint-files/test/integration/302-post-upload.js index 2841fbe99..53b31c289 100644 --- a/packages/endpoint-files/test/integration/302-post-upload.js +++ b/packages/endpoint-files/test/integration/302-post-upload.js @@ -1,10 +1,11 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { getFixture } from "@indiekit-test/fixtures"; import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import supertest from "supertest"; await mockAgent("endpoint-files"); const server = await testServer({ diff --git a/packages/endpoint-files/test/integration/401-post-delete-unauthorized.js b/packages/endpoint-files/test/integration/401-post-delete-unauthorized.js index 0cade750f..b876186af 100644 --- a/packages/endpoint-files/test/integration/401-post-delete-unauthorized.js +++ b/packages/endpoint-files/test/integration/401-post-delete-unauthorized.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import supertest from "supertest"; await mockAgent("endpoint-files"); const server = await testServer({ diff --git a/packages/endpoint-files/test/integration/401-post-upload-unauthorized.js b/packages/endpoint-files/test/integration/401-post-upload-unauthorized.js index 8dae277c9..00d5a3703 100644 --- a/packages/endpoint-files/test/integration/401-post-upload-unauthorized.js +++ b/packages/endpoint-files/test/integration/401-post-upload-unauthorized.js @@ -1,11 +1,12 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import { JSDOM } from "jsdom"; -import supertest from "supertest"; + import { getFixture } from "@indiekit-test/fixtures"; import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; await mockAgent("endpoint-files"); const server = await testServer({ diff --git a/packages/endpoint-files/test/integration/404-file.js b/packages/endpoint-files/test/integration/404-file.js index c33d33c03..7d1ca69e1 100644 --- a/packages/endpoint-files/test/integration/404-file.js +++ b/packages/endpoint-files/test/integration/404-file.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-files/test/integration/422-post-upload.js b/packages/endpoint-files/test/integration/422-post-upload.js index 5eeb53a2f..7dc6e63b6 100644 --- a/packages/endpoint-files/test/integration/422-post-upload.js +++ b/packages/endpoint-files/test/integration/422-post-upload.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-files/test/unit/utils.js b/packages/endpoint-files/test/unit/utils.js index 3338376f9..30e54d709 100644 --- a/packages/endpoint-files/test/unit/utils.js +++ b/packages/endpoint-files/test/unit/utils.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getFileName, getFileUrl } from "../../lib/utils.js"; describe("endpoint-files/lib/utils", () => { diff --git a/packages/endpoint-json-feed/index.js b/packages/endpoint-json-feed/index.js index 00b8b7180..c0ac4cc83 100644 --- a/packages/endpoint-json-feed/index.js +++ b/packages/endpoint-json-feed/index.js @@ -1,5 +1,7 @@ import path from "node:path"; + import express from "express"; + import { jsonFeedController } from "./lib/controllers/json-feed.js"; const defaults = { diff --git a/packages/endpoint-json-feed/test/integration/200-feed-json.js b/packages/endpoint-json-feed/test/integration/200-feed-json.js index bb075fffe..0deeaf21e 100644 --- a/packages/endpoint-json-feed/test/integration/200-feed-json.js +++ b/packages/endpoint-json-feed/test/integration/200-feed-json.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer({ plugins: ["@indiekit/endpoint-json-feed"], diff --git a/packages/endpoint-json-feed/test/unit/json-feed.js b/packages/endpoint-json-feed/test/unit/json-feed.js index 146240504..2d74cd572 100644 --- a/packages/endpoint-json-feed/test/unit/json-feed.js +++ b/packages/endpoint-json-feed/test/unit/json-feed.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getFixture } from "@indiekit-test/fixtures"; + import { jsonFeed } from "../../lib/json-feed.js"; describe("endpoint-json-feed/lib/json-feed", () => { diff --git a/packages/endpoint-media/index.js b/packages/endpoint-media/index.js index 59d0f85cb..374ad0bb8 100644 --- a/packages/endpoint-media/index.js +++ b/packages/endpoint-media/index.js @@ -1,5 +1,6 @@ import deepmerge from "deepmerge"; import express from "express"; + import { actionController } from "./lib/controllers/action.js"; import { queryController } from "./lib/controllers/query.js"; diff --git a/packages/endpoint-media/lib/controllers/action.js b/packages/endpoint-media/lib/controllers/action.js index bcdd1b5ec..6377ae37b 100644 --- a/packages/endpoint-media/lib/controllers/action.js +++ b/packages/endpoint-media/lib/controllers/action.js @@ -1,4 +1,5 @@ import { IndiekitError } from "@indiekit/error"; + import { mediaContent } from "../media-content.js"; import { mediaData } from "../media-data.js"; import { mediaTransform } from "../media-transform.js"; diff --git a/packages/endpoint-media/lib/controllers/query.js b/packages/endpoint-media/lib/controllers/query.js index b324c70b6..ab7776791 100644 --- a/packages/endpoint-media/lib/controllers/query.js +++ b/packages/endpoint-media/lib/controllers/query.js @@ -1,5 +1,6 @@ import { IndiekitError } from "@indiekit/error"; import { getCursor } from "@indiekit/util"; + import { getMediaProperties } from "../utils.js"; /** diff --git a/packages/endpoint-media/lib/file.js b/packages/endpoint-media/lib/file.js index b4df08864..4df684169 100644 --- a/packages/endpoint-media/lib/file.js +++ b/packages/endpoint-media/lib/file.js @@ -1,4 +1,5 @@ import path from "node:path"; + import { getDate, slugify } from "@indiekit/util"; import { fileTypeFromBuffer } from "file-type"; diff --git a/packages/endpoint-media/lib/media-data.js b/packages/endpoint-media/lib/media-data.js index 5b48b1e13..9030e0fc3 100644 --- a/packages/endpoint-media/lib/media-data.js +++ b/packages/endpoint-media/lib/media-data.js @@ -1,6 +1,7 @@ import { IndiekitError } from "@indiekit/error"; import { getCanonicalUrl } from "@indiekit/util"; import makeDebug from "debug"; + import { getFileProperties, getMediaType } from "./file.js"; import { renderPath } from "./utils.js"; diff --git a/packages/endpoint-media/lib/utils.js b/packages/endpoint-media/lib/utils.js index 447bc5aa0..200053e87 100644 --- a/packages/endpoint-media/lib/utils.js +++ b/packages/endpoint-media/lib/utils.js @@ -5,6 +5,7 @@ import { supplant, } from "@indiekit/util"; import newbase60 from "newbase60"; + import { mediaTypeCount } from "./media-type-count.js"; /** diff --git a/packages/endpoint-media/test/integration/200-action-upload.js b/packages/endpoint-media/test/integration/200-action-upload.js index 70d4dfe4f..f8ad2d931 100644 --- a/packages/endpoint-media/test/integration/200-action-upload.js +++ b/packages/endpoint-media/test/integration/200-action-upload.js @@ -1,10 +1,11 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { getFixture } from "@indiekit-test/fixtures"; import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-media"); const server = await testServer(); diff --git a/packages/endpoint-media/test/integration/200-query-source-no-database.js b/packages/endpoint-media/test/integration/200-query-source-no-database.js index 12ed3cd45..315367e61 100644 --- a/packages/endpoint-media/test/integration/200-query-source-no-database.js +++ b/packages/endpoint-media/test/integration/200-query-source-no-database.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer({ mongodbUrl: false }); const request = supertest.agent(server); diff --git a/packages/endpoint-media/test/integration/200-query-source.js b/packages/endpoint-media/test/integration/200-query-source.js index c55f4961c..fda677d08 100644 --- a/packages/endpoint-media/test/integration/200-query-source.js +++ b/packages/endpoint-media/test/integration/200-query-source.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { before, after, describe, it } from "node:test"; -import supertest from "supertest"; + import { getFixture } from "@indiekit-test/fixtures"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-media/test/integration/202-action-delete.js b/packages/endpoint-media/test/integration/202-action-delete.js index ff83e3f9a..6eb83f794 100644 --- a/packages/endpoint-media/test/integration/202-action-delete.js +++ b/packages/endpoint-media/test/integration/202-action-delete.js @@ -1,10 +1,11 @@ import { strict as assert } from "node:assert"; import { before, after, describe, it } from "node:test"; -import supertest from "supertest"; + import { getFixture } from "@indiekit-test/fixtures"; import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-media"); const server = await testServer(); diff --git a/packages/endpoint-media/test/integration/400-action-delete-no-url.js b/packages/endpoint-media/test/integration/400-action-delete-no-url.js index e3b803197..f496680fd 100644 --- a/packages/endpoint-media/test/integration/400-action-delete-no-url.js +++ b/packages/endpoint-media/test/integration/400-action-delete-no-url.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-media/test/integration/400-action-upload-no-file.js b/packages/endpoint-media/test/integration/400-action-upload-no-file.js index aae1745d4..301ecf7e0 100644 --- a/packages/endpoint-media/test/integration/400-action-upload-no-file.js +++ b/packages/endpoint-media/test/integration/400-action-upload-no-file.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-media/test/integration/400-query-invalid.js b/packages/endpoint-media/test/integration/400-query-invalid.js index 3d640665a..dce87e0e4 100644 --- a/packages/endpoint-media/test/integration/400-query-invalid.js +++ b/packages/endpoint-media/test/integration/400-query-invalid.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-media/test/integration/400-query-source-url-no-database.js b/packages/endpoint-media/test/integration/400-query-source-url-no-database.js index 3fba5e7e1..6d786eb7b 100644 --- a/packages/endpoint-media/test/integration/400-query-source-url-no-database.js +++ b/packages/endpoint-media/test/integration/400-query-source-url-no-database.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer({ mongodbUrl: false }); const request = supertest.agent(server); diff --git a/packages/endpoint-media/test/integration/400-query-source-url-not-found.js b/packages/endpoint-media/test/integration/400-query-source-url-not-found.js index cf752dc13..829361a35 100644 --- a/packages/endpoint-media/test/integration/400-query-source-url-not-found.js +++ b/packages/endpoint-media/test/integration/400-query-source-url-not-found.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-media/test/integration/401-action-upload-invalid-token.js b/packages/endpoint-media/test/integration/401-action-upload-invalid-token.js index 98164f746..59bae3610 100644 --- a/packages/endpoint-media/test/integration/401-action-upload-invalid-token.js +++ b/packages/endpoint-media/test/integration/401-action-upload-invalid-token.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-media/test/integration/403-action-upload-insufficient-scope.js b/packages/endpoint-media/test/integration/403-action-upload-insufficient-scope.js index 50647d1f0..f233d9945 100644 --- a/packages/endpoint-media/test/integration/403-action-upload-insufficient-scope.js +++ b/packages/endpoint-media/test/integration/403-action-upload-insufficient-scope.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { getFixture } from "@indiekit-test/fixtures"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-media/test/integration/404-action-delete-not-found.js b/packages/endpoint-media/test/integration/404-action-delete-not-found.js index e4a26debb..3eb3a4617 100644 --- a/packages/endpoint-media/test/integration/404-action-delete-not-found.js +++ b/packages/endpoint-media/test/integration/404-action-delete-not-found.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-media/test/integration/415-action-upload-unsupported-media-type.js b/packages/endpoint-media/test/integration/415-action-upload-unsupported-media-type.js index 73581a5c8..53d82caf5 100644 --- a/packages/endpoint-media/test/integration/415-action-upload-unsupported-media-type.js +++ b/packages/endpoint-media/test/integration/415-action-upload-unsupported-media-type.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { getFixture } from "@indiekit-test/fixtures"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-media/test/integration/501-query-unsupported.js b/packages/endpoint-media/test/integration/501-query-unsupported.js index f32b67a72..4311bee15 100644 --- a/packages/endpoint-media/test/integration/501-query-unsupported.js +++ b/packages/endpoint-media/test/integration/501-query-unsupported.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-media/test/integration/501-upload-unsupported-post-type.js b/packages/endpoint-media/test/integration/501-upload-unsupported-post-type.js index ac88908fe..ef356e04d 100644 --- a/packages/endpoint-media/test/integration/501-upload-unsupported-post-type.js +++ b/packages/endpoint-media/test/integration/501-upload-unsupported-post-type.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { getFixture } from "@indiekit-test/fixtures"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-media/test/unit/file.js b/packages/endpoint-media/test/unit/file.js index e87651994..149207e43 100644 --- a/packages/endpoint-media/test/unit/file.js +++ b/packages/endpoint-media/test/unit/file.js @@ -1,7 +1,9 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; -import { isValid, parseISO } from "date-fns"; + import { getFixture } from "@indiekit-test/fixtures"; +import { isValid, parseISO } from "date-fns"; + import { getFileProperties, getMediaType } from "../../lib/file.js"; describe("endpoint-media/lib/file", () => { diff --git a/packages/endpoint-media/test/unit/media-content.js b/packages/endpoint-media/test/unit/media-content.js index d0031e58c..399ebc097 100644 --- a/packages/endpoint-media/test/unit/media-content.js +++ b/packages/endpoint-media/test/unit/media-content.js @@ -1,9 +1,11 @@ import { strict as assert } from "node:assert"; import { before, describe, it, mock } from "node:test"; -import { mockAgent } from "@indiekit-test/mock-agent"; + import { getFixture } from "@indiekit-test/fixtures"; import { mediaData } from "@indiekit-test/media-data"; +import { mockAgent } from "@indiekit-test/mock-agent"; import { publication } from "@indiekit-test/publication"; + import { mediaContent } from "../../lib/media-content.js"; await mockAgent("endpoint-media"); diff --git a/packages/endpoint-media/test/unit/media-data.js b/packages/endpoint-media/test/unit/media-data.js index 705e82763..03e5d7aac 100644 --- a/packages/endpoint-media/test/unit/media-data.js +++ b/packages/endpoint-media/test/unit/media-data.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, beforeEach, describe, it, mock } from "node:test"; + import { testConfig } from "@indiekit-test/config"; import { testDatabase } from "@indiekit-test/database"; import { getFixture } from "@indiekit-test/fixtures"; + import { mediaData } from "../../lib/media-data.js"; describe("endpoint-media/lib/media-data", async () => { diff --git a/packages/endpoint-media/test/unit/media-type-count.js b/packages/endpoint-media/test/unit/media-type-count.js index 5d0283d08..d218491b4 100644 --- a/packages/endpoint-media/test/unit/media-type-count.js +++ b/packages/endpoint-media/test/unit/media-type-count.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; + import { testDatabase } from "@indiekit-test/database"; + import { mediaTypeCount } from "../../lib/media-type-count.js"; const { client, database, mongoServer } = await testDatabase(); diff --git a/packages/endpoint-media/test/unit/scope.js b/packages/endpoint-media/test/unit/scope.js index 2097d6764..1dbb5f128 100644 --- a/packages/endpoint-media/test/unit/scope.js +++ b/packages/endpoint-media/test/unit/scope.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { checkScope } from "../../lib/scope.js"; describe("endpoint-media/lib/scope", () => { diff --git a/packages/endpoint-media/test/unit/utils.js b/packages/endpoint-media/test/unit/utils.js index 6c9ebe92f..65c9d945c 100644 --- a/packages/endpoint-media/test/unit/utils.js +++ b/packages/endpoint-media/test/unit/utils.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { before, describe, it, mock } from "node:test"; + import { renderPath } from "../../lib/utils.js"; describe("endpoint-media/lib/util", () => { diff --git a/packages/endpoint-micropub/index.js b/packages/endpoint-micropub/index.js index f18ba60ac..dc4d97dc2 100644 --- a/packages/endpoint-micropub/index.js +++ b/packages/endpoint-micropub/index.js @@ -1,4 +1,5 @@ import express from "express"; + import { actionController } from "./lib/controllers/action.js"; import { queryController } from "./lib/controllers/query.js"; diff --git a/packages/endpoint-micropub/lib/controllers/action.js b/packages/endpoint-micropub/lib/controllers/action.js index 79820443b..c8e2fa1f7 100644 --- a/packages/endpoint-micropub/lib/controllers/action.js +++ b/packages/endpoint-micropub/lib/controllers/action.js @@ -1,9 +1,10 @@ import { IndiekitError } from "@indiekit/error"; + import { formEncodedToJf2, mf2ToJf2 } from "../jf2.js"; +import { uploadMedia } from "../media.js"; import { postContent } from "../post-content.js"; import { postData } from "../post-data.js"; import { checkScope } from "../scope.js"; -import { uploadMedia } from "../media.js"; /** * Perform requested post action diff --git a/packages/endpoint-micropub/lib/controllers/query.js b/packages/endpoint-micropub/lib/controllers/query.js index b73f1bdee..176966db8 100644 --- a/packages/endpoint-micropub/lib/controllers/query.js +++ b/packages/endpoint-micropub/lib/controllers/query.js @@ -1,5 +1,6 @@ import { IndiekitError } from "@indiekit/error"; import { getCursor } from "@indiekit/util"; + import { getConfig, queryConfig } from "../config.js"; import { getMf2Properties, jf2ToMf2 } from "../mf2.js"; diff --git a/packages/endpoint-micropub/lib/jf2.js b/packages/endpoint-micropub/lib/jf2.js index 675b5537c..df7d6b85f 100644 --- a/packages/endpoint-micropub/lib/jf2.js +++ b/packages/endpoint-micropub/lib/jf2.js @@ -4,6 +4,7 @@ import { mf2tojf2, mf2tojf2referenced, } from "@paulrobertlloyd/mf2tojf2"; + import { markdownToHtml, htmlToMarkdown } from "./markdown.js"; import { reservedProperties } from "./reserved-properties.js"; import { diff --git a/packages/endpoint-micropub/lib/post-content.js b/packages/endpoint-micropub/lib/post-content.js index 9c3d2ea10..ca45a03aa 100644 --- a/packages/endpoint-micropub/lib/post-content.js +++ b/packages/endpoint-micropub/lib/post-content.js @@ -1,4 +1,5 @@ import makeDebug from "debug"; + import { getPostTemplateProperties } from "./utils.js"; const debug = makeDebug("indiekit:endpoint-micropub:post-content"); diff --git a/packages/endpoint-micropub/lib/post-data.js b/packages/endpoint-micropub/lib/post-data.js index 1985973d6..ed742fc59 100644 --- a/packages/endpoint-micropub/lib/post-data.js +++ b/packages/endpoint-micropub/lib/post-data.js @@ -1,9 +1,11 @@ import { isDeepStrictEqual } from "node:util"; -import makeDebug from "debug"; + import { IndiekitError } from "@indiekit/error"; import { getCanonicalUrl, getDate } from "@indiekit/util"; -import { getPostType } from "./post-type-discovery.js"; +import makeDebug from "debug"; + import { getSyndicateToProperty, normaliseProperties } from "./jf2.js"; +import { getPostType } from "./post-type-discovery.js"; import * as updateMf2 from "./update.js"; import { renderPath } from "./utils.js"; diff --git a/packages/endpoint-micropub/lib/update.js b/packages/endpoint-micropub/lib/update.js index 102db7c95..e70cdf914 100644 --- a/packages/endpoint-micropub/lib/update.js +++ b/packages/endpoint-micropub/lib/update.js @@ -1,4 +1,5 @@ import _ from "lodash"; + import { mf2ToJf2 } from "./jf2.js"; /** diff --git a/packages/endpoint-micropub/lib/utils.js b/packages/endpoint-micropub/lib/utils.js index 6f18c10cf..2dc142427 100644 --- a/packages/endpoint-micropub/lib/utils.js +++ b/packages/endpoint-micropub/lib/utils.js @@ -6,6 +6,7 @@ import { supplant, } from "@indiekit/util"; import newbase60 from "newbase60"; + import { postTypeCount } from "./post-type-count.js"; /** diff --git a/packages/endpoint-micropub/test/integration/200-action-update-ignored.js b/packages/endpoint-micropub/test/integration/200-action-update-ignored.js index c63afe2e3..5a41461c3 100644 --- a/packages/endpoint-micropub/test/integration/200-action-update-ignored.js +++ b/packages/endpoint-micropub/test/integration/200-action-update-ignored.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-micropub/test/integration/200-query-category.js b/packages/endpoint-micropub/test/integration/200-query-category.js index 83485e589..ff71d6140 100644 --- a/packages/endpoint-micropub/test/integration/200-query-category.js +++ b/packages/endpoint-micropub/test/integration/200-query-category.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-micropub/test/integration/200-query-config.js b/packages/endpoint-micropub/test/integration/200-query-config.js index d7c25326d..e8453a40b 100644 --- a/packages/endpoint-micropub/test/integration/200-query-config.js +++ b/packages/endpoint-micropub/test/integration/200-query-config.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-micropub/test/integration/200-query-media-endpoint.js b/packages/endpoint-micropub/test/integration/200-query-media-endpoint.js index 4bf538a18..1e74fe430 100644 --- a/packages/endpoint-micropub/test/integration/200-query-media-endpoint.js +++ b/packages/endpoint-micropub/test/integration/200-query-media-endpoint.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-micropub/test/integration/200-query-post-types.js b/packages/endpoint-micropub/test/integration/200-query-post-types.js index afac13142..f37e86488 100644 --- a/packages/endpoint-micropub/test/integration/200-query-post-types.js +++ b/packages/endpoint-micropub/test/integration/200-query-post-types.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-micropub/test/integration/200-query-source-no-database.js b/packages/endpoint-micropub/test/integration/200-query-source-no-database.js index 10d66175f..b3b1383a1 100644 --- a/packages/endpoint-micropub/test/integration/200-query-source-no-database.js +++ b/packages/endpoint-micropub/test/integration/200-query-source-no-database.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer({ mongodbUrl: false }); diff --git a/packages/endpoint-micropub/test/integration/200-query-source-url-property.js b/packages/endpoint-micropub/test/integration/200-query-source-url-property.js index 2b748d7d9..034d6ec52 100644 --- a/packages/endpoint-micropub/test/integration/200-query-source-url-property.js +++ b/packages/endpoint-micropub/test/integration/200-query-source-url-property.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-micropub/test/integration/200-query-source-url.js b/packages/endpoint-micropub/test/integration/200-query-source-url.js index 985cbffa1..b32401dba 100644 --- a/packages/endpoint-micropub/test/integration/200-query-source-url.js +++ b/packages/endpoint-micropub/test/integration/200-query-source-url.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-micropub/test/integration/200-query-source.js b/packages/endpoint-micropub/test/integration/200-query-source.js index 5347bba37..e3f2bc418 100644 --- a/packages/endpoint-micropub/test/integration/200-query-source.js +++ b/packages/endpoint-micropub/test/integration/200-query-source.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-micropub/test/integration/200-query-syndicate-to.js b/packages/endpoint-micropub/test/integration/200-query-syndicate-to.js index 2ad34b736..e6e2a3452 100644 --- a/packages/endpoint-micropub/test/integration/200-query-syndicate-to.js +++ b/packages/endpoint-micropub/test/integration/200-query-syndicate-to.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-micropub/test/integration/202-action-create-draft.js b/packages/endpoint-micropub/test/integration/202-action-create-draft.js index c3918a0b9..625939719 100644 --- a/packages/endpoint-micropub/test/integration/202-action-create-draft.js +++ b/packages/endpoint-micropub/test/integration/202-action-create-draft.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-micropub/test/integration/202-action-create-form-encoded.js b/packages/endpoint-micropub/test/integration/202-action-create-form-encoded.js index 4f8f06b5a..a32cf1c7c 100644 --- a/packages/endpoint-micropub/test/integration/202-action-create-form-encoded.js +++ b/packages/endpoint-micropub/test/integration/202-action-create-form-encoded.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-micropub/test/integration/202-action-create-json.js b/packages/endpoint-micropub/test/integration/202-action-create-json.js index 2c3a11793..588e69bc6 100644 --- a/packages/endpoint-micropub/test/integration/202-action-create-json.js +++ b/packages/endpoint-micropub/test/integration/202-action-create-json.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-micropub/test/integration/202-action-delete.js b/packages/endpoint-micropub/test/integration/202-action-delete.js index 08eec1494..fec320b5d 100644 --- a/packages/endpoint-micropub/test/integration/202-action-delete.js +++ b/packages/endpoint-micropub/test/integration/202-action-delete.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-micropub/test/integration/202-action-undelete.js b/packages/endpoint-micropub/test/integration/202-action-undelete.js index b26889f2e..bb560ee55 100644 --- a/packages/endpoint-micropub/test/integration/202-action-undelete.js +++ b/packages/endpoint-micropub/test/integration/202-action-undelete.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-micropub/test/integration/202-action-update.js b/packages/endpoint-micropub/test/integration/202-action-update.js index 5c96322dd..8e089d90f 100644 --- a/packages/endpoint-micropub/test/integration/202-action-update.js +++ b/packages/endpoint-micropub/test/integration/202-action-update.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-micropub/test/integration/400-action-delete-no-url.js b/packages/endpoint-micropub/test/integration/400-action-delete-no-url.js index 96863829e..6249057a2 100644 --- a/packages/endpoint-micropub/test/integration/400-action-delete-no-url.js +++ b/packages/endpoint-micropub/test/integration/400-action-delete-no-url.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-micropub/test/integration/400-action-update-no-operation.js b/packages/endpoint-micropub/test/integration/400-action-update-no-operation.js index d8ff8bf8f..ee33a2158 100644 --- a/packages/endpoint-micropub/test/integration/400-action-update-no-operation.js +++ b/packages/endpoint-micropub/test/integration/400-action-update-no-operation.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-micropub/test/integration/400-query-invalid.js b/packages/endpoint-micropub/test/integration/400-query-invalid.js index 82ed50852..d3453b64f 100644 --- a/packages/endpoint-micropub/test/integration/400-query-invalid.js +++ b/packages/endpoint-micropub/test/integration/400-query-invalid.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-micropub/test/integration/400-query-source-url-no-database.js b/packages/endpoint-micropub/test/integration/400-query-source-url-no-database.js index 36e75bc5a..777e9209c 100644 --- a/packages/endpoint-micropub/test/integration/400-query-source-url-no-database.js +++ b/packages/endpoint-micropub/test/integration/400-query-source-url-no-database.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("indiekit"); const server = await testServer({ diff --git a/packages/endpoint-micropub/test/integration/400-query-source-url-not-found.js b/packages/endpoint-micropub/test/integration/400-query-source-url-not-found.js index 655004749..693f41780 100644 --- a/packages/endpoint-micropub/test/integration/400-query-source-url-not-found.js +++ b/packages/endpoint-micropub/test/integration/400-query-source-url-not-found.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("indiekit"); const server = await testServer({ diff --git a/packages/endpoint-micropub/test/integration/401-action-invalid-token.js b/packages/endpoint-micropub/test/integration/401-action-invalid-token.js index 541a852dc..339e2a644 100644 --- a/packages/endpoint-micropub/test/integration/401-action-invalid-token.js +++ b/packages/endpoint-micropub/test/integration/401-action-invalid-token.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-micropub/test/integration/403-action-insufficient-scope.js b/packages/endpoint-micropub/test/integration/403-action-insufficient-scope.js index f7e2e3d5a..b79563536 100644 --- a/packages/endpoint-micropub/test/integration/403-action-insufficient-scope.js +++ b/packages/endpoint-micropub/test/integration/403-action-insufficient-scope.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-micropub/test/integration/403-action-update-draft-insufficient-scope.js b/packages/endpoint-micropub/test/integration/403-action-update-draft-insufficient-scope.js index f8b877d19..ec6da0f1b 100644 --- a/packages/endpoint-micropub/test/integration/403-action-update-draft-insufficient-scope.js +++ b/packages/endpoint-micropub/test/integration/403-action-update-draft-insufficient-scope.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-micropub/test/integration/404-action-delete-not-found.js b/packages/endpoint-micropub/test/integration/404-action-delete-not-found.js index 68988fb6c..566479d68 100644 --- a/packages/endpoint-micropub/test/integration/404-action-delete-not-found.js +++ b/packages/endpoint-micropub/test/integration/404-action-delete-not-found.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-micropub/test/integration/501-action-unsupported-post-type.js b/packages/endpoint-micropub/test/integration/501-action-unsupported-post-type.js index d44d3d761..c00f63457 100644 --- a/packages/endpoint-micropub/test/integration/501-action-unsupported-post-type.js +++ b/packages/endpoint-micropub/test/integration/501-action-unsupported-post-type.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-micropub/test/integration/501-query-unsupported.js b/packages/endpoint-micropub/test/integration/501-query-unsupported.js index 3fd8af4d3..55582a583 100644 --- a/packages/endpoint-micropub/test/integration/501-query-unsupported.js +++ b/packages/endpoint-micropub/test/integration/501-query-unsupported.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-micropub/test/unit/config.js b/packages/endpoint-micropub/test/unit/config.js index c18213570..12515725b 100644 --- a/packages/endpoint-micropub/test/unit/config.js +++ b/packages/endpoint-micropub/test/unit/config.js @@ -1,7 +1,9 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; -import { testConfig } from "@indiekit-test/config"; + import MastodonSyndicator from "@indiekit/syndicator-mastodon"; +import { testConfig } from "@indiekit-test/config"; + import { getConfig, queryConfig } from "../../lib/config.js"; const config = await testConfig({ usePostTypes: true }); diff --git a/packages/endpoint-micropub/test/unit/jf2.js b/packages/endpoint-micropub/test/unit/jf2.js index fa4b42d64..868504121 100644 --- a/packages/endpoint-micropub/test/unit/jf2.js +++ b/packages/endpoint-micropub/test/unit/jf2.js @@ -1,7 +1,9 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getFixture } from "@indiekit-test/fixtures"; import { mockAgent } from "@indiekit-test/mock-agent"; + import { formEncodedToJf2, mf2ToJf2, diff --git a/packages/endpoint-micropub/test/unit/markdown.js b/packages/endpoint-micropub/test/unit/markdown.js index c9c545489..79c004930 100644 --- a/packages/endpoint-micropub/test/unit/markdown.js +++ b/packages/endpoint-micropub/test/unit/markdown.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { markdownToHtml, htmlToMarkdown } from "../../lib/markdown.js"; describe("endpoint-micropub/lib/markdown", () => { diff --git a/packages/endpoint-micropub/test/unit/media.js b/packages/endpoint-micropub/test/unit/media.js index 90a68cad8..5e523fe18 100644 --- a/packages/endpoint-micropub/test/unit/media.js +++ b/packages/endpoint-micropub/test/unit/media.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { beforeEach, describe, it } from "node:test"; -import { mockAgent } from "@indiekit-test/mock-agent"; + import { getFixture } from "@indiekit-test/fixtures"; +import { mockAgent } from "@indiekit-test/mock-agent"; import { testToken } from "@indiekit-test/token"; + import { uploadMedia } from "../../lib/media.js"; await mockAgent("endpoint-micropub"); diff --git a/packages/endpoint-micropub/test/unit/mf2.js b/packages/endpoint-micropub/test/unit/mf2.js index d43126ad8..52ca87c41 100644 --- a/packages/endpoint-micropub/test/unit/mf2.js +++ b/packages/endpoint-micropub/test/unit/mf2.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getFixture } from "@indiekit-test/fixtures"; + import { jf2ToMf2 } from "../../lib/mf2.js"; describe("endpoint-micropub/lib/mf2", () => { diff --git a/packages/endpoint-micropub/test/unit/post-content.js b/packages/endpoint-micropub/test/unit/post-content.js index 445c89191..f4d810169 100644 --- a/packages/endpoint-micropub/test/unit/post-content.js +++ b/packages/endpoint-micropub/test/unit/post-content.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { mockAgent } from "@indiekit-test/mock-agent"; -import { publication } from "@indiekit-test/publication"; import { deletedPostData, postData } from "@indiekit-test/post-data"; +import { publication } from "@indiekit-test/publication"; + import { postContent } from "../../lib/post-content.js"; await mockAgent("endpoint-micropub"); diff --git a/packages/endpoint-micropub/test/unit/post-data.js b/packages/endpoint-micropub/test/unit/post-data.js index b9ef8442a..e65126b4b 100644 --- a/packages/endpoint-micropub/test/unit/post-data.js +++ b/packages/endpoint-micropub/test/unit/post-data.js @@ -1,7 +1,9 @@ import { strict as assert } from "node:assert"; import { after, before, beforeEach, describe, it, mock } from "node:test"; + import { testConfig } from "@indiekit-test/config"; import { testDatabase } from "@indiekit-test/database"; + import { postData } from "../../lib/post-data.js"; describe("endpoint-micropub/lib/post-data", async () => { diff --git a/packages/endpoint-micropub/test/unit/post-type-count.js b/packages/endpoint-micropub/test/unit/post-type-count.js index 88d4f898e..805e1dade 100644 --- a/packages/endpoint-micropub/test/unit/post-type-count.js +++ b/packages/endpoint-micropub/test/unit/post-type-count.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; + import { testDatabase } from "@indiekit-test/database"; + import { postTypeCount } from "../../lib/post-type-count.js"; const { client, database, mongoServer } = await testDatabase(); diff --git a/packages/endpoint-micropub/test/unit/post-type-discovery.js b/packages/endpoint-micropub/test/unit/post-type-discovery.js index ce2318e11..d041b1b96 100644 --- a/packages/endpoint-micropub/test/unit/post-type-discovery.js +++ b/packages/endpoint-micropub/test/unit/post-type-discovery.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getPostType } from "../../lib/post-type-discovery.js"; describe("endpoint-media/lib/post-type-discovery", () => { diff --git a/packages/endpoint-micropub/test/unit/scope.js b/packages/endpoint-micropub/test/unit/scope.js index ab8a9249e..4e6bf0200 100644 --- a/packages/endpoint-micropub/test/unit/scope.js +++ b/packages/endpoint-micropub/test/unit/scope.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { checkScope } from "../../lib/scope.js"; describe("endpoint-media/lib/scope", () => { diff --git a/packages/endpoint-micropub/test/unit/update.js b/packages/endpoint-micropub/test/unit/update.js index d83bbf5ac..e833fffaa 100644 --- a/packages/endpoint-micropub/test/unit/update.js +++ b/packages/endpoint-micropub/test/unit/update.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { addProperties, deleteEntries, diff --git a/packages/endpoint-micropub/test/unit/utils.js b/packages/endpoint-micropub/test/unit/utils.js index 329a41ce8..7b6446b1c 100644 --- a/packages/endpoint-micropub/test/unit/utils.js +++ b/packages/endpoint-micropub/test/unit/utils.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { before, describe, it, mock } from "node:test"; + import { decodeQueryParameter, excerptString, diff --git a/packages/endpoint-posts/index.js b/packages/endpoint-posts/index.js index b72172e78..5e28e64e4 100644 --- a/packages/endpoint-posts/index.js +++ b/packages/endpoint-posts/index.js @@ -1,7 +1,9 @@ import path from "node:path"; -import { ISO_6709_RE, isRequired } from "@indiekit/util"; + import { tagInputSanitizer } from "@indiekit/frontend"; +import { ISO_6709_RE, isRequired } from "@indiekit/util"; import express from "express"; + import { deleteController } from "./lib/controllers/delete.js"; import { formController } from "./lib/controllers/form.js"; import { newController } from "./lib/controllers/new.js"; diff --git a/packages/endpoint-posts/lib/controllers/delete.js b/packages/endpoint-posts/lib/controllers/delete.js index 279d893a6..f9878a1a5 100644 --- a/packages/endpoint-posts/lib/controllers/delete.js +++ b/packages/endpoint-posts/lib/controllers/delete.js @@ -1,4 +1,5 @@ import { checkScope } from "@indiekit/endpoint-micropub/lib/scope.js"; + import { endpoint } from "../endpoint.js"; export const deleteController = { diff --git a/packages/endpoint-posts/lib/controllers/form.js b/packages/endpoint-posts/lib/controllers/form.js index 0682da5b5..be3333b1d 100644 --- a/packages/endpoint-posts/lib/controllers/form.js +++ b/packages/endpoint-posts/lib/controllers/form.js @@ -1,12 +1,14 @@ import path from "node:path"; -import { checkScope } from "@indiekit/endpoint-micropub/lib/scope.js"; + import { jf2ToMf2 } from "@indiekit/endpoint-micropub/lib/mf2.js"; +import { checkScope } from "@indiekit/endpoint-micropub/lib/scope.js"; import { getTimeZoneDesignator, getTimeZoneOffset, sanitise, } from "@indiekit/util"; import { validationResult } from "express-validator"; + import { endpoint } from "../endpoint.js"; import { getLocationProperty } from "../utils.js"; diff --git a/packages/endpoint-posts/lib/controllers/new.js b/packages/endpoint-posts/lib/controllers/new.js index b0c7bea04..9cf86f046 100644 --- a/packages/endpoint-posts/lib/controllers/new.js +++ b/packages/endpoint-posts/lib/controllers/new.js @@ -1,6 +1,7 @@ import path from "node:path"; -import { validationResult } from "express-validator"; + import { checkScope } from "@indiekit/endpoint-micropub/lib/scope.js"; +import { validationResult } from "express-validator"; export const newController = { /** diff --git a/packages/endpoint-posts/lib/controllers/post.js b/packages/endpoint-posts/lib/controllers/post.js index 16d8b143b..422b1ac32 100644 --- a/packages/endpoint-posts/lib/controllers/post.js +++ b/packages/endpoint-posts/lib/controllers/post.js @@ -1,4 +1,5 @@ import path from "node:path"; + import { checkScope } from "@indiekit/endpoint-micropub/lib/scope.js"; /** diff --git a/packages/endpoint-posts/lib/controllers/posts.js b/packages/endpoint-posts/lib/controllers/posts.js index eecb20665..048a14371 100644 --- a/packages/endpoint-posts/lib/controllers/posts.js +++ b/packages/endpoint-posts/lib/controllers/posts.js @@ -1,6 +1,8 @@ import path from "node:path"; + import { checkScope } from "@indiekit/endpoint-micropub/lib/scope.js"; import { mf2tojf2 } from "@paulrobertlloyd/mf2tojf2"; + import { endpoint } from "../endpoint.js"; import { statusTypes } from "../status-types.js"; import { getPostStatusBadges, getPostName, getPhotoUrl } from "../utils.js"; diff --git a/packages/endpoint-posts/lib/middleware/post-data.js b/packages/endpoint-posts/lib/middleware/post-data.js index 67b90c5e4..ae95a1407 100644 --- a/packages/endpoint-posts/lib/middleware/post-data.js +++ b/packages/endpoint-posts/lib/middleware/post-data.js @@ -1,5 +1,7 @@ import path from "node:path"; + import { IndiekitError } from "@indiekit/error"; + import { statusTypes } from "../status-types.js"; import { getChannelItems, diff --git a/packages/endpoint-posts/lib/utils.js b/packages/endpoint-posts/lib/utils.js index 4b6c020a7..8002e3877 100644 --- a/packages/endpoint-posts/lib/utils.js +++ b/packages/endpoint-posts/lib/utils.js @@ -1,7 +1,9 @@ import { Buffer } from "node:buffer"; + import { sanitise, ISO_6709_RE } from "@indiekit/util"; import { mf2tojf2 } from "@paulrobertlloyd/mf2tojf2"; import formatcoords from "formatcoords"; + import { endpoint } from "./endpoint.js"; import { statusTypes } from "./status-types.js"; diff --git a/packages/endpoint-posts/test/integration/200-get-create.js b/packages/endpoint-posts/test/integration/200-get-create.js index e761e3335..a8a2adca8 100644 --- a/packages/endpoint-posts/test/integration/200-get-create.js +++ b/packages/endpoint-posts/test/integration/200-get-create.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-posts/test/integration/200-get-delete.js b/packages/endpoint-posts/test/integration/200-get-delete.js index d33f2f91c..1150c89af 100644 --- a/packages/endpoint-posts/test/integration/200-get-delete.js +++ b/packages/endpoint-posts/test/integration/200-get-delete.js @@ -1,10 +1,11 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-posts/test/integration/200-get-new.js b/packages/endpoint-posts/test/integration/200-get-new.js index 7a7cb8ad4..4a0d65154 100644 --- a/packages/endpoint-posts/test/integration/200-get-new.js +++ b/packages/endpoint-posts/test/integration/200-get-new.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-posts/test/integration/200-post.js b/packages/endpoint-posts/test/integration/200-post.js index 14128b557..74f2af8e5 100644 --- a/packages/endpoint-posts/test/integration/200-post.js +++ b/packages/endpoint-posts/test/integration/200-post.js @@ -1,10 +1,11 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import { JSDOM } from "jsdom"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-posts/test/integration/200-posts-no-database.js b/packages/endpoint-posts/test/integration/200-posts-no-database.js index ab476393b..fb98fe9ad 100644 --- a/packages/endpoint-posts/test/integration/200-posts-no-database.js +++ b/packages/endpoint-posts/test/integration/200-posts-no-database.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer({ mongodbUrl: false }); const request = supertest.agent(server); diff --git a/packages/endpoint-posts/test/integration/200-posts.js b/packages/endpoint-posts/test/integration/200-posts.js index 40c9ed6a1..4d5cd800d 100644 --- a/packages/endpoint-posts/test/integration/200-posts.js +++ b/packages/endpoint-posts/test/integration/200-posts.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-posts/test/integration/302-get-create.js b/packages/endpoint-posts/test/integration/302-get-create.js index 30e4968ee..5af79f6b9 100644 --- a/packages/endpoint-posts/test/integration/302-get-create.js +++ b/packages/endpoint-posts/test/integration/302-get-create.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-posts/test/integration/302-get-delete.js b/packages/endpoint-posts/test/integration/302-get-delete.js index 91f3240d1..cdf420360 100644 --- a/packages/endpoint-posts/test/integration/302-get-delete.js +++ b/packages/endpoint-posts/test/integration/302-get-delete.js @@ -1,10 +1,11 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-posts/test/integration/302-post-create.js b/packages/endpoint-posts/test/integration/302-post-create.js index 68e326c75..cef761e8a 100644 --- a/packages/endpoint-posts/test/integration/302-post-create.js +++ b/packages/endpoint-posts/test/integration/302-post-create.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-posts/test/integration/302-post-delete.js b/packages/endpoint-posts/test/integration/302-post-delete.js index 585904167..47c029f4e 100644 --- a/packages/endpoint-posts/test/integration/302-post-delete.js +++ b/packages/endpoint-posts/test/integration/302-post-delete.js @@ -1,10 +1,11 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-posts/test/integration/404-post.js b/packages/endpoint-posts/test/integration/404-post.js index 2ccd584c6..b04e6bb14 100644 --- a/packages/endpoint-posts/test/integration/404-post.js +++ b/packages/endpoint-posts/test/integration/404-post.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-posts/test/integration/422-post-create.js b/packages/endpoint-posts/test/integration/422-post-create.js index f827d92e7..275b260d0 100644 --- a/packages/endpoint-posts/test/integration/422-post-create.js +++ b/packages/endpoint-posts/test/integration/422-post-create.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-posts/test/integration/500-post-create.js b/packages/endpoint-posts/test/integration/500-post-create.js index c012b4359..1e6e233f6 100644 --- a/packages/endpoint-posts/test/integration/500-post-create.js +++ b/packages/endpoint-posts/test/integration/500-post-create.js @@ -1,10 +1,11 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import { JSDOM } from "jsdom"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-posts/test/unit/utils.js b/packages/endpoint-posts/test/unit/utils.js index 5a90c596b..478d5b812 100644 --- a/packages/endpoint-posts/test/unit/utils.js +++ b/packages/endpoint-posts/test/unit/utils.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { mockResponse } from "mock-req-res"; + import { getChannelItems, getGeoProperty, diff --git a/packages/endpoint-share/index.js b/packages/endpoint-share/index.js index 0400b8e79..a14ce781e 100644 --- a/packages/endpoint-share/index.js +++ b/packages/endpoint-share/index.js @@ -1,4 +1,5 @@ import express from "express"; + import { shareController } from "./lib/controllers/share.js"; import { validate } from "./lib/middleware/validation.js"; diff --git a/packages/endpoint-share/test/integration/200-get-share.js b/packages/endpoint-share/test/integration/200-get-share.js index 2945dbc97..36d95e00b 100644 --- a/packages/endpoint-share/test/integration/200-get-share.js +++ b/packages/endpoint-share/test/integration/200-get-share.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-share/test/integration/302-post-share.js b/packages/endpoint-share/test/integration/302-post-share.js index 70863a402..c722f13eb 100644 --- a/packages/endpoint-share/test/integration/302-post-share.js +++ b/packages/endpoint-share/test/integration/302-post-share.js @@ -1,10 +1,11 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-micropub"); const server = await testServer(); diff --git a/packages/endpoint-share/test/integration/400-post-share.js b/packages/endpoint-share/test/integration/400-post-share.js index 741a2a780..1596f56d8 100644 --- a/packages/endpoint-share/test/integration/400-post-share.js +++ b/packages/endpoint-share/test/integration/400-post-share.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-share/test/integration/422-post-share.js b/packages/endpoint-share/test/integration/422-post-share.js index 02752206f..80b6ed5bb 100644 --- a/packages/endpoint-share/test/integration/422-post-share.js +++ b/packages/endpoint-share/test/integration/422-post-share.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/endpoint-syndicate/index.js b/packages/endpoint-syndicate/index.js index 55ef13fc6..2bf4c1e2e 100644 --- a/packages/endpoint-syndicate/index.js +++ b/packages/endpoint-syndicate/index.js @@ -1,4 +1,5 @@ import express from "express"; + import { syndicateController } from "./lib/controllers/syndicate.js"; const defaults = { mountPath: "/syndicate" }; diff --git a/packages/endpoint-syndicate/lib/controllers/syndicate.js b/packages/endpoint-syndicate/lib/controllers/syndicate.js index 2b43be7fd..4b6010deb 100644 --- a/packages/endpoint-syndicate/lib/controllers/syndicate.js +++ b/packages/endpoint-syndicate/lib/controllers/syndicate.js @@ -1,4 +1,5 @@ import { IndiekitError } from "@indiekit/error"; + import { findBearerToken } from "../token.js"; import { getPostData, syndicateToTargets } from "../utils.js"; diff --git a/packages/endpoint-syndicate/lib/token.js b/packages/endpoint-syndicate/lib/token.js index 22aa7d173..4e20b3b2e 100644 --- a/packages/endpoint-syndicate/lib/token.js +++ b/packages/endpoint-syndicate/lib/token.js @@ -1,4 +1,5 @@ import process from "node:process"; + import { IndiekitError } from "@indiekit/error"; import jwt from "jsonwebtoken"; diff --git a/packages/endpoint-syndicate/test/integration/200-no-post-record-for-url.js b/packages/endpoint-syndicate/test/integration/200-no-post-record-for-url.js index dd9655a32..301e298b8 100644 --- a/packages/endpoint-syndicate/test/integration/200-no-post-record-for-url.js +++ b/packages/endpoint-syndicate/test/integration/200-no-post-record-for-url.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer({ plugins: ["@indiekit/syndicator-mastodon"], diff --git a/packages/endpoint-syndicate/test/integration/200-no-post-records.js b/packages/endpoint-syndicate/test/integration/200-no-post-records.js index d13eb09b7..8caf1c586 100644 --- a/packages/endpoint-syndicate/test/integration/200-no-post-records.js +++ b/packages/endpoint-syndicate/test/integration/200-no-post-records.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer({ plugins: ["@indiekit/syndicator-mastodon"], diff --git a/packages/endpoint-syndicate/test/integration/200-no-posts-awaiting-syndication.js b/packages/endpoint-syndicate/test/integration/200-no-posts-awaiting-syndication.js index 99b9acd42..6f8bb2c66 100644 --- a/packages/endpoint-syndicate/test/integration/200-no-posts-awaiting-syndication.js +++ b/packages/endpoint-syndicate/test/integration/200-no-posts-awaiting-syndication.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-syndicate"); const server = await testServer({ diff --git a/packages/endpoint-syndicate/test/integration/200-no-syndication-targets.js b/packages/endpoint-syndicate/test/integration/200-no-syndication-targets.js index aac18e9ef..76de9d143 100644 --- a/packages/endpoint-syndicate/test/integration/200-no-syndication-targets.js +++ b/packages/endpoint-syndicate/test/integration/200-no-syndication-targets.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-syndicate"); const server = await testServer(); diff --git a/packages/endpoint-syndicate/test/integration/200-syndicates-recent-post.js b/packages/endpoint-syndicate/test/integration/200-syndicates-recent-post.js index 16d7ac131..953e10383 100644 --- a/packages/endpoint-syndicate/test/integration/200-syndicates-recent-post.js +++ b/packages/endpoint-syndicate/test/integration/200-syndicates-recent-post.js @@ -1,11 +1,12 @@ import { strict as assert } from "node:assert"; import { createHash } from "node:crypto"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; -import jwt from "jsonwebtoken"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import jwt from "jsonwebtoken"; +import supertest from "supertest"; await mockAgent("endpoint-syndicate"); const server = await testServer({ diff --git a/packages/endpoint-syndicate/test/integration/200-syndicates-url-for-multiple-targets.js b/packages/endpoint-syndicate/test/integration/200-syndicates-url-for-multiple-targets.js index 367fd9b21..6fc556621 100644 --- a/packages/endpoint-syndicate/test/integration/200-syndicates-url-for-multiple-targets.js +++ b/packages/endpoint-syndicate/test/integration/200-syndicates-url-for-multiple-targets.js @@ -1,10 +1,11 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it, mock } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-syndicate"); const server = await testServer({ diff --git a/packages/endpoint-syndicate/test/integration/200-syndicates-url-for-target.js b/packages/endpoint-syndicate/test/integration/200-syndicates-url-for-target.js index 15eaa5f57..723d90d49 100644 --- a/packages/endpoint-syndicate/test/integration/200-syndicates-url-for-target.js +++ b/packages/endpoint-syndicate/test/integration/200-syndicates-url-for-target.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-syndicate"); const server = await testServer({ diff --git a/packages/endpoint-syndicate/test/integration/200-target-error.js b/packages/endpoint-syndicate/test/integration/200-target-error.js index f86a70ac1..88a3dc062 100644 --- a/packages/endpoint-syndicate/test/integration/200-target-error.js +++ b/packages/endpoint-syndicate/test/integration/200-target-error.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it, mock } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-syndicate"); const server = await testServer({ diff --git a/packages/endpoint-syndicate/test/integration/302-syndicates-url-with-redirect.js b/packages/endpoint-syndicate/test/integration/302-syndicates-url-with-redirect.js index ed602c810..e12ab4819 100644 --- a/packages/endpoint-syndicate/test/integration/302-syndicates-url-with-redirect.js +++ b/packages/endpoint-syndicate/test/integration/302-syndicates-url-with-redirect.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-syndicate"); const server = await testServer({ diff --git a/packages/endpoint-syndicate/test/integration/403-syndicates-url-missing-update-scope.js b/packages/endpoint-syndicate/test/integration/403-syndicates-url-missing-update-scope.js index 2404b2c96..fed58762f 100644 --- a/packages/endpoint-syndicate/test/integration/403-syndicates-url-missing-update-scope.js +++ b/packages/endpoint-syndicate/test/integration/403-syndicates-url-missing-update-scope.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; await mockAgent("endpoint-syndicate"); const server = await testServer({ diff --git a/packages/endpoint-syndicate/test/integration/500-no-database.js b/packages/endpoint-syndicate/test/integration/500-no-database.js index 008480f59..cd68442c0 100644 --- a/packages/endpoint-syndicate/test/integration/500-no-database.js +++ b/packages/endpoint-syndicate/test/integration/500-no-database.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer({ mongodbUrl: false }); const request = supertest.agent(server); diff --git a/packages/endpoint-syndicate/test/unit/token.js b/packages/endpoint-syndicate/test/unit/token.js index 2fbcab5a3..fc40a4b7a 100644 --- a/packages/endpoint-syndicate/test/unit/token.js +++ b/packages/endpoint-syndicate/test/unit/token.js @@ -1,7 +1,9 @@ import { strict as assert } from "node:assert"; import { createHash } from "node:crypto"; import { describe, it } from "node:test"; + import jwt from "jsonwebtoken"; + import { findBearerToken, signToken, verifyToken } from "../../lib/token.js"; describe("endpoint-syndicate/lib/token", () => { diff --git a/packages/endpoint-syndicate/test/unit/utils.js b/packages/endpoint-syndicate/test/unit/utils.js index 3eb388ca7..1ff53f61e 100644 --- a/packages/endpoint-syndicate/test/unit/utils.js +++ b/packages/endpoint-syndicate/test/unit/utils.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { after, beforeEach, describe, it } from "node:test"; + import { testDatabase } from "@indiekit-test/database"; + import { getPostData, getSyndicationTarget, diff --git a/packages/error/test/index.js b/packages/error/test/index.js index 6e7a1e74e..56fc78e07 100644 --- a/packages/error/test/index.js +++ b/packages/error/test/index.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { IndiekitError } from "../index.js"; const indiekitError = () => { diff --git a/packages/frontend/components/file-input/index.js b/packages/frontend/components/file-input/index.js index f17897af5..b714871a1 100644 --- a/packages/frontend/components/file-input/index.js +++ b/packages/frontend/components/file-input/index.js @@ -1,4 +1,5 @@ import { IndiekitError } from "@indiekit/error"; + import { wrapElement } from "../../lib/utils/wrap-element.js"; export const FileInputFieldController = class extends HTMLElement { diff --git a/packages/frontend/lib/esbuild.js b/packages/frontend/lib/esbuild.js index dc61b4b0d..1b7a145e4 100644 --- a/packages/frontend/lib/esbuild.js +++ b/packages/frontend/lib/esbuild.js @@ -1,4 +1,5 @@ import { fileURLToPath } from "node:url"; + import * as esbuild from "esbuild"; export const scripts = async () => { diff --git a/packages/frontend/lib/lightningcss.js b/packages/frontend/lib/lightningcss.js index 48ac4b5c1..b727af243 100644 --- a/packages/frontend/lib/lightningcss.js +++ b/packages/frontend/lib/lightningcss.js @@ -1,6 +1,7 @@ import fs from "node:fs"; import { createRequire } from "node:module"; import { fileURLToPath } from "node:url"; + import { bundleAsync } from "lightningcss"; const require = createRequire(import.meta.url); diff --git a/packages/frontend/lib/markdown-it.js b/packages/frontend/lib/markdown-it.js index 64af1ab26..6a22e9f64 100644 --- a/packages/frontend/lib/markdown-it.js +++ b/packages/frontend/lib/markdown-it.js @@ -1,9 +1,9 @@ import markdownIt from "markdown-it"; -import markdownItPrism from "markdown-it-prism"; import markdownItAbbr from "markdown-it-abbr"; import markdownItDeflist from "markdown-it-deflist"; import markdownItFootnote from "markdown-it-footnote"; import markdownItImageFigures from "markdown-it-image-figures"; +import markdownItPrism from "markdown-it-prism"; export default (() => { const options = { diff --git a/packages/frontend/lib/nunjucks.js b/packages/frontend/lib/nunjucks.js index efe01bc23..8218561e6 100644 --- a/packages/frontend/lib/nunjucks.js +++ b/packages/frontend/lib/nunjucks.js @@ -1,5 +1,7 @@ import { fileURLToPath } from "node:url"; + import nunjucks from "nunjucks"; + import * as filters from "./filters/index.js"; import * as globals from "./globals/index.js"; diff --git a/packages/frontend/lib/sharp.js b/packages/frontend/lib/sharp.js index 3fbc14679..ac2871e50 100644 --- a/packages/frontend/lib/sharp.js +++ b/packages/frontend/lib/sharp.js @@ -1,6 +1,8 @@ import fs from "node:fs"; import { fileURLToPath } from "node:url"; + import sharp from "sharp"; + import { icon } from "./globals/icon.js"; /** diff --git a/packages/frontend/test/unit/components/tag-input.js b/packages/frontend/test/unit/components/tag-input.js index 9b5530299..3ddbf4b8f 100644 --- a/packages/frontend/test/unit/components/tag-input.js +++ b/packages/frontend/test/unit/components/tag-input.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { tagInputSanitizer } from "../../../components/tag-input/sanitizer.js"; describe("frontend/components/tag-input/sanitizer", () => { diff --git a/packages/frontend/test/unit/filters/array.js b/packages/frontend/test/unit/filters/array.js index 36f9698c0..5aa31a46f 100644 --- a/packages/frontend/test/unit/filters/array.js +++ b/packages/frontend/test/unit/filters/array.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { isArray } from "../../../lib/filters/index.js"; describe("frontend/lib/filters/array", () => { diff --git a/packages/frontend/test/unit/filters/locale.js b/packages/frontend/test/unit/filters/locale.js index 02014baf6..9f9c8cec6 100644 --- a/packages/frontend/test/unit/filters/locale.js +++ b/packages/frontend/test/unit/filters/locale.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { languageName, languageNativeName, diff --git a/packages/frontend/test/unit/filters/string.js b/packages/frontend/test/unit/filters/string.js index e627eaadb..a249a48ab 100644 --- a/packages/frontend/test/unit/filters/string.js +++ b/packages/frontend/test/unit/filters/string.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { excerpt, includes, diff --git a/packages/frontend/test/unit/filters/url.js b/packages/frontend/test/unit/filters/url.js index 126fc76c4..c45bf7ff8 100644 --- a/packages/frontend/test/unit/filters/url.js +++ b/packages/frontend/test/unit/filters/url.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { friendlyUrl, imageUrl } from "../../../lib/filters/index.js"; describe("frontend/lib/filters/url", () => { diff --git a/packages/frontend/test/unit/globals/attributes.js b/packages/frontend/test/unit/globals/attributes.js index f1760dcc4..c7eb3b063 100644 --- a/packages/frontend/test/unit/globals/attributes.js +++ b/packages/frontend/test/unit/globals/attributes.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { attributes } from "../../../lib/globals/index.js"; describe("frontend/lib/globals/attributes", () => { diff --git a/packages/frontend/test/unit/globals/classes.js b/packages/frontend/test/unit/globals/classes.js index a2d121475..7e381a0ac 100644 --- a/packages/frontend/test/unit/globals/classes.js +++ b/packages/frontend/test/unit/globals/classes.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { classes } from "../../../lib/globals/index.js"; describe("frontend/lib/globals/classes", () => { diff --git a/packages/frontend/test/unit/globals/error-list.js b/packages/frontend/test/unit/globals/error-list.js index 31c2acdc8..4a27b0d15 100644 --- a/packages/frontend/test/unit/globals/error-list.js +++ b/packages/frontend/test/unit/globals/error-list.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { errorList } from "../../../lib/globals/index.js"; describe("frontend/lib/globals/error-list", () => { diff --git a/packages/frontend/test/unit/globals/field-data.js b/packages/frontend/test/unit/globals/field-data.js index 696f1ca7c..c59fe84da 100644 --- a/packages/frontend/test/unit/globals/field-data.js +++ b/packages/frontend/test/unit/globals/field-data.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { fieldData } from "../../../lib/globals/index.js"; describe("frontend/lib/globals/field-data", () => { diff --git a/packages/frontend/test/unit/globals/icon.js b/packages/frontend/test/unit/globals/icon.js index fa81e3089..f603bc828 100644 --- a/packages/frontend/test/unit/globals/icon.js +++ b/packages/frontend/test/unit/globals/icon.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { icon } from "../../../lib/globals/index.js"; describe("frontend/lib/globals/icon", () => { diff --git a/packages/frontend/test/unit/globals/item-id.js b/packages/frontend/test/unit/globals/item-id.js index 1fa4a42b6..2055117ca 100644 --- a/packages/frontend/test/unit/globals/item-id.js +++ b/packages/frontend/test/unit/globals/item-id.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { itemId } from "../../../lib/globals/item-id.js"; describe("frontend/lib/globals/item-id", () => { diff --git a/packages/frontend/test/unit/globals/summary-row.js b/packages/frontend/test/unit/globals/summary-row.js index 67f510787..191d39b32 100644 --- a/packages/frontend/test/unit/globals/summary-row.js +++ b/packages/frontend/test/unit/globals/summary-row.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { summaryRows } from "../../../lib/globals/index.js"; describe("frontend/lib/globals/summary-row", () => { diff --git a/packages/frontend/test/unit/theme.js b/packages/frontend/test/unit/theme.js index bdd53e712..34894bcb1 100644 --- a/packages/frontend/test/unit/theme.js +++ b/packages/frontend/test/unit/theme.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import Color from "color"; + import { _getValidatedColor, getBackgroundColor, diff --git a/packages/indiekit/bin/cli.js b/packages/indiekit/bin/cli.js index c2566ee95..45f6f3cf3 100755 --- a/packages/indiekit/bin/cli.js +++ b/packages/indiekit/bin/cli.js @@ -1,8 +1,10 @@ #!/usr/bin/env node import { createRequire } from "node:module"; + +import { Indiekit } from "@indiekit/indiekit"; import { Command } from "commander"; import makeDebug from "debug"; -import { Indiekit } from "@indiekit/indiekit"; + import { defaultConfig } from "../config/defaults.js"; const require = createRequire(import.meta.url); diff --git a/packages/indiekit/config/express.js b/packages/indiekit/config/express.js index a6463367d..8daa0c76b 100644 --- a/packages/indiekit/config/express.js +++ b/packages/indiekit/config/express.js @@ -1,9 +1,10 @@ +import { templates } from "@indiekit/frontend"; import compression from "compression"; import cookieSession from "cookie-session"; import makeDebug from "debug"; import express from "express"; import fileUpload from "express-fileupload"; -import { templates } from "@indiekit/frontend"; + import * as error from "../lib/middleware/error.js"; import { forceHttps } from "../lib/middleware/force-https.js"; import { internationalisation } from "../lib/middleware/internationalisation.js"; diff --git a/packages/indiekit/index.js b/packages/indiekit/index.js index a6e5ed853..4ccd4a3ab 100644 --- a/packages/indiekit/index.js +++ b/packages/indiekit/index.js @@ -1,9 +1,11 @@ #!/usr/bin/env node import { createRequire } from "node:module"; import process from "node:process"; + +import { default as KeyvMongo } from "@keyv/mongo"; import makeDebug from "debug"; import { default as Keyv } from "keyv"; -import { default as KeyvMongo } from "@keyv/mongo"; + import { expressConfig } from "./config/express.js"; import { locales } from "./config/locales.js"; import { getCategories } from "./lib/categories.js"; diff --git a/packages/indiekit/lib/config.js b/packages/indiekit/lib/config.js index 68f503d87..c311bed31 100644 --- a/packages/indiekit/lib/config.js +++ b/packages/indiekit/lib/config.js @@ -1,5 +1,6 @@ -import deepmerge from "deepmerge"; import { cosmiconfig } from "cosmiconfig"; +import deepmerge from "deepmerge"; + import { defaultConfig } from "../config/defaults.js"; /** diff --git a/packages/indiekit/lib/controllers/manifest.js b/packages/indiekit/lib/controllers/manifest.js index 9e08bcc0a..983d0e54d 100644 --- a/packages/indiekit/lib/controllers/manifest.js +++ b/packages/indiekit/lib/controllers/manifest.js @@ -1,4 +1,5 @@ import { getBackgroundColor, getThemeColor } from "@indiekit/frontend"; + import { getShortcuts } from "../shortcuts.js"; export const get = async (request, response) => { diff --git a/packages/indiekit/lib/controllers/plugin.js b/packages/indiekit/lib/controllers/plugin.js index 09683cf1d..33dcb51d5 100644 --- a/packages/indiekit/lib/controllers/plugin.js +++ b/packages/indiekit/lib/controllers/plugin.js @@ -1,4 +1,5 @@ import path from "node:path"; + import { getPackageData } from "../utils.js"; export const list = (request, response) => { diff --git a/packages/indiekit/lib/indieauth.js b/packages/indiekit/lib/indieauth.js index 65a97ff61..053be1eb1 100644 --- a/packages/indiekit/lib/indieauth.js +++ b/packages/indiekit/lib/indieauth.js @@ -1,13 +1,15 @@ import { createHash, randomBytes } from "node:crypto"; import process from "node:process"; + import { IndiekitError } from "@indiekit/error"; import { getCanonicalUrl, randomString } from "@indiekit/util"; + +import { generateState, validateState } from "./state.js"; import { findBearerToken, introspectToken, verifyTokenValues, } from "./token.js"; -import { generateState, validateState } from "./state.js"; export const IndieAuth = class { constructor(options = {}) { diff --git a/packages/indiekit/lib/locale-catalog.js b/packages/indiekit/lib/locale-catalog.js index 01bae756a..5bbdcdbd4 100644 --- a/packages/indiekit/lib/locale-catalog.js +++ b/packages/indiekit/lib/locale-catalog.js @@ -1,5 +1,6 @@ import { createRequire } from "node:module"; import path from "node:path"; + import deepmerge from "deepmerge"; const require = createRequire(import.meta.url); diff --git a/packages/indiekit/lib/middleware/locals.js b/packages/indiekit/lib/middleware/locals.js index 2b882077a..4a6d08ac4 100644 --- a/packages/indiekit/lib/middleware/locals.js +++ b/packages/indiekit/lib/middleware/locals.js @@ -1,5 +1,6 @@ import { scripts, styles } from "@indiekit/frontend"; import { sha1 } from "@indiekit/util"; + import { getEndpointUrls } from "../endpoints.js"; import { getNavigation } from "../navigation.js"; import { getUrl } from "../utils.js"; diff --git a/packages/indiekit/lib/routes.js b/packages/indiekit/lib/routes.js index 900f62fd7..1c195c78e 100644 --- a/packages/indiekit/lib/routes.js +++ b/packages/indiekit/lib/routes.js @@ -1,7 +1,9 @@ import path from "node:path"; -import express from "express"; + import { assetsPath } from "@indiekit/frontend"; +import express from "express"; import { default as rateLimit } from "express-rate-limit"; + import * as assetsController from "./controllers/assets.js"; import * as clientController from "./controllers/client.js"; import * as feedController from "./controllers/feed.js"; diff --git a/packages/indiekit/lib/utils.js b/packages/indiekit/lib/utils.js index 5c65ed9f3..28954baf4 100644 --- a/packages/indiekit/lib/utils.js +++ b/packages/indiekit/lib/utils.js @@ -1,5 +1,5 @@ -import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto"; import { Buffer } from "node:buffer"; +import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto"; import { readFile } from "node:fs/promises"; import { createRequire } from "node:module"; import path from "node:path"; diff --git a/packages/indiekit/test/index.js b/packages/indiekit/test/index.js index 9e9e3c82b..eebdbc3b5 100644 --- a/packages/indiekit/test/index.js +++ b/packages/indiekit/test/index.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { after, before, describe, it, mock } from "node:test"; + import { testConfig } from "@indiekit-test/config"; import { testDatabase } from "@indiekit-test/database"; import TestStore from "@indiekit-test/store"; + import { Indiekit } from "../index.js"; describe("indiekit", async () => { diff --git a/packages/indiekit/test/integration/200-app-icon.js b/packages/indiekit/test/integration/200-app-icon.js index 6f5d543f6..fc11b1753 100644 --- a/packages/indiekit/test/integration/200-app-icon.js +++ b/packages/indiekit/test/integration/200-app-icon.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-client.js b/packages/indiekit/test/integration/200-client.js index 952a3fdc5..d20eb621d 100644 --- a/packages/indiekit/test/integration/200-client.js +++ b/packages/indiekit/test/integration/200-client.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-feed-jf2.js b/packages/indiekit/test/integration/200-feed-jf2.js index e9a94aa0d..e2e141479 100644 --- a/packages/indiekit/test/integration/200-feed-jf2.js +++ b/packages/indiekit/test/integration/200-feed-jf2.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-homepage-view.js b/packages/indiekit/test/integration/200-homepage-view.js index e060a840a..ab5bdda09 100644 --- a/packages/indiekit/test/integration/200-homepage-view.js +++ b/packages/indiekit/test/integration/200-homepage-view.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-manifest.js b/packages/indiekit/test/integration/200-manifest.js index 03b77455f..336eea0f1 100644 --- a/packages/indiekit/test/integration/200-manifest.js +++ b/packages/indiekit/test/integration/200-manifest.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-offline-view.js b/packages/indiekit/test/integration/200-offline-view.js index 8fecefd84..fd3b460a7 100644 --- a/packages/indiekit/test/integration/200-offline-view.js +++ b/packages/indiekit/test/integration/200-offline-view.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-plugin-list.js b/packages/indiekit/test/integration/200-plugin-list.js index ee934f580..3158f864a 100644 --- a/packages/indiekit/test/integration/200-plugin-list.js +++ b/packages/indiekit/test/integration/200-plugin-list.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-plugin-view.js b/packages/indiekit/test/integration/200-plugin-view.js index c8d241e7f..7e550b703 100644 --- a/packages/indiekit/test/integration/200-plugin-view.js +++ b/packages/indiekit/test/integration/200-plugin-view.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-robots.js b/packages/indiekit/test/integration/200-robots.js index c37ba088c..57b0ceaaa 100644 --- a/packages/indiekit/test/integration/200-robots.js +++ b/packages/indiekit/test/integration/200-robots.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-scripts.js b/packages/indiekit/test/integration/200-scripts.js index 38740f209..a38c39b43 100644 --- a/packages/indiekit/test/integration/200-scripts.js +++ b/packages/indiekit/test/integration/200-scripts.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-session-auth.js b/packages/indiekit/test/integration/200-session-auth.js index 088cacd9b..0711db576 100644 --- a/packages/indiekit/test/integration/200-session-auth.js +++ b/packages/indiekit/test/integration/200-session-auth.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("indiekit"); diff --git a/packages/indiekit/test/integration/200-session-localised.js b/packages/indiekit/test/integration/200-session-localised.js index b1b4f0c22..50147616a 100644 --- a/packages/indiekit/test/integration/200-session-localised.js +++ b/packages/indiekit/test/integration/200-session-localised.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer({ locale: "de" }); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-session-login.js b/packages/indiekit/test/integration/200-session-login.js index 762d62130..5f326cb4f 100644 --- a/packages/indiekit/test/integration/200-session-login.js +++ b/packages/indiekit/test/integration/200-session-login.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-shortcut-icon.js b/packages/indiekit/test/integration/200-shortcut-icon.js index d6a9c3ebc..5d559be1c 100644 --- a/packages/indiekit/test/integration/200-shortcut-icon.js +++ b/packages/indiekit/test/integration/200-shortcut-icon.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-status-view.js b/packages/indiekit/test/integration/200-status-view.js index 2efd22b54..07418633a 100644 --- a/packages/indiekit/test/integration/200-status-view.js +++ b/packages/indiekit/test/integration/200-status-view.js @@ -1,9 +1,10 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; -import { JSDOM } from "jsdom"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import { JSDOM } from "jsdom"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/200-styles.js b/packages/indiekit/test/integration/200-styles.js index 0ced8b3f1..4e3a92fc8 100644 --- a/packages/indiekit/test/integration/200-styles.js +++ b/packages/indiekit/test/integration/200-styles.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/302-session-login-auth.js b/packages/indiekit/test/integration/302-session-login-auth.js index 9d4366ca8..e0f6488d8 100644 --- a/packages/indiekit/test/integration/302-session-login-auth.js +++ b/packages/indiekit/test/integration/302-session-login-auth.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/302-session-login-redirect.js b/packages/indiekit/test/integration/302-session-login-redirect.js index db1d5e4ed..a1cacae98 100644 --- a/packages/indiekit/test/integration/302-session-login-redirect.js +++ b/packages/indiekit/test/integration/302-session-login-redirect.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testCookie } from "@indiekit-test/session"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/302-session-logout.js b/packages/indiekit/test/integration/302-session-logout.js index e50195a49..a9b710ffa 100644 --- a/packages/indiekit/test/integration/302-session-logout.js +++ b/packages/indiekit/test/integration/302-session-logout.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/302-status-redirect.js b/packages/indiekit/test/integration/302-status-redirect.js index c8145724a..698799a67 100644 --- a/packages/indiekit/test/integration/302-status-redirect.js +++ b/packages/indiekit/test/integration/302-status-redirect.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/400-session-missing-code.js b/packages/indiekit/test/integration/400-session-missing-code.js index 5d5b64491..675083413 100644 --- a/packages/indiekit/test/integration/400-session-missing-code.js +++ b/packages/indiekit/test/integration/400-session-missing-code.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/400-session-missing-state.js b/packages/indiekit/test/integration/400-session-missing-state.js index 5812a004f..768044265 100644 --- a/packages/indiekit/test/integration/400-session-missing-state.js +++ b/packages/indiekit/test/integration/400-session-missing-state.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/401-session-auth-invalid-token.js b/packages/indiekit/test/integration/401-session-auth-invalid-token.js index 8828cbe43..c1e6cf81b 100644 --- a/packages/indiekit/test/integration/401-session-auth-invalid-token.js +++ b/packages/indiekit/test/integration/401-session-auth-invalid-token.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { mockAgent } from "@indiekit-test/mock-agent"; import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; await mockAgent("indiekit"); const server = await testServer({ diff --git a/packages/indiekit/test/integration/403-session-auth-invalid-redirect.js b/packages/indiekit/test/integration/403-session-auth-invalid-redirect.js index 163ef49ff..8b17eba6b 100644 --- a/packages/indiekit/test/integration/403-session-auth-invalid-redirect.js +++ b/packages/indiekit/test/integration/403-session-auth-invalid-redirect.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/403-session-auth-invalid-state.js b/packages/indiekit/test/integration/403-session-auth-invalid-state.js index d040c4832..f8c9326de 100644 --- a/packages/indiekit/test/integration/403-session-auth-invalid-state.js +++ b/packages/indiekit/test/integration/403-session-auth-invalid-state.js @@ -1,7 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/integration/404-not-found.js b/packages/indiekit/test/integration/404-not-found.js index ea0a5cc7f..4e9111a21 100644 --- a/packages/indiekit/test/integration/404-not-found.js +++ b/packages/indiekit/test/integration/404-not-found.js @@ -1,8 +1,9 @@ import { strict as assert } from "node:assert"; import { after, describe, it } from "node:test"; -import supertest from "supertest"; + import { testServer } from "@indiekit-test/server"; import { testToken } from "@indiekit-test/token"; +import supertest from "supertest"; const server = await testServer(); const request = supertest.agent(server); diff --git a/packages/indiekit/test/server.js b/packages/indiekit/test/server.js index 92ff81919..ca1c39923 100644 --- a/packages/indiekit/test/server.js +++ b/packages/indiekit/test/server.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { before, describe, it, mock } from "node:test"; + import { testConfig } from "@indiekit-test/config"; + import { Indiekit } from "../index.js"; describe("indiekit server", async () => { diff --git a/packages/indiekit/test/unit/cache.js b/packages/indiekit/test/unit/cache.js index eb3ddca44..63a86b4dc 100644 --- a/packages/indiekit/test/unit/cache.js +++ b/packages/indiekit/test/unit/cache.js @@ -1,7 +1,9 @@ import { strict as assert } from "node:assert"; import { describe, it, mock } from "node:test"; -import { default as Keyv } from "keyv"; + import { mockAgent } from "@indiekit-test/mock-agent"; +import { default as Keyv } from "keyv"; + import { getCachedResponse } from "../../lib/cache.js"; await mockAgent("indiekit"); diff --git a/packages/indiekit/test/unit/categories.js b/packages/indiekit/test/unit/categories.js index 7bfb38733..58f34b80e 100644 --- a/packages/indiekit/test/unit/categories.js +++ b/packages/indiekit/test/unit/categories.js @@ -1,7 +1,9 @@ import { strict as assert } from "node:assert"; import { describe, it, mock } from "node:test"; -import { mockAgent } from "@indiekit-test/mock-agent"; + import { testConfig } from "@indiekit-test/config"; +import { mockAgent } from "@indiekit-test/mock-agent"; + import { Indiekit } from "../../index.js"; import { getCategories } from "../../lib/categories.js"; diff --git a/packages/indiekit/test/unit/endpoints.js b/packages/indiekit/test/unit/endpoints.js index b1dceb12f..31cd3f90c 100644 --- a/packages/indiekit/test/unit/endpoints.js +++ b/packages/indiekit/test/unit/endpoints.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { mockRequest } from "mock-req-res"; + import { getEndpointUrls } from "../../lib/endpoints.js"; const application = { diff --git a/packages/indiekit/test/unit/indieauth.js b/packages/indiekit/test/unit/indieauth.js index 470b3faa6..88b2d4dd4 100644 --- a/packages/indiekit/test/unit/indieauth.js +++ b/packages/indiekit/test/unit/indieauth.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { describe, it, mock } from "node:test"; -import { mockRequest, mockResponse } from "mock-req-res"; + import { IndiekitError } from "@indiekit/error"; import { mockAgent } from "@indiekit-test/mock-agent"; +import { mockRequest, mockResponse } from "mock-req-res"; + import { IndieAuth } from "../../lib/indieauth.js"; await mockAgent("indiekit"); diff --git a/packages/indiekit/test/unit/middleware/error.js b/packages/indiekit/test/unit/middleware/error.js index e78d28e30..2a82a8348 100644 --- a/packages/indiekit/test/unit/middleware/error.js +++ b/packages/indiekit/test/unit/middleware/error.js @@ -1,7 +1,9 @@ import { strict as assert } from "node:assert"; import { describe, it, mock } from "node:test"; -import { mockRequest, mockResponse } from "mock-req-res"; + import { IndiekitError } from "@indiekit/error"; +import { mockRequest, mockResponse } from "mock-req-res"; + import { notFound, internalServer } from "../../../lib/middleware/error.js"; describe("indiekit/lib/middleware/error", () => { diff --git a/packages/indiekit/test/unit/middleware/force-https.js b/packages/indiekit/test/unit/middleware/force-https.js index 70f23bcb7..f2460677e 100644 --- a/packages/indiekit/test/unit/middleware/force-https.js +++ b/packages/indiekit/test/unit/middleware/force-https.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it, mock } from "node:test"; + import { mockRequest, mockResponse } from "mock-req-res"; + import { forceHttps } from "../../../lib/middleware/force-https.js"; describe("indiekit/lib/middleware/error", () => { diff --git a/packages/indiekit/test/unit/middleware/internationalisation.js b/packages/indiekit/test/unit/middleware/internationalisation.js index 37e2ddaeb..0812027cd 100644 --- a/packages/indiekit/test/unit/middleware/internationalisation.js +++ b/packages/indiekit/test/unit/middleware/internationalisation.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it, mock } from "node:test"; + import { mockRequest, mockResponse } from "mock-req-res"; + import { internationalisation } from "../../../lib/middleware/internationalisation.js"; describe("indiekit/lib/middleware/internationalisation", () => { diff --git a/packages/indiekit/test/unit/middleware/locals.js b/packages/indiekit/test/unit/middleware/locals.js index 0b136466d..209ad64b2 100644 --- a/packages/indiekit/test/unit/middleware/locals.js +++ b/packages/indiekit/test/unit/middleware/locals.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it, mock } from "node:test"; + import { mockRequest, mockResponse } from "mock-req-res"; + import { defaultConfig } from "../../../config/defaults.js"; import { locals } from "../../../lib/middleware/locals.js"; diff --git a/packages/indiekit/test/unit/mongodb.js b/packages/indiekit/test/unit/mongodb.js index db16241fb..f00e531f2 100644 --- a/packages/indiekit/test/unit/mongodb.js +++ b/packages/indiekit/test/unit/mongodb.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { after, describe, it, mock } from "node:test"; + import { MongoMemoryServer } from "mongodb-memory-server"; + import { getMongodbClient } from "../../lib/mongodb.js"; const mongod = await MongoMemoryServer.create(); diff --git a/packages/indiekit/test/unit/navigation.js b/packages/indiekit/test/unit/navigation.js index be1dc9535..6f148678c 100644 --- a/packages/indiekit/test/unit/navigation.js +++ b/packages/indiekit/test/unit/navigation.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { mockRequest, mockResponse } from "mock-req-res"; + import { getNavigation } from "../../lib/navigation.js"; const Indiekit = { diff --git a/packages/indiekit/test/unit/plugins.js b/packages/indiekit/test/unit/plugins.js index c23ae7136..639297d3f 100644 --- a/packages/indiekit/test/unit/plugins.js +++ b/packages/indiekit/test/unit/plugins.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getInstalledPlugin, getPluginId } from "../../lib/plugins.js"; describe("indiekit/lib/plugins", async () => { diff --git a/packages/indiekit/test/unit/post-template.js b/packages/indiekit/test/unit/post-template.js index cc130747e..3c41a33cc 100644 --- a/packages/indiekit/test/unit/post-template.js +++ b/packages/indiekit/test/unit/post-template.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { testConfig } from "@indiekit-test/config"; + import { Indiekit } from "../../index.js"; import { getPostTemplate } from "../../lib/post-template.js"; diff --git a/packages/indiekit/test/unit/post-types.js b/packages/indiekit/test/unit/post-types.js index f0a741713..0b2203942 100644 --- a/packages/indiekit/test/unit/post-types.js +++ b/packages/indiekit/test/unit/post-types.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { testConfig } from "@indiekit-test/config"; + import { Indiekit } from "../../index.js"; import { getPostTypes } from "../../lib/post-types.js"; diff --git a/packages/indiekit/test/unit/shortcuts.js b/packages/indiekit/test/unit/shortcuts.js index daf73abe6..f1b09b5d4 100644 --- a/packages/indiekit/test/unit/shortcuts.js +++ b/packages/indiekit/test/unit/shortcuts.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { mockResponse } from "mock-req-res"; + import { getShortcuts } from "../../lib/shortcuts.js"; const Indiekit = { diff --git a/packages/indiekit/test/unit/state.js b/packages/indiekit/test/unit/state.js index 476901f15..40cda6762 100644 --- a/packages/indiekit/test/unit/state.js +++ b/packages/indiekit/test/unit/state.js @@ -1,6 +1,7 @@ import { strict as assert } from "node:assert"; import { randomBytes } from "node:crypto"; import { describe, it } from "node:test"; + import { generateState, validateState } from "../../lib/state.js"; const clientId = "https://server.example"; diff --git a/packages/indiekit/test/unit/store.js b/packages/indiekit/test/unit/store.js index 881ac301f..e382bb83b 100644 --- a/packages/indiekit/test/unit/store.js +++ b/packages/indiekit/test/unit/store.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getMediaStore, getStore } from "../../lib/store.js"; describe("indiekit/lib/store", async () => { diff --git a/packages/indiekit/test/unit/tokens.js b/packages/indiekit/test/unit/tokens.js index de0dca96c..e2b101dcd 100644 --- a/packages/indiekit/test/unit/tokens.js +++ b/packages/indiekit/test/unit/tokens.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { mockAgent } from "@indiekit-test/mock-agent"; + import { findBearerToken, introspectToken, diff --git a/packages/indiekit/test/unit/utils.js b/packages/indiekit/test/unit/utils.js index 82859e4cb..d9b7758a0 100644 --- a/packages/indiekit/test/unit/utils.js +++ b/packages/indiekit/test/unit/utils.js @@ -2,6 +2,7 @@ import { strict as assert } from "node:assert"; import { randomBytes } from "node:crypto"; import { describe, it } from "node:test"; import { fileURLToPath } from "node:url"; + import { decrypt, encrypt, getPackageData } from "../../lib/utils.js"; const iv = randomBytes(16); diff --git a/packages/preset-eleventy/test/index.js b/packages/preset-eleventy/test/index.js index 399fe9890..c535c34a2 100644 --- a/packages/preset-eleventy/test/index.js +++ b/packages/preset-eleventy/test/index.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { Indiekit } from "@indiekit/indiekit"; + import EleventyPreset from "../index.js"; describe("preset-eleventy", async () => { diff --git a/packages/preset-eleventy/test/unit/post-template.js b/packages/preset-eleventy/test/unit/post-template.js index 6208d9abb..11555b439 100644 --- a/packages/preset-eleventy/test/unit/post-template.js +++ b/packages/preset-eleventy/test/unit/post-template.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getFixture } from "@indiekit-test/fixtures"; + import { getPostTemplate } from "../../lib/post-template.js"; describe("preset-jekyll/lib/post-template", async () => { diff --git a/packages/preset-eleventy/test/unit/post-types.js b/packages/preset-eleventy/test/unit/post-types.js index 531aa7663..f32ce1d71 100644 --- a/packages/preset-eleventy/test/unit/post-types.js +++ b/packages/preset-eleventy/test/unit/post-types.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getPostTypes } from "../../lib/post-types.js"; const postTypes = new Map(); diff --git a/packages/preset-hugo/lib/post-template.js b/packages/preset-hugo/lib/post-template.js index b17f6a14c..c3a955548 100644 --- a/packages/preset-hugo/lib/post-template.js +++ b/packages/preset-hugo/lib/post-template.js @@ -1,5 +1,5 @@ -import camelcaseKeys from "camelcase-keys"; import TOML from "@iarna/toml"; +import camelcaseKeys from "camelcase-keys"; import YAML from "yaml"; /** diff --git a/packages/preset-hugo/test/index.js b/packages/preset-hugo/test/index.js index d60a16001..2aeb7cf3d 100644 --- a/packages/preset-hugo/test/index.js +++ b/packages/preset-hugo/test/index.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { Indiekit } from "@indiekit/indiekit"; + import HugoPreset from "../index.js"; describe("preset-hugo", async () => { diff --git a/packages/preset-hugo/test/unit/post-template.js b/packages/preset-hugo/test/unit/post-template.js index 9638090eb..b9e8aadcd 100644 --- a/packages/preset-hugo/test/unit/post-template.js +++ b/packages/preset-hugo/test/unit/post-template.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getFixture } from "@indiekit-test/fixtures"; + import { getPostTemplate } from "../../lib/post-template.js"; describe("preset-jekyll/lib/post-template", async () => { diff --git a/packages/preset-hugo/test/unit/post-types.js b/packages/preset-hugo/test/unit/post-types.js index 450e0df5d..d9c4f72ce 100644 --- a/packages/preset-hugo/test/unit/post-types.js +++ b/packages/preset-hugo/test/unit/post-types.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getPostTypes } from "../../lib/post-types.js"; const postTypes = new Map(); diff --git a/packages/preset-jekyll/test/index.js b/packages/preset-jekyll/test/index.js index 226895427..c7b6585ec 100644 --- a/packages/preset-jekyll/test/index.js +++ b/packages/preset-jekyll/test/index.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { Indiekit } from "@indiekit/indiekit"; + import JekyllPreset from "../index.js"; describe("preset-jekyll", async () => { diff --git a/packages/preset-jekyll/test/unit/post-template.js b/packages/preset-jekyll/test/unit/post-template.js index 07b1fb1ff..54935aed2 100644 --- a/packages/preset-jekyll/test/unit/post-template.js +++ b/packages/preset-jekyll/test/unit/post-template.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getFixture } from "@indiekit-test/fixtures"; + import { getPostTemplate } from "../../lib/post-template.js"; describe("preset-jekyll/lib/post-template", async () => { diff --git a/packages/preset-jekyll/test/unit/post-types.js b/packages/preset-jekyll/test/unit/post-types.js index af99df598..55e3f6fa8 100644 --- a/packages/preset-jekyll/test/unit/post-types.js +++ b/packages/preset-jekyll/test/unit/post-types.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getPostTypes } from "../../lib/post-types.js"; const postTypes = new Map(); diff --git a/packages/store-bitbucket/index.js b/packages/store-bitbucket/index.js index 7953f5eb8..e08daa7ba 100644 --- a/packages/store-bitbucket/index.js +++ b/packages/store-bitbucket/index.js @@ -1,8 +1,9 @@ import path from "node:path"; import process from "node:process"; + +import { IndiekitError } from "@indiekit/error"; // eslint-disable-next-line import/default import bitbucket from "bitbucket"; -import { IndiekitError } from "@indiekit/error"; const defaults = { branch: "main", diff --git a/packages/store-bitbucket/test/index.js b/packages/store-bitbucket/test/index.js index bc418f5ed..b09123756 100644 --- a/packages/store-bitbucket/test/index.js +++ b/packages/store-bitbucket/test/index.js @@ -1,7 +1,9 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; -import nock from "nock"; + import { Indiekit } from "@indiekit/indiekit"; +import nock from "nock"; + import BitbucketStore from "../index.js"; describe("store-bitbucket", () => { diff --git a/packages/store-file-system/index.js b/packages/store-file-system/index.js index d275aa0f9..b6a9a099b 100644 --- a/packages/store-file-system/index.js +++ b/packages/store-file-system/index.js @@ -1,7 +1,8 @@ -import fs from "node:fs/promises"; import { existsSync } from "node:fs"; +import fs from "node:fs/promises"; import path from "node:path"; import process from "node:process"; + import { IndiekitError } from "@indiekit/error"; const defaults = { diff --git a/packages/store-file-system/test/index.js b/packages/store-file-system/test/index.js index 26b76e61c..4c5719edb 100644 --- a/packages/store-file-system/test/index.js +++ b/packages/store-file-system/test/index.js @@ -2,8 +2,10 @@ import { strict as assert } from "node:assert"; import { existsSync } from "node:fs"; import fs from "node:fs/promises"; import { afterEach, describe, it } from "node:test"; -import mockFs from "mock-fs"; + import { Indiekit } from "@indiekit/indiekit"; +import mockFs from "mock-fs"; + import FileSystemStore from "../index.js"; describe("store-file-system", () => { diff --git a/packages/store-ftp/index.js b/packages/store-ftp/index.js index 1351c6cff..0315b7afd 100644 --- a/packages/store-ftp/index.js +++ b/packages/store-ftp/index.js @@ -1,6 +1,7 @@ import path from "node:path"; import process from "node:process"; import { Readable } from "node:stream"; + import { IndiekitError } from "@indiekit/error"; import Client from "ssh2-sftp-client"; diff --git a/packages/store-ftp/test/index.js b/packages/store-ftp/test/index.js index 01999725f..c2bfdb7f1 100644 --- a/packages/store-ftp/test/index.js +++ b/packages/store-ftp/test/index.js @@ -1,8 +1,10 @@ /* eslint-disable unicorn/no-useless-undefined */ import { strict as assert } from "node:assert"; import { before, after, describe, it } from "node:test"; + import { Indiekit } from "@indiekit/indiekit"; import { closeServer, createSftpMockServer } from "@micham/sftp-mock-server"; + import FtpStore from "../index.js"; describe("store-ftp", () => { diff --git a/packages/store-gitea/index.js b/packages/store-gitea/index.js index 25dda80da..6001d372b 100644 --- a/packages/store-gitea/index.js +++ b/packages/store-gitea/index.js @@ -1,6 +1,7 @@ +import { Buffer } from "node:buffer"; import path from "node:path"; import process from "node:process"; -import { Buffer } from "node:buffer"; + import { IndiekitError } from "@indiekit/error"; const defaults = { diff --git a/packages/store-gitea/test/index.js b/packages/store-gitea/test/index.js index 390fd7e99..753c7ea7a 100644 --- a/packages/store-gitea/test/index.js +++ b/packages/store-gitea/test/index.js @@ -1,7 +1,9 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { Indiekit } from "@indiekit/indiekit"; import { mockAgent } from "@indiekit-test/mock-agent"; + import GiteaStore from "../index.js"; await mockAgent("store-gitea"); diff --git a/packages/store-github/index.js b/packages/store-github/index.js index 71f0e26aa..f02ff5760 100644 --- a/packages/store-github/index.js +++ b/packages/store-github/index.js @@ -1,8 +1,9 @@ +import { Buffer } from "node:buffer"; import path from "node:path"; import process from "node:process"; -import { Buffer } from "node:buffer"; -import makeDebug from "debug"; + import { IndiekitError } from "@indiekit/error"; +import makeDebug from "debug"; const debug = makeDebug(`indiekit-store:github`); diff --git a/packages/store-github/test/index.js b/packages/store-github/test/index.js index cbcb0dd81..0854eb182 100644 --- a/packages/store-github/test/index.js +++ b/packages/store-github/test/index.js @@ -1,8 +1,10 @@ // @ts-nocheck import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { Indiekit } from "@indiekit/indiekit"; import { mockAgent } from "@indiekit-test/mock-agent"; + import GithubStore from "../index.js"; await mockAgent("store-github"); diff --git a/packages/store-gitlab/index.js b/packages/store-gitlab/index.js index 602b848e3..ffb9563d1 100644 --- a/packages/store-gitlab/index.js +++ b/packages/store-gitlab/index.js @@ -1,9 +1,10 @@ +import { Buffer } from "node:buffer"; import path from "node:path"; import process from "node:process"; -import { Buffer } from "node:buffer"; -import { IndiekitError } from "@indiekit/error"; + // eslint-disable-next-line import/no-unresolved import { Gitlab } from "@gitbeaker/rest"; +import { IndiekitError } from "@indiekit/error"; const defaults = { branch: "main", diff --git a/packages/store-gitlab/test/index.js b/packages/store-gitlab/test/index.js index d2e66c661..d4c4970b8 100644 --- a/packages/store-gitlab/test/index.js +++ b/packages/store-gitlab/test/index.js @@ -1,7 +1,9 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { Indiekit } from "@indiekit/indiekit"; import { mockAgent } from "@indiekit-test/mock-agent"; + import GitlabStore from "../index.js"; await mockAgent("store-gitlab"); diff --git a/packages/store-s3/index.js b/packages/store-s3/index.js index 64f961515..4e97d0987 100644 --- a/packages/store-s3/index.js +++ b/packages/store-s3/index.js @@ -1,6 +1,6 @@ import path from "node:path"; import process from "node:process"; -import { IndiekitError } from "@indiekit/error"; + import { CopyObjectCommand, DeleteObjectCommand, @@ -8,6 +8,7 @@ import { PutObjectCommand, S3Client, } from "@aws-sdk/client-s3"; +import { IndiekitError } from "@indiekit/error"; const defaults = { accessKey: process.env.S3_ACCESS_KEY, diff --git a/packages/store-s3/test/index.js b/packages/store-s3/test/index.js index f9663a2f4..817a3fe92 100644 --- a/packages/store-s3/test/index.js +++ b/packages/store-s3/test/index.js @@ -1,6 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it, mock } from "node:test"; -import { Indiekit } from "@indiekit/indiekit"; + import { CopyObjectCommand, DeleteObjectCommand, @@ -8,7 +8,9 @@ import { PutObjectCommand, S3Client, } from "@aws-sdk/client-s3"; +import { Indiekit } from "@indiekit/indiekit"; import { mockClient } from "aws-sdk-client-mock"; + import S3Store from "../index.js"; describe("store-s3", () => { diff --git a/packages/syndicator-internet-archive/index.js b/packages/syndicator-internet-archive/index.js index fee87eae9..f2dca8561 100644 --- a/packages/syndicator-internet-archive/index.js +++ b/packages/syndicator-internet-archive/index.js @@ -1,5 +1,7 @@ import process from "node:process"; + import { IndiekitError } from "@indiekit/error"; + import { internetArchive } from "./lib/internet-archive.js"; const defaults = { diff --git a/packages/syndicator-internet-archive/test/index.js b/packages/syndicator-internet-archive/test/index.js index bff3dc6ac..54bc9c81e 100644 --- a/packages/syndicator-internet-archive/test/index.js +++ b/packages/syndicator-internet-archive/test/index.js @@ -1,7 +1,9 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; -import { mockAgent } from "@indiekit-test/mock-agent"; + import { Indiekit } from "@indiekit/indiekit"; +import { mockAgent } from "@indiekit-test/mock-agent"; + import InternetArchiveSyndicator from "../index.js"; await mockAgent("syndicator-internet-archive"); diff --git a/packages/syndicator-internet-archive/test/unit/internet-archive.js b/packages/syndicator-internet-archive/test/unit/internet-archive.js index 33cce4b44..c8e5965fe 100644 --- a/packages/syndicator-internet-archive/test/unit/internet-archive.js +++ b/packages/syndicator-internet-archive/test/unit/internet-archive.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { mockAgent } from "@indiekit-test/mock-agent"; + import { internetArchive } from "../../lib/internet-archive.js"; await mockAgent("syndicator-internet-archive"); diff --git a/packages/syndicator-mastodon/index.js b/packages/syndicator-mastodon/index.js index d70b5bf60..1e98a9ccf 100644 --- a/packages/syndicator-mastodon/index.js +++ b/packages/syndicator-mastodon/index.js @@ -1,6 +1,8 @@ import path from "node:path"; import process from "node:process"; + import { IndiekitError } from "@indiekit/error"; + import { mastodon } from "./lib/mastodon.js"; const defaults = { diff --git a/packages/syndicator-mastodon/lib/mastodon.js b/packages/syndicator-mastodon/lib/mastodon.js index fcc946bb0..818791b6e 100644 --- a/packages/syndicator-mastodon/lib/mastodon.js +++ b/packages/syndicator-mastodon/lib/mastodon.js @@ -1,6 +1,7 @@ import { IndiekitError } from "@indiekit/error"; import { getCanonicalUrl, isSameOrigin } from "@indiekit/util"; import { createRestAPIClient } from "masto"; + import { createStatus, getStatusIdFromUrl } from "./utils.js"; /** diff --git a/packages/syndicator-mastodon/lib/utils.js b/packages/syndicator-mastodon/lib/utils.js index b3084807e..c16db526f 100644 --- a/packages/syndicator-mastodon/lib/utils.js +++ b/packages/syndicator-mastodon/lib/utils.js @@ -1,4 +1,5 @@ import path from "node:path"; + import { IndiekitError } from "@indiekit/error"; import brevity from "brevity"; import { htmlToText } from "html-to-text"; @@ -84,7 +85,7 @@ export const createStatus = (properties, options = {}) => { /** * Get status ID from Mastodon status URL - * @param {string} url Mastodon status URL + * @param {string} url - Mastodon status URL * @returns {string} Status ID */ export const getStatusIdFromUrl = (url) => { diff --git a/packages/syndicator-mastodon/test/index.js b/packages/syndicator-mastodon/test/index.js index 22355be54..3ce43320a 100644 --- a/packages/syndicator-mastodon/test/index.js +++ b/packages/syndicator-mastodon/test/index.js @@ -1,8 +1,10 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { Indiekit } from "@indiekit/indiekit"; import { getFixture } from "@indiekit-test/fixtures"; import { mockAgent } from "@indiekit-test/mock-agent"; + import MastodonSyndicator from "../index.js"; await mockAgent("syndicator-mastodon"); diff --git a/packages/syndicator-mastodon/test/unit/mastodon.js b/packages/syndicator-mastodon/test/unit/mastodon.js index 9a4cfac5f..d05af8593 100644 --- a/packages/syndicator-mastodon/test/unit/mastodon.js +++ b/packages/syndicator-mastodon/test/unit/mastodon.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { beforeEach, describe, it } from "node:test"; + import { mockAgent } from "@indiekit-test/mock-agent"; + import { mastodon } from "../../lib/mastodon.js"; await mockAgent("syndicator-mastodon"); diff --git a/packages/syndicator-mastodon/test/unit/utils.js b/packages/syndicator-mastodon/test/unit/utils.js index 981cbf103..95fee2b19 100644 --- a/packages/syndicator-mastodon/test/unit/utils.js +++ b/packages/syndicator-mastodon/test/unit/utils.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getFixture } from "@indiekit-test/fixtures"; + import { createStatus, getStatusIdFromUrl, diff --git a/packages/util/lib/date.js b/packages/util/lib/date.js index b214217b0..46b9eebee 100644 --- a/packages/util/lib/date.js +++ b/packages/util/lib/date.js @@ -1,5 +1,5 @@ -import { format, parseISO } from "date-fns"; import { tz, tzOffset } from "@date-fns/tz"; +import { format, parseISO } from "date-fns"; import * as locales from "date-fns/locale"; export const dateTokens = [ diff --git a/packages/util/lib/string.js b/packages/util/lib/string.js index 8a7a498d8..965defe5b 100644 --- a/packages/util/lib/string.js +++ b/packages/util/lib/string.js @@ -1,4 +1,5 @@ import { randomBytes, createHash } from "node:crypto"; + import slugifyString from "@sindresorhus/slugify"; /** diff --git a/packages/util/test/unit/collection.js b/packages/util/test/unit/collection.js index dfd539f39..c307d2383 100644 --- a/packages/util/test/unit/collection.js +++ b/packages/util/test/unit/collection.js @@ -1,9 +1,11 @@ import { strict as assert } from "node:assert"; import { after, beforeEach, describe, it } from "node:test"; + import { testDatabase } from "@indiekit-test/database"; -import { getCursor } from "../../lib/collection.js"; import { ObjectId } from "mongodb"; +import { getCursor } from "../../lib/collection.js"; + describe("util/lib/collection", async () => { const { client, database, mongoServer } = await testDatabase(); let items; diff --git a/packages/util/test/unit/date.js b/packages/util/test/unit/date.js index f40f5f040..cc7d01b19 100644 --- a/packages/util/test/unit/date.js +++ b/packages/util/test/unit/date.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { isValid, parseISO } from "date-fns"; + import { formatDate, formatDateToLocal, diff --git a/packages/util/test/unit/object.js b/packages/util/test/unit/object.js index 18c95324d..7eb762854 100644 --- a/packages/util/test/unit/object.js +++ b/packages/util/test/unit/object.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { sanitise } from "../../lib/object.js"; describe("util/lib/object", () => { diff --git a/packages/util/test/unit/string.js b/packages/util/test/unit/string.js index d010ff8bf..a43662e29 100644 --- a/packages/util/test/unit/string.js +++ b/packages/util/test/unit/string.js @@ -1,6 +1,7 @@ import { strict as assert } from "node:assert"; import { Buffer } from "node:buffer"; import { describe, it } from "node:test"; + import { md5, randomString, diff --git a/packages/util/test/unit/url.js b/packages/util/test/unit/url.js index a83945ec6..1f2ee28bd 100644 --- a/packages/util/test/unit/url.js +++ b/packages/util/test/unit/url.js @@ -1,5 +1,6 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { getCanonicalUrl, isSameOrigin } from "../../lib/url.js"; describe("util/lib/url", () => { diff --git a/packages/util/test/unit/validation-schema.js b/packages/util/test/unit/validation-schema.js index cb726473a..e8a7cb4ef 100644 --- a/packages/util/test/unit/validation-schema.js +++ b/packages/util/test/unit/validation-schema.js @@ -1,6 +1,8 @@ import { strict as assert } from "node:assert"; import { describe, it } from "node:test"; + import { mockRequest } from "mock-req-res"; + import { isRequired } from "../../lib/validation-schema.js"; describe("util/lib/validation-schema", () => {