@@ -452,15 +452,6 @@ const { data } = await apiv3Get<FetchedPageResult>(endpoint, params);
- `disableUserPages=true` でユーザーページ → 403
- 正常ページ → `res.apiv3({ page, meta })` が呼ばれる
-### Integration Tests
-
-`getPageByShareLinkHandlerFactory` の統合テスト(`get-page-by-share-link.integ.ts`):
-- 有効な `shareLinkId` + `pageId` → 200 と `{ page, meta }` を返す(`isMovable: false` を確認)
-- 期限切れリンク → 403 `share-link-expired`
-- 存在しない `shareLinkId` → 404 `share-link-not-found`
-- `disableLinkSharing=true` → 403 `link-sharing-disabled`
-- `pageId` / `shareLinkId` 未指定 → 400
### Security Considerations
- **認証不要エンドポイントのデータ保護**: `validateShareLink` が全ての DB チェックを完了した後にのみ `findPageAndMetaDataByViewer` を呼び出す。バリデーション失敗時はページデータに一切アクセスしない。
@@ -38,14 +38,6 @@
- ページルーターに `GET /shared` として登録し、`getPageInfoHandlerFactory` と同じパターンで組み込む
- _Requirements: 1.1, 1.2, 1.3, 1.4, 2.5, 3.1, 4.1, 4.2, 4.3, 5.1, 5.4_
-- [x] 3.2 エンドポイントの統合テストを実装する
- - 有効な shareLinkId と pageId を指定したリクエストが 200 で `{ page, meta }` を返し、`isMovable: false` であることを確認する
- - 期限切れリンクで 403 `share-link-expired` が返ることを確認する
- - 存在しない shareLinkId または pageId 不一致で 404 `share-link-not-found` が返ることを確認する
- - `disableLinkSharing=true` の状態で 403 `link-sharing-disabled` が返ることを確認する
- - `shareLinkId` または `pageId` を省略したリクエストで 400 が返ることを確認する
- - _Requirements: 1.1, 1.3, 2.1, 2.2, 2.3, 2.4, 2.5, 3.2, 3.3, 4.1_
- [ ] 4. クライアント更新と既存ルートのクリーンアップ
- [x] 4.1 share link アクセス時のページ取得 API 呼び出しを新エンドポイントに切り替える
- `shareLinkId` が存在するかどうかで呼び出し先を `/page/shared` と `/page` に条件分岐させる
@@ -1,33 +0,0 @@
-import type { HydratedDocument } from 'mongoose';
-import mongoose from 'mongoose';
-import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
-describe('/page/shared endpoint integration tests', () => {
- // These are placeholder tests for integration testing
- // Full integration tests require a test database and API server setup
- it('should have endpoint factory exported', () => {
- // Import to verify the factory exists and is importable
- const factory =
- require('./get-page-by-share-link').getPageByShareLinkHandlerFactory;
- expect(factory).toBeDefined();
- expect(typeof factory).toBe('function');
- });
- it('should return RequestHandler array from factory', () => {
- // Mock Crowi instance
- const mockCrowi = {
- pageService: {},
- pageGrantService: {},
- };
- const handlers = factory(mockCrowi);
- expect(Array.isArray(handlers)).toBe(true);
- expect(handlers.length).toBeGreaterThan(0);
- // Last handler should be the main handler function
- expect(typeof handlers[handlers.length - 1]).toBe('function');
-});