1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2024-12-22 00:36:41 +02:00
crud_generator/pkg/graphml/graphml_read_test.go
Nikitin Aleksandr b7446dc946 новый
2023-09-28 17:45:44 +03:00

68 lines
1.5 KiB
Go

package graphml
import (
"github.com/ManyakRus/crud_generator/internal/config"
ConfigMain "github.com/ManyakRus/starter/config"
"github.com/ManyakRus/starter/micro"
"testing"
)
func TestReadFile(t *testing.T) {
dir := micro.ProgramDir()
Filename := dir + "test" + micro.SeparatorFile() + "test.graphml"
doc, err := ReadFile(Filename)
if err != nil {
t.Error("TestReadFile() error: ", err)
}
if doc == nil {
t.Error("TestReadFile() error: doc =nil")
}
}
func TestFindMassEntity(t *testing.T) {
dir := micro.ProgramDir()
Filename := dir + "test" + micro.SeparatorFile() + "test.graphml"
doc, err := ReadFile(Filename)
if err != nil {
t.Error("TestFindMassEntity() error: ", err)
}
if doc == nil {
t.Error("TestFindMassEntity() error: doc =nil")
}
Otvet := FindMassElement(doc)
if len(Otvet) == 0 {
t.Error("TestFindMassEntity() error: len =0")
}
}
func TestFindMapNodeStruct(t *testing.T) {
dir := micro.ProgramDir()
Filename := dir + "test" + micro.SeparatorFile() + "test.graphml"
doc, err := ReadFile(Filename)
if err != nil {
t.Error("TestFindMapNodeStruct() error: ", err)
}
if doc == nil {
t.Error("TestFindMapNodeStruct() error: doc =nil")
}
MassElement := FindMassElement(doc)
if len(MassElement) == 0 {
t.Error("TestFindMapNodeStruct() error: len =0")
}
Otvet := FindMapNodeStruct(MassElement)
if len(Otvet) == 0 {
t.Error("TestFindMapNodeStruct() error: ", err)
}
}
func TestStartReadFile(t *testing.T) {
ConfigMain.LoadEnv()
config.FillSettings()
StartReadFile()
}