gitlab-org--gitlab-foss/spec/graphql/types/kas/agent_connection_type_spec.rb

23 lines
802 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Types::Kas::AgentConnectionType do
include GraphqlHelpers
let(:fields) { %i[connected_at connection_id metadata] }
it { expect(described_class.graphql_name).to eq('ConnectedAgent') }
it { expect(described_class.description).to eq('Connection details for an Agent') }
it { expect(described_class).to have_graphql_fields(fields) }
describe '#connected_at' do
let(:connected_at) { double(Google::Protobuf::Timestamp, seconds: 123456, nanos: 654321) }
let(:object) { double(Gitlab::Agent::AgentTracker::ConnectedAgentInfo, connected_at: connected_at) }
it 'converts the seconds value to a timestamp' do
expect(resolve_field(:connected_at, object)).to eq(Time.at(connected_at.seconds))
end
end
end