MCPcopy Index your code
hub / github.com/jetify-com/devbox / TestDescribeFlakeUpdateFormats

Function TestDescribeFlakeUpdateFormats

internal/devbox/update_test.go:361–386  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

359}
360
361func TestDescribeFlakeUpdateFormats(t *testing.T) {
362 oldRev := "abc1234def56789012345678901234567890abcd"
363 newRev := "f4567890123456789abcdef012345678901234ab"
364 oldPkg := &lock.Package{
365 Resolved: "github:numtide/flake-utils/" + oldRev + "#pkg",
366 LastModified: "2024-11-01T00:00:00Z",
367 }
368 newPkg := &lock.Package{
369 Resolved: "github:numtide/flake-utils/" + newRev + "#pkg",
370 LastModified: "2025-04-22T00:00:00Z",
371 }
372 require.Equal(t,
373 "abc1234 -> f456789 (2024-11-01 → 2025-04-22)",
374 describeFlakeUpdate(oldPkg, newPkg),
375 )
376
377 // Fallback to date-only when refs have no rev (e.g. path:).
378 oldPath := &lock.Package{Resolved: "path:./x", LastModified: "2024-11-01T00:00:00Z"}
379 newPath := &lock.Package{Resolved: "path:./x", LastModified: "2025-04-22T00:00:00Z"}
380 require.Equal(t, "(2024-11-01 → 2025-04-22)", describeFlakeUpdate(oldPath, newPath))
381
382 // Fallback to rev-only when dates missing.
383 oldNoDate := &lock.Package{Resolved: "github:numtide/flake-utils/" + oldRev + "#pkg"}
384 newNoDate := &lock.Package{Resolved: "github:numtide/flake-utils/" + newRev + "#pkg"}
385 require.Equal(t, "abc1234 -> f456789", describeFlakeUpdate(oldNoDate, newNoDate))
386}

Callers

nothing calls this directly

Calls 1

describeFlakeUpdateFunction · 0.85

Tested by

no test coverage detected