Solution 0x107bc3cf77e98b93fee725ee9f6ebf92cf7d1b1f3c4ac7c47ace317610ccde95
Some checks failed
elffuss/validation The automatic validation rejected the solution

T2T-Item: 0x107bc3cf77e98b93fee725ee9f6ebf92cf7d1b1f3c4ac7c47ace317610ccde95
T2T-Issue: 0x74d315a963e864fb89a00de904bbf1b82abb5325c6102bedaea0ce1545593480
This commit is contained in:
2026-10-02 06:42:01 +00:00
committed by elffuss-bot
parent f6006681f1
commit 739dfd8df4
3 changed files with 52 additions and 4 deletions

View File

@@ -0,0 +1,24 @@
{
"schema": "elffuss-t2t/criteria@2",
"issue": 1,
"criteria": [
{
"index": 1,
"tests": [
"tests/acceptance/1/criteria.test.js::criterion 1"
]
},
{
"index": 2,
"tests": [
"tests/acceptance/1/criteria.test.js::criterion 2"
]
},
{
"index": 3,
"tests": [
"tests/acceptance/1/criteria.test.js::criterion 3"
]
}
]
}

View File

@@ -0,0 +1,26 @@
import { test } from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import * as mod from '../../../web/js/runtime/caps.js' // the code under test: call it as mod.<name>(...)
const source = readFileSync(new URL('../../../web/js/runtime/caps.js', import.meta.url), 'utf8') // the text of web/js/runtime/caps.js, for a criterion about how the file is written
test('criterion 1', () => {
// `summarize` of a capability object whose `memGB` field is missing returns a string that does not contain `undefined`.
const cap = { name: 'test' }
const summary = mod.summarize(cap)
assert.assert.notInclude(summary, 'undefined')
})
test('criterion 2', () => {
// `summarize` of a capability object whose `memGB` field is missing returns a string that contains `~?GB RAM`.
const cap = { name: 'test' }
const summary = mod.summarize(cap)
assert.assert.include(summary, '~?GB RAM')
})
test('criterion 3', () => {
// `summarize` of a capability object whose `memGB` is a number returns a string that contains that number immediately followed by `GB RAM`.
const cap = { name: 'test', memGB: 4 }
const summary = mod.summarize(cap)
assert.assert.include(summary, '4GB RAM')
})

View File

@@ -105,8 +105,6 @@ export async function probe() {
export function summarize(c) {
const p = c.platform.iOS ? 'iOS' : c.platform.android ? 'Android'
: c.platform.mac ? 'Mac' : c.platform.mobile ? 'móvil' : 'escritorio';
const g = c.gpu
? `WebGPU · buffer≤${(c.limits.maxBufferSize / GiB).toFixed(1)}GiB · binding≤${(c.limits.maxStorageBufferBindingSize / MiB) | 0}MiB`
: `sin GPU (${c.error || '—'})`;
return `${p} · ~${c.memGB}GB RAM · presupuesto ${c.budgetGiB}GiB · ${g}`;
const g = c.gpu ? `WebGPU · buffer≤${(c.limits.maxBufferSize / GiB).toFixed(1)}GiB · binding≤${(c.limits.maxStorageBufferBindingSize / MiB) | 0}MiB` : `sin GPU (${c.error || '—'})`;
return `${p} · ~${c.memGB !== undefined ? c.memGB : '?'}GB RAM · presupuesto ${c.budgetGiB}GiB · ${g}`;
}