From 3e5bd1614196c81ce40b3a43dfe1d8511dca9eec Mon Sep 17 00:00:00 2001 From: jnbdz Date: Wed, 16 Oct 2024 22:28:15 -0400 Subject: [PATCH] Started to add more tests for get entity --- entity/entity_test.go | 90 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 82 insertions(+), 8 deletions(-) diff --git a/entity/entity_test.go b/entity/entity_test.go index ee952c1..64a5bf2 100644 --- a/entity/entity_test.go +++ b/entity/entity_test.go @@ -34,7 +34,7 @@ func TestSetEntity(t *testing.T) { Version: "latest", LatestVersion: true, IsPseudoVersion: true, - AbsPath: "/home/user/.hery/collection/amadla/entity/github.com/AmadlaOrg/Entity@v.0.0.0-", + AbsPath: "/home/user/.hery/collection/amadla/entity/github.com/AmadlaOrg/Entity@v.0.0.0-20240924093300-abcd1234efgh", Have: true, Hash: "", Exist: true, @@ -58,7 +58,7 @@ func TestSetEntity(t *testing.T) { Version: "latest", LatestVersion: false, IsPseudoVersion: true, - AbsPath: "/home/user/.hery/amadla/entity/github.com/AmadlaOrg/Entity@v.0.0.0-", + AbsPath: "/home/user/.hery/amadla/entity/github.com/AmadlaOrg/Entity@v.0.0.0-20240924093300-abcd1234efgh", Have: true, Hash: "", Exist: true, @@ -107,12 +107,86 @@ func TestGetEntity(t *testing.T) { hasError bool }{ { - name: "Valid: entity", - serviceEntities: []Entity{}, - inputEntityUri: "github.com/AmadlaOrg/Entity@latest", - expectedEntity: Entity{}, - expectedErr: nil, - hasError: false, + name: "Valid: entity", + serviceEntities: []Entity{ + { + Id: "97d4b783-f448-483c-8111-380d6082ae1c", + Entity: "github.com/AmadlaOrg/Entity@v0.0.0-20240924093300-abcd1234efgh", + Name: "Entity", + RepoUrl: "https://github.com/AmadlaOrg/Entity", + Origin: "github.com/AmadlaOrg/Entity", + Version: "latest", + LatestVersion: true, + IsPseudoVersion: true, + AbsPath: "/home/user/.hery/collection/amadla/entity/github.com/AmadlaOrg/Entity@v.0.0.0-20240924093300-abcd1234efgh", + Have: true, + Hash: "", + Exist: true, + Schema: &jsonschema.Schema{}, + Config: map[string]any{ + "name": "Entity", + "description": "The meta Entity definition.", + "category": "General", + "tags": []string{ + "main", + "master", + }, + }, + }, + { + Id: "12c4b793-d458-756f-8151-740d6082ae1f", + Entity: "github.com/AmadlaOrg/Entity@v0.0.0-20230924093300-abcd1234efgh", + Name: "Entity", + RepoUrl: "https://github.com/AmadlaOrg/Entity", + Origin: "github.com/AmadlaOrg/Entity", + Version: "latest", + LatestVersion: false, + IsPseudoVersion: true, + AbsPath: "/home/user/.hery/collection/amadla/entity/github.com/AmadlaOrg/Entity@v.0.0.0-20230924093300-abcd1234efgh", + Have: true, + Hash: "", + Exist: true, + Schema: &jsonschema.Schema{}, + Config: map[string]any{ + "name": "Entity", + "description": "The meta Entity definition.", + "category": "General", + "tags": []string{ + "main", + "master", + }, + }, + }, + { + Id: "98d4b682-c758-943c-8911-560d9022ae3c", + Entity: "github.com/AmadlaOrg/QAFixturesEntityMultipleTagVersion@v2.1.0", + Name: "QAFixturesEntityMultipleTagVersion", + RepoUrl: "https://github.com/AmadlaOrg/QAFixturesEntityMultipleTagVersion", + Origin: "github.com/AmadlaOrg/QAFixturesEntityMultipleTagVersion", + Version: "v2.1.0", + LatestVersion: true, + IsPseudoVersion: false, + AbsPath: "/home/user/.hery/amadla/entity/github.com/AmadlaOrg/QAFixturesEntityMultipleTagVersion@v2.1.0", + Have: true, + Hash: "", + Exist: true, + Schema: &jsonschema.Schema{}, + Config: map[string]any{ + "name": "QAFixturesEntityMultipleTagVersion", + "description": "Entity Multiple Tag Version definitions.", + "category": "QA", + "tags": []string{ + "QA", + "fixture", + "test", + }, + }, + }, + }, + inputEntityUri: "github.com/AmadlaOrg/Entity@latest", + expectedEntity: Entity{}, + expectedErr: nil, + hasError: false, }, }