package querycodec

import "testing"

func TestHistoryNamesShareCanonicalLayoutAndQueryVocabulary(t *testing.T) {
	for _, test := range []struct{ parent, object, lookup string }{{"Account", "AccountHistory", "AccountId"}, {"Opportunity", "OpportunityFieldHistory", "OpportunityId"}, {"Delivery__c", "Delivery__History", "ParentId"}} {
		if HistoryObjectName(test.parent) != test.object || !IsHistoryObject(test.object) || ParentObjectFromHistoryName(test.object) != test.parent || HistoryParentFieldName(test.object) != test.lookup {
			t.Fatalf("canonical history identity changed: %#v", test)
		}
	}
	if IsHistoryObject("OpportunityHistory") {
		t.Fatal("stage history mistaken for field history")
	}
}
