[audio] Add yet additional test coverage for audio adaptor
Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
parent
7314d73fd6
commit
c111636c32
|
@ -33,7 +33,7 @@ func (a *AudioAdaptor) Sound(fileName string) []error {
|
|||
var errorsList []error
|
||||
|
||||
if fileName == "" {
|
||||
log.Println("Require filename for audio file.")
|
||||
log.Println("Requires filename for audio file.")
|
||||
errorsList = append(errorsList, errors.New("Requires filename for audio file."))
|
||||
return errorsList
|
||||
}
|
||||
|
|
|
@ -32,3 +32,17 @@ func TestAudioAdaptorCommandsUnknown(t *testing.T) {
|
|||
gobottest.Refute(t, cmd, "mpg123")
|
||||
gobottest.Assert(t, err.Error(), "Unknown filetype for audio file.")
|
||||
}
|
||||
|
||||
func TestAudioAdaptorSoundWithNoFilename(t *testing.T) {
|
||||
a := NewAudioAdaptor("tester")
|
||||
|
||||
errors := a.Sound("")
|
||||
gobottest.Assert(t, errors[0].Error(), "Requires filename for audio file.")
|
||||
}
|
||||
|
||||
func TestAudioAdaptorSoundWithNonexistingFilename(t *testing.T) {
|
||||
a := NewAudioAdaptor("tester")
|
||||
|
||||
errors := a.Sound("doesnotexist.mp3")
|
||||
gobottest.Assert(t, errors[0].Error(), "stat doesnotexist.mp3: no such file or directory")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue