11/* eslint-disable no-unused-vars */
2- import React from 'react'
2+ import React from 'react' ;
33/* eslint-enable no-unused-vars */
4- import { shallow , mount } from 'enzyme'
5- import { Audio , Transformation } from 'cloudinary-react'
4+ import { shallow , mount } from 'enzyme' ;
5+ import { Audio , Transformation } from 'cloudinary-react' ;
66
77describe ( 'Audio' , ( ) => {
88 it ( 'should include child transformation for a single source type' , function ( ) {
@@ -17,30 +17,30 @@ describe('Audio', () => {
1717 >
1818 < Transformation quality = '70' />
1919 </ Audio >
20- )
21- expect ( tag . props ( ) . src ) . toEndWith ( '/q_70/du_3/dog.wav' )
22- } )
20+ ) ;
21+ expect ( tag . props ( ) . src ) . toEndWith ( '/q_70/du_3/dog.wav' ) ;
22+ } ) ;
2323
2424 it ( 'should support startOffset parameter' , function ( ) {
2525 let tag = shallow (
2626 < Audio cloudName = 'demo' sourceTypes = 'wav' publicId = 'dog' >
2727 < Transformation startOffset = 'auto' />
2828 </ Audio >
29- )
30- expect ( tag . props ( ) . src ) . toEndWith ( '/so_auto/dog.wav' )
29+ ) ;
30+ expect ( tag . props ( ) . src ) . toEndWith ( '/so_auto/dog.wav' ) ;
3131 tag = shallow (
3232 < Audio cloudName = 'demo' sourceTypes = 'wav' publicId = 'dog' >
3333 < Transformation startOffset = '2' />
3434 </ Audio >
35- )
36- expect ( tag . props ( ) . src ) . toEndWith ( '/so_2/dog.wav' )
35+ ) ;
36+ expect ( tag . props ( ) . src ) . toEndWith ( '/so_2/dog.wav' ) ;
3737 tag = shallow (
3838 < Audio cloudName = 'demo' sourceTypes = 'wav' publicId = 'dog' >
3939 < Transformation startOffset = '2.34' />
4040 </ Audio >
41- )
42- expect ( tag . props ( ) . src ) . toEndWith ( '/so_2.34/dog.wav' )
43- } )
41+ ) ;
42+ expect ( tag . props ( ) . src ) . toEndWith ( '/so_2.34/dog.wav' ) ;
43+ } ) ;
4444
4545 it ( 'should include child transformation for multiple source types' , function ( ) {
4646 const tag = shallow (
@@ -55,26 +55,26 @@ describe('Audio', () => {
5555 >
5656 < Transformation duration = '2' />
5757 </ Audio >
58- )
58+ ) ;
5959 expect ( tag . find ( '[type="audio/vnd.wav"]' ) . props ( ) . src ) . toEndWith (
6060 '/du_2/e_volume:30/dog.wav'
61- )
61+ ) ;
6262 expect ( tag . find ( '[type="audio/mpeg"]' ) . props ( ) . src ) . toEndWith (
6363 '/du_2/e_volume:45/dog.mp3'
64- )
65- } )
64+ ) ;
65+ } ) ;
6666
6767 it ( 'should support inner text' , function ( ) {
6868 const tag = shallow (
6969 < Audio cloudName = 'demo' publicId = 'dog' >
7070 Your browser does not support the audio tag.
7171 </ Audio >
72- )
73- expect ( tag . type ( ) ) . toEqual ( 'audio' )
74- } )
72+ ) ;
73+ expect ( tag . type ( ) ) . toEqual ( 'audio' ) ;
74+ } ) ;
7575
7676 it ( 'Should support forwarding innerRef to underlying audio element' , function ( ) {
77- const myRef = React . createRef ( )
77+ const myRef = React . createRef ( ) ;
7878
7979 const tag = mount (
8080 < Audio
@@ -86,43 +86,44 @@ describe('Audio', () => {
8686 ogg : { duration : 2 }
8787 } }
8888 />
89- )
89+ ) ;
9090
91- const audio = myRef . current
91+ const audio = myRef . current ;
9292
93- expect ( tag . find ( 'audio' ) . prop ( 'src' ) ) . toEndWith ( '/du_2/dog.ogg' )
93+ expect ( tag . find ( 'audio' ) . prop ( 'src' ) ) . toEndWith ( '/du_2/dog.ogg' ) ;
9494 expect ( audio . src ) . toEndWith ( '/du_2/dog.ogg' )
9595 ; [ 'play' , 'pause' , 'canPlayType' , 'addTextTrack' ] . forEach ( ( func ) =>
9696 expect ( typeof audio [ func ] ) . toBe ( 'function' )
97- )
98- } )
97+ ) ;
98+ } ) ;
9999
100100 it ( 'Should not set a poster attribute' , function ( ) {
101- const tag = shallow ( < Audio cloudName = 'demo' publicId = 'dog' /> )
101+ const tag = shallow ( < Audio cloudName = 'demo' publicId = 'dog' /> ) ;
102102
103- expect ( tag . props ( ) . poster ) . toEqual ( undefined )
104- } )
103+ expect ( tag . props ( ) . poster ) . toEqual ( undefined ) ;
104+ } ) ;
105105
106106 it ( 'Should pass camelCase attributes to Audio component' , function ( ) {
107107 const tag = shallow (
108108 < Audio playsInline autoPlay cloudName = 'demo' publicId = 'dog' />
109- )
109+ ) ;
110110
111- const { autoPlay, auto_play } = tag . props ( )
111+ // eslint-disable-next-line camelcase
112+ const { autoPlay, auto_play } = tag . props ( ) ;
112113
113- expect ( autoPlay ) . toEqual ( true )
114+ expect ( autoPlay ) . toEqual ( true ) ;
114115
115- expect ( auto_play ) . toEqual ( undefined )
116- } )
116+ expect ( auto_play ) . toEqual ( undefined ) ;
117+ } ) ;
117118 it ( 'Should pass camelCase attributes to inner audio element' , function ( ) {
118- const tag = mount ( < Audio autoPlay cloudName = 'demo' publicId = 'dog' /> )
119+ const tag = mount ( < Audio autoPlay cloudName = 'demo' publicId = 'dog' /> ) ;
119120
120- const audio = tag . find ( 'audio' )
121- expect ( audio . prop ( 'autoPlay' ) ) . toEqual ( true )
121+ const audio = tag . find ( 'audio' ) ;
122+ expect ( audio . prop ( 'autoPlay' ) ) . toEqual ( true ) ;
122123
123- expect ( audio . prop ( 'plays_inline' ) ) . toEqual ( undefined )
124- expect ( audio . prop ( 'auto_play' ) ) . toEqual ( undefined )
125- } )
124+ expect ( audio . prop ( 'plays_inline' ) ) . toEqual ( undefined ) ;
125+ expect ( audio . prop ( 'auto_play' ) ) . toEqual ( undefined ) ;
126+ } ) ;
126127 it ( 'should generate default source tags' , function ( ) {
127128 const tag = shallow (
128129 < Audio
@@ -136,15 +137,15 @@ describe('Audio', () => {
136137 >
137138 < Transformation quality = '70' />
138139 </ Audio >
139- )
140+ ) ;
140141 expect ( tag . find ( '[type="audio/aac"]' ) . props ( ) . src ) . toEndWith (
141142 '/du_1/dog.aac'
142- )
143+ ) ;
143144 expect ( tag . find ( '[type="audio/mpeg"]' ) . props ( ) . src ) . toEndWith (
144145 '/du_2/dog.mp3'
145- )
146+ ) ;
146147 expect ( tag . find ( '[type="audio/ogg"]' ) . props ( ) . src ) . toEndWith (
147148 '/du_3/dog.ogg'
148- )
149- } )
150- } )
149+ ) ;
150+ } ) ;
151+ } ) ;
0 commit comments