added basic tests
This commit is contained in:
		
							
								
								
									
										34
									
								
								internal/data/song_test.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								internal/data/song_test.go
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,34 @@ | ||||
| package data | ||||
|  | ||||
| import ( | ||||
| 	"testing" | ||||
| ) | ||||
|  | ||||
| func TestSong(t *testing.T) { | ||||
| 	song := Song{ | ||||
| 		Name: "song_a", | ||||
| 		Album: Album{ | ||||
| 			Name: "album_a", | ||||
| 			Artists: []Artist{ | ||||
| 				{Name: "artist_a"}, | ||||
| 				{Name: "artist_a"}, | ||||
| 				{Name: "artist_b"}, | ||||
| 			}, | ||||
| 		}, | ||||
| 		Artists: []Artist{ | ||||
| 			{Name: "artist_a"}, | ||||
| 			{Name: "artist_a"}, | ||||
| 			{Name: "artist_b"}, | ||||
| 		}, | ||||
| 	} | ||||
|  | ||||
| 	compiled := song.Compile().(Song) | ||||
|  | ||||
| 	if len(compiled.Artists) != 2 { | ||||
| 		t.Errorf(`the two artists with the same name have to be merged, %d`, len(compiled.Artists)) | ||||
| 	} | ||||
|  | ||||
| 	if len(compiled.Album.Artists) != 2 { | ||||
| 		t.Errorf(`the two artists with the same names in the album have to be merged, %d`, len(compiled.Album.Artists)) | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user