From b4d138cf32e7fccc6c0da2f67d211c504f70f855 Mon Sep 17 00:00:00 2001 From: Max VelDink Date: Wed, 21 Feb 2024 09:58:50 -0500 Subject: [PATCH] tests: Add tests --- .../assertions/result_assertions_test.rb | 30 +++++++++++++++++++ test/test_helper.rb | 1 + 2 files changed, 31 insertions(+) create mode 100644 test/minitest/assertions/result_assertions_test.rb diff --git a/test/minitest/assertions/result_assertions_test.rb b/test/minitest/assertions/result_assertions_test.rb new file mode 100644 index 0000000..47728f4 --- /dev/null +++ b/test/minitest/assertions/result_assertions_test.rb @@ -0,0 +1,30 @@ +# typed: true + +require "test_helper" + +class ResultAssertionsTest < Minitest::Test + def setup + @success = Typed::Success.new("Test Payload") + @failure = Typed::Failure.new("Test Error") + end + + def test_success_assertions + assert_success(@success) + refute_success(@failure) + end + + def test_failure_assertions + assert_failure(@failure) + refute_failure(@success) + end + + def test_payload_assertions + assert_payload("Test Payload", @success) + refute_payload("Payload", @success) + end + + def test_error_assertions + assert_error("Test Error", @failure) + refute_error("Error", @failure) + end +end diff --git a/test/test_helper.rb b/test/test_helper.rb index e534c53..b56b303 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -2,6 +2,7 @@ # frozen_string_literal: true require "minitest/autorun" +require "minitest/result_assertions" require "debug"