Skip to content

Commit ad4cd07

Browse files
committed
chore: tests passing
1 parent adc0f37 commit ad4cd07

File tree

4 files changed

+29
-4
lines changed

4 files changed

+29
-4
lines changed

frontend/apps/web/app/ssr-document.integration.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ vi.mock('@shm/shared/models/search', async (importOriginal) => {
9999
vi.mock('@/auth', () => ({
100100
useLocalKeyPair: () => null,
101101
useCreateAccount: () => ({content: null, createAccount: () => {}}),
102+
AccountFooterActions: () => null,
102103
}))
103104

104105
// Mock navigation hooks used by WebResourcePage

frontend/packages/shared/src/__tests__/document-utils.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe('prepareHMDocument', () => {
1616
account: 'test-account',
1717
authors: ['author1'],
1818
genesis: 'genesis-id',
19+
visibility: 'PUBLIC',
1920
createTime: '2024-01-01T00:00:00Z',
2021
updateTime: '2024-01-01T00:00:00Z',
2122
}),
@@ -126,6 +127,7 @@ describe('prepareHMComment', () => {
126127
author: 'test-author',
127128
targetAccount: 'target-account',
128129
targetVersion: 'target-version',
130+
visibility: 'PUBLIC',
129131
createTime: '2024-01-01T00:00:00Z',
130132
updateTime: '2024-01-01T00:00:00Z',
131133
}),

frontend/packages/shared/src/utils/__tests__/entity-id-url.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {describe, expect, test} from 'vitest'
22
import {
33
createCommentUrl,
4+
createOSProtocolUrl,
45
createSiteUrl,
56
createWebHMUrl,
67
hmId,
@@ -155,6 +156,20 @@ describe('hmId', () => {
155156
})
156157
})
157158

159+
describe('createOSProtocolUrl', () => {
160+
test('creates hm:// URL for desktop protocol', () => {
161+
expect(
162+
createOSProtocolUrl(
163+
hmId('abc123', {
164+
path: ['foo'],
165+
version: 'v1',
166+
blockRef: 'blockA',
167+
}),
168+
),
169+
).toBe('hm://abc123/foo?v=v1#blockA')
170+
})
171+
})
172+
158173
describe('unpackHmId - blockRef and version precedence', () => {
159174
test('blockRef with ?l param - blockRef takes precedence, latest=false', () => {
160175
// When blockRef is present, ?l should be ignored because

frontend/packages/shared/src/utils/entity-id-url.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1-
import {BlockRange, HMComment, ParsedFragment, UnpackedHypermediaId} from '..'
2-
import {DEFAULT_GATEWAY_URL, HYPERMEDIA_SCHEME} from '../constants'
1+
import type {
2+
BlockRange,
3+
HMComment,
4+
ParsedFragment,
5+
UnpackedHypermediaId,
6+
} from '../hm-types'
7+
import {
8+
DEFAULT_GATEWAY_URL,
9+
HYPERMEDIA_SCHEME,
10+
OS_PROTOCOL_SCHEME,
11+
} from '../constants'
312
import {NavRoute} from '../routes'
413
import {entityQueryPathToHmIdPath} from './path-api'
514
import {StateStream} from './stream'
@@ -242,8 +251,6 @@ export function createOSProtocolUrl({
242251
blockRef,
243252
blockRange,
244253
}: UnpackedHypermediaId) {
245-
// Import at runtime to avoid circular dependency
246-
const {OS_PROTOCOL_SCHEME} = require('../constants')
247254
let res = `${OS_PROTOCOL_SCHEME}://${uid}`
248255

249256
if (path && path.length) {

0 commit comments

Comments
 (0)