summaryrefslogtreecommitdiff
path: root/spec/graphql/types/kas/agent_connection_type_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/graphql/types/kas/agent_connection_type_spec.rb')
-rw-r--r--spec/graphql/types/kas/agent_connection_type_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/graphql/types/kas/agent_connection_type_spec.rb b/spec/graphql/types/kas/agent_connection_type_spec.rb
new file mode 100644
index 00000000000..0990d02af11
--- /dev/null
+++ b/spec/graphql/types/kas/agent_connection_type_spec.rb
@@ -0,0 +1,22 @@
+# 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