Fix Lockfile Schematics
This commit is contained in:
@@ -108,6 +108,29 @@ func TestResolvedTableRegistryRegistersConsistentTables(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestSaveLockfilePreservesExistingOrderAndAppendsNewKeys(t *testing.T) {
|
||||
root := t.TempDir()
|
||||
lockPath := filepath.Join(root, "lock.json")
|
||||
writeFile(t, lockPath, "{\n \"b\": 2,\n \"a\": 1\n}\n")
|
||||
|
||||
if err := saveLockfile(lockPath, map[string]int{
|
||||
"b": 2,
|
||||
"a": 1,
|
||||
"c": 3,
|
||||
}); err != nil {
|
||||
t.Fatalf("saveLockfile failed: %v", err)
|
||||
}
|
||||
|
||||
got, err := os.ReadFile(lockPath)
|
||||
if err != nil {
|
||||
t.Fatalf("read lockfile: %v", err)
|
||||
}
|
||||
want := "{\n \"b\": 2,\n \"a\": 1,\n \"c\": 3\n}\n"
|
||||
if string(got) != want {
|
||||
t.Fatalf("unexpected lockfile contents:\n%s", string(got))
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolvedTableRegistryRejectsDuplicateKeys(t *testing.T) {
|
||||
_, err := newResolvedTableRegistry([]nativeCollectedDataset{
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user