このコミットが含まれているのは:
+15
-11
@@ -332,28 +332,32 @@ after (async () => {
|
||||
if (errors.length) throw new AggregateError (errors, 'SSR teardown failed')
|
||||
})
|
||||
|
||||
test ('counts SSR uses query/definitions, noindex and the common site title', async () => {
|
||||
test ('counts SSR renders the shell without result requests or embedded results', async () => {
|
||||
for (const locale of ['ja', 'ain-Kana']) {
|
||||
for (const resource of ['posts', 'tags']) {
|
||||
for (const [resource, mode] of ['posts', 'tags'].flatMap (resource =>
|
||||
['summary', 'details'].map (mode => [resource, mode]))) {
|
||||
const column = resource === 'posts' ? 'title' : (locale === 'ja' ? 'name_ja' : 'name_ain')
|
||||
const query =
|
||||
`definition=history&mode=details&columns=resource_id+${ column }&user_id=4&timezone=UTC`
|
||||
`definition=history&mode=${mode}&columns=resource_id+${ column }&user_id=4&timezone=UTC`
|
||||
const start = requests.length
|
||||
const result = await renderPage (`/${locale}/counts/${resource}?${query}`, origin, apiURL)
|
||||
const calls = requests.slice (start).map (request => new URL (request.url, origin))
|
||||
assert.equal (result.status, 200)
|
||||
assert.match (result.html, /SSR count/)
|
||||
assert.match (result.html, new RegExp (`/${locale}/${resource}/1`))
|
||||
assert.doesNotMatch (result.html, /SSR count|counts-grid|counts-nested/)
|
||||
assert.match (result.html, /counts-targets/)
|
||||
assert.match (result.html, /<form[\s>]/)
|
||||
assert.doesNotMatch (result.html, /counts:|columns\.changedAt|fields\.actor/)
|
||||
assert.match (result.head, /<meta[^>]*name="robots"[^>]*content="noindex"/)
|
||||
assert.match (result.head, /<title[^>]*>[^<]*集計[^<]*\|[^<]*<\/title>/)
|
||||
assert.match (result.head, /rel="canonical"/)
|
||||
assert.doesNotMatch (result.html, /private-discard|hidden-title|__counts_private__/)
|
||||
|
||||
assert.ok (requests.some (request => {
|
||||
const url = new URL (request.url, origin)
|
||||
return url.pathname === '/counts/query' && url.searchParams.get ('resource') === resource
|
||||
&& url.searchParams.get ('user_id') === '4'
|
||||
&& url.searchParams.get ('locale') === locale
|
||||
}))
|
||||
assert.ok (calls.some (url => url.pathname === `/counts/definitions/${resource}`))
|
||||
assert.equal (calls.filter (url => url.pathname === '/counts/query').length, 0)
|
||||
assert.doesNotMatch (result.bootstrap, /SSR count|conditionLabels|pivotTotals/)
|
||||
const bootstrap = JSON.parse (result.bootstrap)
|
||||
assert.equal (bootstrap.state.queries.filter (query =>
|
||||
query.queryKey[0] === 'counts' && query.queryKey[1] === resource).length, 0)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする