Fix scope
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* in-memory SQLite database.
|
||||
*/
|
||||
|
||||
import { computeS256Challenge, Role } from "@emdashcms/auth";
|
||||
import { computeS256Challenge, Role } from "@emdash-cms/auth";
|
||||
import { generateCodeVerifier } from "arctic";
|
||||
import type { Kysely } from "kysely";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* Tests the full device flow lifecycle against a real in-memory SQLite database.
|
||||
*/
|
||||
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import type { RoleLevel } from "@emdashcms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import type { RoleLevel } from "@emdash-cms/auth";
|
||||
import type { Kysely } from "kysely";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* redirect URIs not in the client's registered set.
|
||||
*/
|
||||
|
||||
import { computeS256Challenge, Role } from "@emdashcms/auth";
|
||||
import { computeS256Challenge, Role } from "@emdash-cms/auth";
|
||||
import { generateCodeVerifier } from "arctic";
|
||||
import type { Kysely } from "kysely";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
import node from "@astrojs/node";
|
||||
import react from "@astrojs/react";
|
||||
import { colorPlugin } from "@emdashcms/plugin-color";
|
||||
import { colorPlugin } from "@emdash-cms/plugin-color";
|
||||
import { defineConfig } from "astro/config";
|
||||
import emdash from "emdash/astro";
|
||||
import { sqlite } from "emdash/db";
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
"dependencies": {
|
||||
"@astrojs/node": "catalog:",
|
||||
"@astrojs/react": "catalog:",
|
||||
"@emdashcms/auth": "workspace:*",
|
||||
"@emdashcms/plugin-color": "workspace:*",
|
||||
"@emdash-cms/auth": "workspace:*",
|
||||
"@emdash-cms/plugin-color": "workspace:*",
|
||||
"astro": "catalog:",
|
||||
"better-sqlite3": "^11.10.0",
|
||||
"emdash": "workspace:*",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Tests the complete chain that would have caught bug #3:
|
||||
* signPreviewUrl → middleware builds header → snapshot endpoint parses and verifies
|
||||
*
|
||||
* The signing side (signPreviewUrl) lives in @emdashcms/cloudflare, but we
|
||||
* The signing side (signPreviewUrl) lives in @emdash-cms/cloudflare, but we
|
||||
* inline the same HMAC logic here to test the format contract without
|
||||
* cross-package imports.
|
||||
*/
|
||||
@@ -25,7 +25,7 @@ const SECRET = "test-preview-secret";
|
||||
|
||||
/**
|
||||
* Sign a preview URL using the same HMAC-SHA256 logic as
|
||||
* @emdashcms/cloudflare signPreviewUrl(). Inlined here so we test
|
||||
* @emdash-cms/cloudflare signPreviewUrl(). Inlined here so we test
|
||||
* the format contract without cross-package deps.
|
||||
*/
|
||||
async function signPreview(
|
||||
@@ -75,7 +75,7 @@ describe("preview snapshot auth flow", () => {
|
||||
VALUES ('p1', 'test-post', 'published', 'Test', 'Body', datetime('now'), datetime('now'), 1)
|
||||
`.execute(db);
|
||||
|
||||
// 2. Sign a preview URL (same logic as @emdashcms/cloudflare signPreviewUrl)
|
||||
// 2. Sign a preview URL (same logic as @emdash-cms/cloudflare signPreviewUrl)
|
||||
const signed = await signPreview("https://mysite.com");
|
||||
|
||||
// 3. Build the header the way the preview middleware does
|
||||
|
||||
@@ -12,7 +12,7 @@ import { createReadStream, existsSync } from "node:fs";
|
||||
import { mkdir, writeFile } from "node:fs/promises";
|
||||
import { dirname, join } from "node:path";
|
||||
|
||||
import { gutenbergToPortableText } from "@emdashcms/gutenberg-to-portable-text";
|
||||
import { gutenbergToPortableText } from "@emdash-cms/gutenberg-to-portable-text";
|
||||
import { describe, it, expect, beforeAll } from "vitest";
|
||||
|
||||
import { parseWxr } from "../../../src/cli/wxr/parser.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AuthAdapter } from "@emdashcms/auth";
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import type { AuthAdapter } from "@emdash-cms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import type { Kysely } from "kysely";
|
||||
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Unit tests for API token generation, hashing, and scope utilities.
|
||||
*/
|
||||
|
||||
import { Role, scopesForRole, clampScopes } from "@emdashcms/auth";
|
||||
import { Role, scopesForRole, clampScopes } from "@emdash-cms/auth";
|
||||
import { describe, it, expect } from "vitest";
|
||||
|
||||
import {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { AuthAdapter, EmailSendFn } from "@emdashcms/auth";
|
||||
import type { EmailMessage } from "@emdashcms/auth";
|
||||
import type { AuthAdapter, EmailSendFn } from "@emdash-cms/auth";
|
||||
import type { EmailMessage } from "@emdash-cms/auth";
|
||||
import {
|
||||
Role,
|
||||
createInvite,
|
||||
@@ -9,8 +9,8 @@ import {
|
||||
InviteError,
|
||||
escapeHtml,
|
||||
generateToken,
|
||||
} from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
} from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import type { Kysely } from "kysely";
|
||||
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AuthAdapter, Credential, User } from "@emdashcms/auth";
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
import type { AuthAdapter, Credential, User } from "@emdash-cms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import type { Kysely } from "kysely";
|
||||
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { AuthAdapter, EmailSendFn } from "@emdashcms/auth";
|
||||
import type { EmailMessage } from "@emdashcms/auth";
|
||||
import type { AuthAdapter, EmailSendFn } from "@emdash-cms/auth";
|
||||
import type { EmailMessage } from "@emdash-cms/auth";
|
||||
import {
|
||||
Role,
|
||||
canSignup,
|
||||
@@ -7,8 +7,8 @@ import {
|
||||
validateSignupToken,
|
||||
completeSignup,
|
||||
SignupError,
|
||||
} from "@emdashcms/auth";
|
||||
import { createKyselyAdapter } from "@emdashcms/auth/adapters/kysely";
|
||||
} from "@emdash-cms/auth";
|
||||
import { createKyselyAdapter } from "@emdash-cms/auth/adapters/kysely";
|
||||
import type { Kysely } from "kysely";
|
||||
import { describe, it, expect, beforeEach, afterEach, vi } from "vitest";
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Tests for the cleanup subsystems.
|
||||
*
|
||||
* Note: runSystemCleanup() is not tested directly here because it imports
|
||||
* from @emdashcms/auth/adapters/kysely, which requires the auth package to
|
||||
* from @emdash-cms/auth/adapters/kysely, which requires the auth package to
|
||||
* be built. Instead, we test each subsystem independently:
|
||||
* - cleanupExpiredChallenges: tested in auth/challenge-store.test.ts
|
||||
* - deleteExpiredTokens: tested below using direct DB operations
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
|
||||
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
||||
import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
|
||||
import { Role } from "@emdashcms/auth";
|
||||
import type { RoleLevel } from "@emdashcms/auth";
|
||||
import { Role } from "@emdash-cms/auth";
|
||||
import type { RoleLevel } from "@emdash-cms/auth";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import type { EmDashHandlers } from "../../../src/astro/types.js";
|
||||
|
||||
@@ -40,11 +40,11 @@ describe("definePlugin", () => {
|
||||
|
||||
it("accepts valid scoped ID", () => {
|
||||
const plugin = definePlugin({
|
||||
id: "@emdashcms/seo-plugin",
|
||||
id: "@emdash-cms/seo-plugin",
|
||||
version: "1.0.0",
|
||||
});
|
||||
|
||||
expect(plugin.id).toBe("@emdashcms/seo-plugin");
|
||||
expect(plugin.id).toBe("@emdash-cms/seo-plugin");
|
||||
});
|
||||
|
||||
it("accepts scoped ID with numbers", () => {
|
||||
|
||||
Reference in New Issue
Block a user