Skip to content

Commit

Permalink
tests: Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
maxveldink committed Feb 21, 2024
1 parent c41eb1e commit b4d138c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/minitest/assertions/result_assertions_test.rb
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# frozen_string_literal: true

require "minitest/autorun"
require "minitest/result_assertions"

require "debug"

Expand Down

0 comments on commit b4d138c

Please sign in to comment.