@@ -36,6 +36,7 @@ export const selectOperation = (element, endpointName, operationName) => {
3636
3737describe ( 'ApiConsole' , ( ) => {
3838 const asyncApi = 'async-api' ;
39+ const grpcApi = 'grpc-test' ;
3940 const multiServer = 'multi-server' ;
4041 const apic553 = 'APIC-553' ;
4142 const apic554 = 'APIC-554' ;
@@ -212,6 +213,55 @@ describe('ApiConsole', () => {
212213 } ) ;
213214 } ) ;
214215
216+ describe ( 'gRPC API' , ( ) => {
217+ [
218+ new ApiDescribe ( 'Regular model' ) ,
219+ new ApiDescribe ( 'Compact model' , true ) ,
220+ ] . forEach ( ( { label, compact } ) => {
221+ describe ( label , ( ) => {
222+ let amf ;
223+ let element ;
224+
225+ before ( async ( ) => {
226+ amf = await AmfLoader . load ( { compact, fileName : grpcApi , flattened : false } ) ;
227+ } ) ;
228+
229+ beforeEach ( async ( ) => {
230+ element = await amfFixture ( amf ) ;
231+ await aTimeout ( 0 ) ;
232+ } ) ;
233+
234+ it ( 'should have _noTryItValue set to true for gRPC API' , ( ) => {
235+ assert . isTrue ( element . _noTryItValue , '_noTryItValue should be true for gRPC API' ) ;
236+ } ) ;
237+
238+ it ( 'should detect gRPC API correctly' , ( ) => {
239+ const isGrpc = element . _isGrpcApi ( amf ) ;
240+ assert . isTrue ( isGrpc , 'Should detect gRPC API' ) ;
241+ } ) ;
242+
243+ it ( 'should hide try-it button when selecting a method' , async ( ) => {
244+ const webApi = AmfLoader . lookupWebApi ( amf ) ;
245+ const endpoints = element . _computeEndpoints ( webApi ) ;
246+ if ( endpoints && endpoints . length > 0 ) {
247+ const operations = element . _computePropertyArray (
248+ endpoints [ 0 ] ,
249+ element . ns . aml . vocabularies . apiContract . supportedOperation
250+ ) ;
251+ if ( operations && operations . length > 0 ) {
252+ element . selectedShape = operations [ 0 ] [ '@id' ] ;
253+ element . selectedShapeType = 'method' ;
254+ await nextFrame ( ) ;
255+ await nextFrame ( ) ;
256+
257+ assert . isTrue ( element . _noTryItValue , 'Try-it button should be hidden for gRPC API method' ) ;
258+ }
259+ }
260+ } ) ;
261+ } ) ;
262+ } ) ;
263+ } ) ;
264+
215265 describe ( 'APIC-553' , ( ) => {
216266 [
217267 new ApiDescribe ( 'Regular model' ) ,
0 commit comments