package main

import (
	"strings"
	"testing"
)

func TestNamedGraphAnyTripleAskQueryUsesGraphVariable(t *testing.T) {
	query := namedGraphAnyTripleAskQuery()

	if !strings.Contains(query, "ASK WHERE") {
		t.Fatalf("readiness query should be an ASK query:\n%s", query)
	}
	if !strings.Contains(query, "GRAPH ?g") {
		t.Fatalf("readiness query should probe named graphs:\n%s", query)
	}
	if strings.Contains(query, "ASK WHERE { ?s ?p ?o }") {
		t.Fatalf("readiness query should no longer probe only the default graph:\n%s", query)
	}
}
