package packagelock

import (
	"testing"
)

var (
	lockTestCases = map[string]bool{
		"testdata/package_lock/warehouse-lock-pass.yaml": true,
		"testdata/package_lock/warehouse-lock-fail.yaml": false,
	}
)

func TestSerializePackageLock(t *testing.T) {
	plr, err := NewRules()
	if err != nil {
		t.Fatal(err)
	}

	for lockPath, pass := range lockTestCases {
		_, err := plr.ParsePackageLock(lockPath)
		if err != nil && pass {
			t.Errorf("tc should have passed for %s", lockPath)
		}
	}
	if err != nil {
		t.Fatal(err)
	}
}