package web

import "testing"

func TestProcessingSetAddHasRemove(t *testing.T) {
	var s ProcessingSet // zero value is usable

	key := processingKey("user-1", "video-1")
	if s.Has(key) {
		t.Fatal("fresh set must not report a key as in-flight")
	}

	s.Add(key)
	if !s.Has(key) {
		t.Fatal("Add must mark the key in-flight")
	}

	// A different user with the same video id is a distinct key.
	if s.Has(processingKey("user-2", "video-1")) {
		t.Fatal("keys must be scoped by user")
	}

	s.Remove(key)
	if s.Has(key) {
		t.Fatal("Remove must clear the key")
	}
}
