You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: type_name_completion_test.rb
    path of file: ./repos/steep/test
    
    the code of the file until where you have to start completion: require_relative "test_helper"

class TypeNameCompletionTest < Minitest::Test
  include TestHelper
  include FactoryHelper

  include Steep

  def buffer(string)
    RBS::Buffer.new(name: "a.rb", content: string)
  end

  def test_prefix_parse
    Services::TypeNameCompletion::Prefix.parse(buffer("() -> "), line: 1, column: 5).tap do |prefix|
      assert_nil prefix
    end

    Services::TypeNameCompletion::Prefix.parse(buffer("() -> St"), line: 1, column: 8).tap do |prefix|
      assert_instance_of Services::TypeNameCompletion::Prefix::RawIdentPrefix, prefix
      assert_equal "St", prefix.ident
      assert_predicate prefix, :const_name?
    end

    Services::TypeNameCompletion::Prefix.parse(buffer("() -> booli"), line: 1, column: 11).tap do |prefix|
      assert_instance_of Services::TypeNameCompletion::Prefix::RawIdentPrefix, prefix
      assert_equal "booli", prefix.ident
      refute_predicate prefix, :const_name?
    end

    Services::TypeNameCompletion::Prefix.parse(buffer("() -> ::RBS::"), line: 1, column: 13).tap do |prefix|
      assert_instance_of Services::TypeNameCompletion::Prefix
    
  def test_use_type_names
    with_factory({ "a.rbs" => <<~RBS }) do |factory|
        use Object as Foo, Integer as String, LongName as Long

        module LongName
          type hello = Integer
        end
      RBS

      buf = factory.env.buffers.find {|buf| Pathname(buf.name).basename == Pathname("a.rbs") }
      dirs = factory.env.signatures[buf][0]

      completion = Services::TypeNameCompletion.new(env: factory.env, context: nil, dirs: dirs)

      assert_operator completion.each_type_name, :include?, TypeName("Foo")
      assert_operator completion.each_type_name, :include?, TypeName("String")
      assert_operator completion.each_type_name, :include?, TypeName("::String")

      assert_operator completion.find_type_names(nil), :include?, TypeName("Foo")
      assert_operator completion.find_type_names(nil), :include?, TypeName("String")
      assert_operator completion.find_type_names(nil), :include?, TypeName("::String")

      assert_operator completion.find_type_names(Services::TypeNameCompletion::Prefix::RawIdentPrefix.new("Foo")), :include?, TypeName("Foo")
      assert_operator(
        completion.find_type_names(Services::TypeNameCompletion::Prefix::NamespacePrefix.new(RBS::Namespace.parse("Long::"), 6)),
        :include?,
        TypeName("Long::hello")
      )

      assert_equal [TypeName("::Object"), TypeName("Foo")], completion.resolve_name_in_context(TypeName("Foo"))
      assert_equal [TypeName("::Integer"), TypeName("String")], completion.resolve_name_in_context(TypeName("String"))
      assert_equal [TypeName("::String"), TypeName("::String")], completion.resolve_name_in_context(TypeName("::String"))
      assert_equal [TypeName("::LongName::hello"), TypeName("Long::hello")], completion.resolve_name_in_context(TypeName("Long::hello"))
    end