This commit is contained in:
Doruk 2025-06-19 20:20:06 +02:00
parent a15e897300
commit 751c92b945
3 changed files with 20 additions and 12 deletions

View file

@ -45,10 +45,10 @@
<div class="my-3"> <div class="my-3">
<label for="heartbeat-bar-days" class="form-label">{{ $t("Heartbeat Bar Days") }}</label> <label for="heartbeat-bar-days" class="form-label">{{ $t("Heartbeat Bar Days") }}</label>
<input id="heartbeat-bar-days" v-model.number="config.heartbeatBarDays" type="number" class="form-control" min="0" max="365" data-testid="heartbeat-bar-days-input"> <input id="heartbeat-bar-days" v-model.number="config.heartbeatBarDays" type="number" class="form-control" min="0" max="365" data-testid="heartbeat-bar-days-input">
<div class="form-text" v-if="config.heartbeatBarDays === 0"> <div v-if="config.heartbeatBarDays === 0" class="form-text">
{{ $t("Status page will show last beats", [100]) }} {{ $t("Status page will show last beats", [100]) }}
</div> </div>
<div class="form-text" v-else> <div v-else class="form-text">
{{ $t("Status page shows heartbeat history days", [config.heartbeatBarDays]) }} {{ $t("Status page shows heartbeat history days", [config.heartbeatBarDays]) }}
</div> </div>
</div> </div>

View file

@ -505,7 +505,7 @@ test("Test getAggregatedBuckets - Data aggregation", async (t) => {
const expectedSnapshot = JSON.stringify(buckets); const expectedSnapshot = JSON.stringify(buckets);
const secondCall = c.getAggregatedBuckets(1 / 24, 6); const secondCall = c.getAggregatedBuckets(1 / 24, 6);
const secondSnapshot = JSON.stringify(secondCall); const secondSnapshot = JSON.stringify(secondCall);
assert.strictEqual(expectedSnapshot, secondSnapshot, "Bucket structure should be consistent between calls") assert.strictEqual(expectedSnapshot, secondSnapshot, "Bucket structure should be consistent between calls");
}); });
test("Test getAggregatedBuckets - Edge cases", async (t) => { test("Test getAggregatedBuckets - Edge cases", async (t) => {
@ -765,10 +765,18 @@ test("Test getAggregatedBuckets - Hourly to daily data transition (30+ days)", a
// Test various day ranges around the 30-day boundary // Test various day ranges around the 30-day boundary
const testRanges = [ const testRanges = [
{ days: 30, buckets: 100, expectedDataType: "hourly" }, { days: 30,
{ days: 31, buckets: 100, expectedDataType: "daily" }, buckets: 100,
{ days: 35, buckets: 100, expectedDataType: "daily" }, expectedDataType: "hourly" },
{ days: 60, buckets: 100, expectedDataType: "daily" } { days: 31,
buckets: 100,
expectedDataType: "daily" },
{ days: 35,
buckets: 100,
expectedDataType: "daily" },
{ days: 60,
buckets: 100,
expectedDataType: "daily" }
]; ];
for (const { days, buckets: bucketCount, expectedDataType } of testRanges) { for (const { days, buckets: bucketCount, expectedDataType } of testRanges) {