mirror of
https://github.com/stablyai/orca.git
synced 2026-09-29 08:03:20 +00:00
* refactor(mobile): split tasks route into focused modules * fix(mobile): repair tasks refactor module boundaries * chore(mobile): document intentional render resets * fix(mobile): remove stale lint suppressions from tasks split * test(mobile): keep parity checks stable with doctor suppressions * test(mobile): follow tasks module split * test(mobile): follow project routing module split
53 lines
2.2 KiB
TypeScript
53 lines
2.2 KiB
TypeScript
import { readFileSync } from 'node:fs'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
const readSource = (path: string): string => readFileSync(new URL(path, import.meta.url), 'utf8')
|
|
const source = [
|
|
readSource('./use-mobile-tasks-project-loading-actions.tsx'),
|
|
readSource('./use-mobile-tasks-project-workspace-comment-actions.tsx'),
|
|
readSource('./use-mobile-tasks-project-thread-reply-actions.tsx'),
|
|
readSource('./use-mobile-tasks-project-detail-loading.tsx'),
|
|
readSource('./use-mobile-tasks-project-metadata-actions.tsx'),
|
|
readSource('./use-mobile-tasks-project-metadata-loading.tsx'),
|
|
readSource('./use-mobile-tasks-project-review-check-actions.tsx'),
|
|
readSource('./use-mobile-tasks-project-file-merge-actions.tsx')
|
|
].join('\n')
|
|
|
|
describe('mobile GitHub Project host routing boundary', () => {
|
|
it('host-qualifies every Project RPC request', () => {
|
|
const calls = [...source.matchAll(/['"](github\.project\.[^'"]+)['"]/g)]
|
|
expect(calls.length).toBeGreaterThan(10)
|
|
for (const call of calls) {
|
|
const request = source.slice(call.index, call.index + 700)
|
|
expect(request, `${call[1]} must carry a host`).toMatch(/\bhost\s*:/)
|
|
}
|
|
})
|
|
|
|
it('pins Project-row PR actions to the row repository identity', () => {
|
|
const actions = source.slice(source.indexOf('const toggleProjectGitHubReviewThread'))
|
|
for (const method of [
|
|
'github.resolveReviewThread',
|
|
'github.addPRReviewCommentReply',
|
|
'github.addIssueComment',
|
|
'github.requestPRReviewers',
|
|
'github.prChecks',
|
|
'github.rerunPRChecks',
|
|
'github.setPRFileViewed',
|
|
'github.prFileContents',
|
|
'github.addPRReviewComment',
|
|
'github.mergePR'
|
|
]) {
|
|
const offset = actions.indexOf(`'${method}'`)
|
|
expect(offset, `${method} must remain wired in the Project action path`).toBeGreaterThan(-1)
|
|
expect(actions.slice(offset, offset + 700), `${method} must carry prRepo`).toContain(
|
|
'prRepo: projectRowGitHubRepository(row, activeGitHubProjectHost)'
|
|
)
|
|
}
|
|
})
|
|
|
|
it('pins discovery to github.com while pasted URLs supply their parsed host', () => {
|
|
expect(source).toContain("'github.project.listAccessible', {\n host: 'github.com'")
|
|
expect(source).toContain('host: githubProjectHost(parsed.host)')
|
|
})
|
|
})
|