package attributeDisplay_test

import "seekia/internal/profiles/attributeDisplay"

import "seekia/internal/genetics/geneticReferences/polygenicDiseases"
import "seekia/internal/genetics/geneticReferences/traits"
import "seekia/internal/globalSettings"
import "seekia/internal/profiles/calculatedAttributes"
import "seekia/internal/profiles/profileFormat"

import "testing"


func TestGetAttributeDisplayInfo(t *testing.T){

	err := globalSettings.InitializeGlobalSettingsDatastore()
	if (err != nil) {
		t.Fatal("InitializeGlobalSettingsDatastore failed: " + err.Error())
	}

	err = polygenicDiseases.InitializePolygenicDiseaseVariables()
	if (err != nil) {
		t.Fatal("InitializePolygenicDiseaseVariables failed: " + err.Error())
	}

	err = traits.InitializeTraitVariables()
	if (err != nil) {
		t.Fatal("InitializeTraitVariables failed: " + err.Error())
	}

	err = profileFormat.InitializeProfileFormatVariables()
	if (err != nil) {
		t.Fatal("InitializeProfileFormatVariables failed: " + err.Error())
	}

	attributeObjectsList, err := profileFormat.GetProfileAttributeObjectsList()
	if (err != nil){
		t.Fatal("GetProfileAttributeObjectsList failed: " + err.Error())
	}

	for _, attributeObject := range attributeObjectsList{

		attributeName := attributeObject.AttributeName

		_, _, _, _, _, err := attributeDisplay.GetProfileAttributeDisplayInfo(attributeName)
		if (err != nil){
			t.Fatal("GetProfileAttributeDisplayInfo failed for attribute: " + attributeName + ". Reason: " + err.Error())
		}
	}

	calculatedAttributesList := calculatedAttributes.GetCalculatedAttributesList()

	for _, attributeName := range calculatedAttributesList{

		_, _, _, _, _, err := attributeDisplay.GetProfileAttributeDisplayInfo(attributeName)
		if (err != nil){
			t.Fatal("GetProfileAttributeDisplayInfo failed for attribute: " + attributeName + ". Reason: " + err.Error())
		}
	}
}



