diff --git a/tests/acceptance/7/CRITERIA.json b/tests/acceptance/7/CRITERIA.json new file mode 100644 index 0000000..4e2dbaa --- /dev/null +++ b/tests/acceptance/7/CRITERIA.json @@ -0,0 +1,12 @@ +{ + "schema": "elffuss-t2t/criteria@2", + "issue": 7, + "criteria": [ + { + "index": 1, + "tests": [ + "tests/acceptance/7/criteria.test.js::criterion 1" + ] + } + ] +} diff --git a/tests/acceptance/7/criteria.test.js b/tests/acceptance/7/criteria.test.js new file mode 100644 index 0000000..397508f --- /dev/null +++ b/tests/acceptance/7/criteria.test.js @@ -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/lab.js' // the code under test: call it as mod.(...) +const source = readFileSync(new URL('../../../web/js/lab.js', import.meta.url), 'utf8') // the text of web/js/lab.js, for a criterion about how the file is written + +test('criterion 1', () => { + // The label of each `litert:` entry of `BRAINS` equals the `label` of `MODELS[]` from providers/litert.js, and the entries `rules` and `onnx` still come first with their current labels. + const brains = mod.getBrains(); + const models = mod.getModels(); + const brainsLabels = Object.entries(brains).map(([key, brain]) => brain.label); + const modelsLabels = Object.entries(models).map(([key, model]) => model.label); + + for (const [key, brain] of Object.entries(brains)) { + assert.equal(brain.label, models[key].label, `Label mismatch for key: ${key}`); + } + + const brainKeys = Object.keys(brains); + const modelKeys = Object.keys(models); + + const rulesIndex = brainKeys.indexOf('rules'); + const onnxIndex = brainKeys.indexOf('onnx'); + + assert.equal(rulesIndex, 0, 'rules should be the first entry in BRAINS'); + assert.equal(onnxIndex, 1, 'onnx should be the second entry in BRAINS'); +}) diff --git a/web/js/lab.js b/web/js/lab.js index b42c641..bc784c5 100644 --- a/web/js/lab.js +++ b/web/js/lab.js @@ -68,8 +68,8 @@ const BENCHES = [ const BRAINS = [ ['rules', 'Reglas (sin GPU)', 'Determinista. Valida el arnés sin bajar pesos.'], ['onnx', 'Elffuss LM (CPU/wasm)', 'LFM2.5-1.2B por transformers.js.'], - ['litert:gemma-e2b', 'Gemma-4 E2B (~2 GB)', 'WebGPU.'], - ['litert:gemma-e4b', 'Gemma-4 E4B (~3 GB)', 'WebGPU. El mejor.'], + ['litert:gemma-e2b', 'Gemma-4 E2B', 'WebGPU.'], + ['litert:gemma-e4b', 'Gemma-4 E4B', 'WebGPU. El mejor.'], ]; // ─────────────────────────── consola ───────────────────────────