zammad_schema_global_id_spec.rb 744 B

12345678910111213141516171819202122
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. require 'rails_helper'
  3. RSpec.describe Gql::ZammadSchema, type: :graphql do
  4. it 'generates GraphQL::ID values' do
  5. expect(described_class.id_from_object(Ticket.first)).to eq('gid://zammad/Ticket/1')
  6. end
  7. it 'resolves GraphQL::ID values' do
  8. expect(described_class.object_from_id('gid://zammad/Ticket/1')).to eq(Ticket.first)
  9. end
  10. it 'resolves internal IDs to GraphQL::IDs' do
  11. expect(described_class.id_from_internal_id(Ticket, 1)).to eq('gid://zammad/Ticket/1')
  12. end
  13. it 'resolves internal IDs to GraphQL::IDs (with class name as string)' do
  14. expect(described_class.id_from_internal_id('Ticket', 1)).to eq('gid://zammad/Ticket/1')
  15. end
  16. end