|
3 | 3 | let(:recording_transcriptions_default) { Bandwidth::RecordingTranscriptions.new } |
4 | 4 | let(:recording_transcriptions_values) { Bandwidth::RecordingTranscriptions.new({ |
5 | 5 | transcripts: [ |
6 | | - Bandwidth::Transcription.new({ text: 'Hello World! Thank you for calling.', confidence: 0.9 }) |
| 6 | + Bandwidth::Transcription.new({ |
| 7 | + speaker: 1, |
| 8 | + text: 'Hello World! Thank you for calling.', |
| 9 | + confidence: 0.9 |
| 10 | + }) |
| 11 | + ], |
| 12 | + clips: [ |
| 13 | + Bandwidth::RecordingTranscriptionClip.new({ |
| 14 | + speaker: 1, |
| 15 | + text: 'Hello World! Thank you for calling.', |
| 16 | + confidence: 0.9, |
| 17 | + start_time_seconds: 1.0, |
| 18 | + end_time_seconds: 5.0 |
| 19 | + }) |
7 | 20 | ] |
8 | 21 | }) } |
9 | 22 |
|
|
36 | 49 | describe '#build_from_hash' do |
37 | 50 | it 'validates instance of RecordingTranscriptions created by the build_from_hash method' do |
38 | 51 | recording_transcriptions_from_hash = Bandwidth::RecordingTranscriptions.build_from_hash({ |
39 | | - transcripts: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9 }] |
| 52 | + transcripts: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9, speaker: 1 }], |
| 53 | + clips: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9, speaker: 1, startTimeSeconds: 1.0, endTimeSeconds: 5.0 }] |
40 | 54 | }) |
41 | 55 | expect(recording_transcriptions_from_hash).to be_instance_of(Bandwidth::RecordingTranscriptions) |
42 | 56 | expect(recording_transcriptions_from_hash.transcripts).to be_instance_of(Array) |
43 | 57 | expect(recording_transcriptions_from_hash.transcripts.first).to be_instance_of(Bandwidth::Transcription) |
| 58 | + expect(recording_transcriptions_from_hash.transcripts.first.speaker).to eq(1) |
44 | 59 | expect(recording_transcriptions_from_hash.transcripts.first.text).to eq('Hello World! Thank you for calling.') |
45 | 60 | expect(recording_transcriptions_from_hash.transcripts.first.confidence).to eq(0.9) |
| 61 | + expect(recording_transcriptions_from_hash.clips).to be_instance_of(Array) |
| 62 | + expect(recording_transcriptions_from_hash.clips.first).to be_instance_of(Bandwidth::RecordingTranscriptionClip) |
| 63 | + expect(recording_transcriptions_from_hash.clips.first.speaker).to eq(1) |
| 64 | + expect(recording_transcriptions_from_hash.clips.first.text).to eq('Hello World! Thank you for calling.') |
| 65 | + expect(recording_transcriptions_from_hash.clips.first.confidence).to eq(0.9) |
| 66 | + expect(recording_transcriptions_from_hash.clips.first.start_time_seconds).to eq(1.0) |
| 67 | + expect(recording_transcriptions_from_hash.clips.first.end_time_seconds).to eq(5.0) |
46 | 68 | end |
47 | 69 | end |
48 | 70 |
|
49 | 71 | describe '#to_s' do |
50 | 72 | it 'returns a string representation of the object' do |
51 | | - expect(recording_transcriptions_values.to_s).to eq('{:transcripts=>[{:text=>"Hello World! Thank you for calling.", :confidence=>0.9}]}') |
| 73 | + expect(recording_transcriptions_values.to_s).to eq('{:transcripts=>[{:speaker=>1, :text=>"Hello World! Thank you for calling.", :confidence=>0.9}], :clips=>[{:speaker=>1, :text=>"Hello World! Thank you for calling.", :confidence=>0.9, :startTimeSeconds=>1.0, :endTimeSeconds=>5.0}]}') |
52 | 74 | end |
53 | 75 | end |
54 | 76 |
|
|
62 | 84 | describe '#to_body #to_hash' do |
63 | 85 | it 'returns a hash representation of the object' do |
64 | 86 | expect(recording_transcriptions_values.to_body).to eq({ |
65 | | - transcripts: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9 }] |
| 87 | + transcripts: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9, speaker: 1 }], |
| 88 | + clips: [{ text: 'Hello World! Thank you for calling.', confidence: 0.9, speaker: 1, startTimeSeconds: 1.0, endTimeSeconds: 5.0 }] |
66 | 89 | }) |
67 | 90 | end |
68 | 91 | end |
|
0 commit comments