From 9e78789f3b8370b53d9e463a2c5f4d12f277bfc7 Mon Sep 17 00:00:00 2001 From: satyazzz123 Date: Fri, 12 Jan 2024 13:24:10 +0530 Subject: [PATCH 1/2] added test for types.go Signed-off-by: satyazzz123 --- internal/types/types_test.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 internal/types/types_test.go diff --git a/internal/types/types_test.go b/internal/types/types_test.go new file mode 100644 index 0000000..d5a6033 --- /dev/null +++ b/internal/types/types_test.go @@ -0,0 +1,34 @@ +package types + +import ( + "testing" +) + +func TestParseProjectInputType(t *testing.T) { + tests := []struct { + input string + expected ProjectInputType + wantErr bool + }{ + {"sources", ProjectInputSources, false}, + {"customizations", ProjectInputCustomizations, false}, + {"configs", ProjectInputConfigs, false}, + {"reference", ProjectInputReference, false}, + {"invalidType", "", true}, + } + + for _, tt := range tests { + t.Run(tt.input, func(t *testing.T) { + result, err := ParseProjectInputType(tt.input) + + if (err != nil) != tt.wantErr { + t.Errorf("ParseProjectInputType() error = %v, wantErr %v", err, tt.wantErr) + return + } + + if !tt.wantErr && result != tt.expected { + t.Errorf("ParseProjectInputType() got = %v, want %v", result, tt.expected) + } + }) + } +} From c9cbad49132bd135533bbc8e3f7cdd1af5a30dab Mon Sep 17 00:00:00 2001 From: satyazzz123 Date: Fri, 12 Jan 2024 15:23:30 +0530 Subject: [PATCH 2/2] adding license Signed-off-by: satyazzz123 --- internal/types/types_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/internal/types/types_test.go b/internal/types/types_test.go index d5a6033..b689fcc 100644 --- a/internal/types/types_test.go +++ b/internal/types/types_test.go @@ -1,3 +1,18 @@ +/* +Copyright IBM Corporation 2023 + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ package types import (