From 6ecdf11dd6bd6c4303e2c7658572caa6e69b1ae2 Mon Sep 17 00:00:00 2001 From: Alex Epstein Date: Sun, 9 Jul 2017 17:46:48 -0400 Subject: [PATCH] Adding more functionality tests --- tests/currency.bats | 8 ++++++++ tests/qrify.bats | 14 ++++++++++++++ tests/taste.bats | 24 ++++++++++++++++++++++++ tests/weather.bats | 6 ++++++ 4 files changed, 52 insertions(+) diff --git a/tests/currency.bats b/tests/currency.bats index 24c9d30..38c3431 100755 --- a/tests/currency.bats +++ b/tests/currency.bats @@ -16,6 +16,14 @@ [ "${lines[0]}" = "Currency" ] } +@test "Testing currency exchange (12.35 EUR TO USD)" { + run currency EUR USD 12.35 + [ "$status" -eq 0 ] + [ "${lines[0]}" = "=========================" ] + [ "${lines[1]}" = "| EUR to USD" ] + [ "${lines[3]}" = "| EUR: 12.35" ] +} + @test "Get the tools version with -v" { run currency -v [ "$status" -eq 0 ] diff --git a/tests/qrify.bats b/tests/qrify.bats index a76b497..794df7e 100755 --- a/tests/qrify.bats +++ b/tests/qrify.bats @@ -16,6 +16,20 @@ [ "${lines[0]}" = "Qrify" ] } +@test "Getting the qr code for a test string" { + run qrify this is a test string + [ "$status" -eq 0 ] + [ "${lines[0]}" = "█████████████████████████████████" ] + [ "${lines[1]}" = "█████████████████████████████████" ] + [ "${lines[2]}" = "████ ▄▄▄▄▄ ██▀▄████ ██ ▄▄▄▄▄ ████" ] + [ "${lines[3]}" = "████ █ █ █▄▀█▄▀█ ▀▀█ █ █ ████" ] + [ "${lines[4]}" = "████ █▄▄▄█ ██▄▀▀ ▄ ▀█ █▄▄▄█ ████" ] +} + + + + + @test "No arguments prints usage instructions" { run qrify [ "$status" -eq 0 ] diff --git a/tests/taste.bats b/tests/taste.bats index fd51c85..c0f649c 100755 --- a/tests/taste.bats +++ b/tests/taste.bats @@ -18,6 +18,30 @@ [ "${lines[0]}" = "Taste" ] } +@test "Testing short recommendations" { + 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]}" = "===================================" ] +} + +@test "Testing long recommendations" { + 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," ] +} + +@test "Testing search on item" { + 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." ] +} + @test "No arguments prints usage instructions" { run taste [ "$status" -eq 0 ] diff --git a/tests/weather.bats b/tests/weather.bats index 9c9d3dc..293ad29 100755 --- a/tests/weather.bats +++ b/tests/weather.bats @@ -16,6 +16,12 @@ [ "${lines[0]}" = "Weather" ] } +@test "Testing weather with specified location" { + run weather Paramus + [ "$status" -eq 0 ] + [ "${lines[0]}" = "Weather report: Paramus, United States of America" ] +} + @test "Get the tools version with -v" { run weather -v [ "$status" -eq 0 ]