cli
 1# frozen_string_literal: true
 2
 3RSpec.describe Scim::Kit::Cli do
 4  describe '.collection' do
 5    it 'returns a bare array unchanged' do
 6      expect(described_class.collection([{ id: '1' }])).to eql([{ id: '1' }])
 7    end
 8
 9    it 'unwraps the Resources array from a ListResponse envelope' do
10      body = { totalResults: 1, Resources: [{ id: '1' }] }
11
12      expect(described_class.collection(body)).to eql([{ id: '1' }])
13    end
14
15    it 'returns nil for a hash without a Resources array' do
16      expect(described_class.collection(detail: 'boom')).to be_nil
17    end
18
19    it 'returns nil for a scalar body' do
20      expect(described_class.collection('nope')).to be_nil
21    end
22  end
23end