2
0
Fork 0
mirror of https://github.com/alexanderepstein/Bash-Snippets synced 2018-11-08 02:59:35 +01:00
Bash-Snippets/tests/taste.bats

64 lines
1.8 KiB
Text
Raw Normal View History

#!/bin/env bats
@test "Testing taste tool" {
echo taste
export TASTE_API_KEY="275041-BashSnip-KQ51U8H8" >> ~/.bash_profile
}
@test "The -h option should print usage" {
if [[ "$(uname)" == "Darwin" ]]; then
run taste -h
[ "$status" -eq 0 ]
[ "${lines[0]}" = "Taste" ]
fi
}
2017-07-09 23:46:48 +02:00
@test "Testing short recommendations" {
if [[ "$(uname)" == "Darwin" ]]; then
2017-07-09 23:46:48 +02:00
run taste Kid Cudi
[ "$status" -eq 0 ]
[ "${lines[0]}" = "===================================" ]
[ "${lines[1]}" = "Lupe Fiasco: music" ]
[ "${lines[2]}" = "Shadows And Fog: movie" ]
[ "${lines[3]}" = "Lulu James: music" ]
[ "${lines[4]}" = "===================================" ]
fi
2017-07-09 23:46:48 +02:00
}
@test "Testing long recommendations" {
if [[ "$(uname)" == "Darwin" ]]; then
2017-07-09 23:46:48 +02:00
run taste -i Sublime
[ "$status" -eq 0 ]
response=$(echo $(taste -i Sublime) | grep -Eo "Soundsystem is the fifth studio album by 311, released on October 12, 1999. Soundsystem, which was certified Gold by the RIAA,")
[ "$response" = "Soundsystem is the fifth studio album by 311, released on October 12, 1999. Soundsystem, which was certified Gold by the RIAA," ]
fi
2017-07-09 23:46:48 +02:00
}
@test "Testing search on item" {
if [[ "$(uname)" == "Darwin" ]]; then
2017-07-09 23:46:48 +02:00
run taste -s Kendrick Lamar
[ "$status" -eq 0 ]
response=$(echo $(taste -s Kendrick Lamar) | grep -Eo "Kendrick Lamar Duckworth \(born June 17, 1987\) is an American rapper and songwriter.")
[ "$response" = "Kendrick Lamar Duckworth (born June 17, 1987) is an American rapper and songwriter." ]
fi
2017-07-09 23:46:48 +02:00
}
@test "No arguments prints usage instructions" {
if [[ "$(uname)" == "Darwin" ]]; then
run taste
[ "$status" -eq 0 ]
[ "${lines[0]}" = "Taste" ]
fi
}
@test "Get the tools version with -v" {
if [[ "$(uname)" == "Darwin" ]]; then
run taste -v
[ "$status" -eq 0 ]
result=$( echo $(taste -v) | grep -Eo "Version")
[ "$result" = "Version" ]
fi
}