Add explicit per-plan gauge temperature offset
Test and deploy / test-and-deploy (push) Successful in 1m23s
Test and deploy / test-and-deploy (push) Successful in 1m23s
This commit is contained in:
1 parent
d96ed22de1
commit
eda3d8e77f
8 files changed
+90
-7
No files matched your search
@@ -34,3 +34,25 @@ test("streaming JSON decoder exposes only reply text and handles split escapes",
|
||||
assert.equal(partialReply('{"reply":"392\\u00'),"392");
|
||||
assert.equal(partialReply('{"reply":"392\\u00b0F"}'),"392°F");
|
||||
});
|
||||
test("a manual gauge offset shifts illustrative events exactly once and reaches Bean Bro",()=>{
|
||||
const p=blankPlan();p.fields["1.4"]="8:45";p.fields["4.4"]="1:20";
|
||||
const original=buildPlanCurve(p,computeLedger(p));
|
||||
p.temperatureOffsetF="-50";
|
||||
const shifted=buildPlanCurve(p,computeLedger(p));
|
||||
for(let i=0;i<original.length;i++){
|
||||
assert.ok(Math.abs((shifted[i].tempC-original[i].tempC)*1.8+50)<1e-8);
|
||||
assert.equal(shifted[i].timeS,original[i].timeS);
|
||||
}
|
||||
const ctx=buildPlanChatContext(p);
|
||||
assert.equal(ctx.temperatureOffsetF,-50);
|
||||
assert.equal(ctx.displayedMilestones.find(p=>p.event==="fc").tempF,342);
|
||||
p.temps.fc.tempC="190";p.preheat.tempC="175";p.planActual.fc.actualBt="171.111111";
|
||||
const entered=buildPlanChatContext(p);
|
||||
assert.equal(entered.displayedMilestones.find(p=>p.event==="fc").tempF,374);
|
||||
assert.equal(entered.preheatSetpointF,347);
|
||||
assert.equal(entered.recordedMilestones.find(p=>p.event==="fc").actualBtF,340);
|
||||
p.temperatureOffsetF="";delete p.temps.fc.tempC;
|
||||
assert.deepEqual(buildPlanCurve(p,computeLedger(p)),original);
|
||||
p.temperatureOffsetF="25";
|
||||
assert.equal(buildPlanChatContext(p).displayedMilestones.find(p=>p.event==="fc").tempF,417);
|
||||
});
|
||||
Reference in new issue
Block a user