Skip to content

Commit

Permalink
WIP tests
Browse files Browse the repository at this point in the history
  • Loading branch information
exterm committed Mar 19, 2024
1 parent 1a6fc98 commit 57448d9
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions test/unit/packwerk/references_from_file_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# typed: true
# frozen_string_literal: true

require "test_helper"

module Packwerk
class ReferencesFromFileTest < Minitest::Test

setup do
config = Configuration.new
config.stubs(:load_paths).returns({})
@run_context = RunContext.from_configuration(config)
RunContext.stubs(:from_configuration).with(config).returns(@run_context)
@referencer = ReferencesFromFile.new(config)
end

test "raises on parser error" do
offense = Offense.new(file: "something.rb", message: "yo")
@run_context.stubs(:references_from_file).returns(
RunContext::FileReferencesResult.new(file_offenses: [offense], references: [])
)

assert_raises ReferencesFromFile::FileParserError do
@referencer.list("lib/something.rb")
end
end
end
end

# @referencer.stubs(files).returns(["lib/something.rb"])

0 comments on commit 57448d9

Please sign in to comment.