openvibers/openvibe.food Commits
The US average price sentence keeps the BLS item's inner capitals (eggs, grade A, large) (#81)
Changes
@@@ -587,7 +587,7 @@ ${table(['', 'A serving', f.per_100g ? 'Per 100 g' : 'Per 100 g'], [${table(['Store', 'A pack'], f.prices.map((p) => [p.store_name, money(p.price)]))}<p class="muted small">Typical 2025 US (Washington) prices carried over from the OpenVibe.Tools grocery dataset; not a live price.</p>${official ? html`<h2>US average price</h2>--<p><b>${money(official.pack_price)}</b> for this pack at the US city average for ${official.month}: ${money(official.value)} per ${official.unit} of ${official.item.toLowerCase()} (<a href="${official.url}" rel="noopener">BLS series ${official.series_id}</a>).</p>++<p><b>${money(official.pack_price)}</b> for this pack at the US city average for ${official.month}: ${money(official.value)} per ${official.unit} of ${official.item.charAt(0).toLowerCase() + official.item.slice(1)} (<a href="${official.url}" rel="noopener">BLS series ${official.series_id}</a>).</p><p class="muted small">${OFFICIAL_NOTE}</p>` : ''}${f.tags.length ? html`<p class="tags">${f.tags.map((t) => badge(t))}</p>` : ''}<p><a href="/plan?people=2&days=3">Plan meals with this</a> · <a href="/foods">Back to the list</a></p>`,@@@ -77,6 +77,8 @@ function feed(items) {const bread = await t.get('/foods/bread-white');assert.strictEqual(bread.status, 200);assert.ok(bread.text.includes('US average price'));++ assert.ok(bread.text.includes('per lb of bread, white, pan'), 'the item name reads in the sentence');++ assert.ok((await t.get('/foods/eggs-dozen')).text.includes('per dozen of eggs, grade A, large'), 'only the first letter is lowered (grade A, not grade a)');assert.ok(bread.text.includes('$2.29</b> for this pack at the US city average for September 2026: $1.83 per lb'), bread.text.slice(bread.text.indexOf('US average'), bread.text.indexOf('US average') + 300));assert.ok(bread.text.includes('https://data.bls.gov/timeseries/APU0000702111'));assert.ok(bread.text.includes('BLS.gov cannot vouch for the data'));
@@ -587,7 +587,7 @@ ${table(['', 'A serving', f.per_100g ? 'Per 100 g' : 'Per 100 g'], [
@@ -587,7 +587,7 @@ ${table(['', 'A serving', f.per_100g ? 'Per 100 g' : 'Per 100 g'], [
${table(['Store', 'A pack'], f.prices.map((p) => [p.store_name, money(p.price)]))}
${table(['Store', 'A pack'], f.prices.map((p) => [p.store_name, money(p.price)]))}
<p class="muted small">Typical 2025 US (Washington) prices carried over from the OpenVibe.Tools grocery dataset; not a live price.</p>
<p class="muted small">Typical 2025 US (Washington) prices carried over from the OpenVibe.Tools grocery dataset; not a live price.</p>
${official ? html`<h2>US average price</h2>
${official ? html`<h2>US average price</h2>
-<p><b>${money(official.pack_price)}</b> for this pack at the US city average for ${official.month}: ${money(official.value)} per ${official.unit} of ${official.item.toLowerCase()} (<a href="${official.url}" rel="noopener">BLS series ${official.series_id}</a>).</p>
+<p><b>${money(official.pack_price)}</b> for this pack at the US city average for ${official.month}: ${money(official.value)} per ${official.unit} of ${official.item.charAt(0).toLowerCase() + official.item.slice(1)} (<a href="${official.url}" rel="noopener">BLS series ${official.series_id}</a>).</p>
<p class="muted small">${OFFICIAL_NOTE}</p>` : ''}
<p class="muted small">${OFFICIAL_NOTE}</p>` : ''}
${f.tags.length ? html`<p class="tags">${f.tags.map((t) => badge(t))}</p>` : ''}
${f.tags.length ? html`<p class="tags">${f.tags.map((t) => badge(t))}</p>` : ''}
<p><a href="/plan?people=2&days=3">Plan meals with this</a> · <a href="/foods">Back to the list</a></p>`,
<p><a href="/plan?people=2&days=3">Plan meals with this</a> · <a href="/foods">Back to the list</a></p>`,
@@ -77,6 +77,8 @@ function feed(items) {
@@ -77,6 +77,8 @@ function feed(items) {
const bread = await t.get('/foods/bread-white');
const bread = await t.get('/foods/bread-white');
assert.strictEqual(bread.status, 200);
assert.strictEqual(bread.status, 200);
assert.ok(bread.text.includes('US average price'));
assert.ok(bread.text.includes('US average price'));
+ assert.ok(bread.text.includes('per lb of bread, white, pan'), 'the item name reads in the sentence');
+ assert.ok((await t.get('/foods/eggs-dozen')).text.includes('per dozen of eggs, grade A, large'), 'only the first letter is lowered (grade A, not grade a)');
assert.ok(bread.text.includes('$2.29</b> for this pack at the US city average for September 2026: $1.83 per lb'), bread.text.slice(bread.text.indexOf('US average'), bread.text.indexOf('US average') + 300));
assert.ok(bread.text.includes('$2.29</b> for this pack at the US city average for September 2026: $1.83 per lb'), bread.text.slice(bread.text.indexOf('US average'), bread.text.indexOf('US average') + 300));
assert.ok(bread.text.includes('https://data.bls.gov/timeseries/APU0000702111'));
assert.ok(bread.text.includes('https://data.bls.gov/timeseries/APU0000702111'));
assert.ok(bread.text.includes('BLS.gov cannot vouch for the data'));
assert.ok(bread.text.includes('BLS.gov cannot vouch for the data'));