text: 'use strict';
  
  /* jshint ignore:start */
  /**
   * This code was generated by
   * \ / _    _  _|   _  _
   *  | (_)\/(_)(_|\/| |(/_  v1.0.0
   *       /       /
   */
  /* jshint ignore:end */
  
  var Holodeck = require('../../../holodeck');  /* jshint ignore:line */
  var Request = require(
      '../../../../../lib/http/request');  /* jshint ignore:line */
  var Response = require(
      '../../../../../lib/http/response');  /* jshint ignore:line */
  var RestException = require(
      '../../../../../lib/base/RestException');  /* jshint ignore:line */
  var Twilio = require('../../../../../lib');  /* jshint ignore:line */
  
  
  var client;
  var holodeck;
  
  describe('EventType', function() {
    beforeEach(function() {
      holodeck = new Holodeck();
      client = new Twilio('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'AUTHTOKEN', {
        httpClient: holodeck
      });
    });
    it('should treat the first each arg as a callback',
      function(done) {
        var body = {
            'types': [
                {
                    'date_created': '2020-08-13T12:50:18Z',
                    'date_updated': '2020-08-13T13:28:48Z',
                    'type': 'com.twilio.test.example',
                    'schema_id': 'EventStreams.SampleSchema',
                    'description': 'A sample event type',
                    'url': 'https://events.twilio.com/v1/Types/com.twilio.test.example',
                    'links': {
                        'schema': 'https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions'
                    }
                },
                {
                    'date_created': '2020-08-13T12:50:19Z',
                    'date_updated': '2020-08-13T13:28:49Z',
                    'type': 'com.twilio.test.example2',
                    'schema_id': 'EventStreams.SampleSchema',
                    'description': 'Another sample event type',
                    'url': 'https://events.twilio.com/v1/Types/com.twilio.test.example2',
                    'links': {
                        'schema': 'https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions'
                    }
                }
            ],
            'meta': {
                'page': 0,
                'page_size': 20,
                'first_page_url': 'https://events.twilio.com/v1/Types?PageSize=20&Page=0',
                'previous_page_url': null,
                'url': 'https://events.twilio.com/v1/Types?PageSize=20&Page=0',
                'next_page_url': null,
                'key': 'types'
            }
        };
        holodeck.mock(new Response(200, body));
        client.events.v1.eventTypes.each(() => done());
      }
    );
    it('should treat the second arg as a callback',
      function(done) {
        var body = {
            'types': [
                {
                    'date_created': '2020-08-13T12:50:18Z',
                    'date_updated': '2020-08-13T13:28:48Z',
                    'type': 'com.twilio.test.example',
                    'schema_id': 'EventStreams.SampleSchema',
                    'description': 'A sample event type',
                    'url': 'https://events.twilio.com/v1/Types/com.twilio.test.example',
                    'links': {
                        'schema': 'https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions'
                    }
                },
                {
                    'date_created': '2020-08-13T12:50:19Z',
                    'date_updated': '2020-08-13T13:28:49Z',
                    'type': 'com.twilio.test.example2',
                    'schema_id': 'EventStreams.SampleSchema',
                    'description': 'Another sample event type',
                    'url': 'https://events.twilio.com/v1/Types/com.twilio.test.example2',
                    'links': {
                        'schema': 'https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions'
                    }
                }
            ],
            'meta': {
                'page': 0,
                'page_size': 20,
                'first_page_url': 'https://events.twilio.com/v1/Types?PageSize=20&Page=0',
                'previous_page_url': null,
                'url': 'https://events.twilio.com/v1/Types?PageSize=20&Page=0',
                'next_page_url': null,
                'key': 'types'
            }
        };
        holodeck.mock(new Response(200, body));
        client.events.v1.eventTypes.each({pageSize: 20}, () => done());
        holodeck.assertHasRequest(new Request({
            method: 'GET',
            url: 'https://events.twilio.com/v1/Types',
            params: {PageSize: 20},
        }));
      }
    );
    it('should find the callback in the opts object',
      function(done) {
        var body = {
            'types': [
                {
                    'date_created': '2020-08-13T12:50:18Z',
                    'date_updated': '2020-08-13T13:28:48Z',
                    'type': 'com.twilio.test.example',
                    'schema_id': 'EventStreams.SampleSchema',
                    'description': 'A sample event type',
                    'url': 'https://events.twilio.com/v1/Types/com.twilio.test.example',
                    'links': {
                        'schema': 'https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions'
                    }
                },
                {
                    'date_created': '2020-08-13T12:50:19Z',
                    'date_updated': '2020-08-13T13:28:49Z',
                    'type': 'com.twilio.test.example2',
                    'schema_id': 'EventStreams.SampleSchema',
                    'description': 'Another sample event type',
                    'url': 'https://events.twilio.com/v1/Types/com.twilio.test.example2',
                    'links': {
                        'schema': 'https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions'
                    }
                }
            ],
            'meta': {
                'page': 0,
                'page_size': 20,
                'first_page_url': 'https://events.twilio.com/v1/Types?PageSize=20&Page=0',
                'previous_page_url': null,
                'url': 'https://events.twilio.com/v1/Types?PageSize=20&Page=0',
                'next_page_url': null,
                'key': 'types'
            }
        };
        holodeck.mock(new Response(200, body));
        client.events.v1.eventTypes.each({callback: () => done()}, () => fail('wrong callback!'));
      }
    );
    it('should generate valid list request',
      function(done) {
        holodeck.mock(new Response(500, {}));
  
        var promise = client.events.v1.eventTypes.list();
        promise.then(function() {
          throw new Error('failed');
        }, function(error) {
          expect(error.constructor).toBe(RestException.prototype.constructor);
          done();
        }).done();
  
        var url = 'https://events.twilio.com/v1/Types';
  
        holodeck.assertHasRequest(new Request({
          method: 'GET',
          url: url
        }));
      }
    );
    it('should generate valid read_empty response',
      function(done) {
        var body = {
            'types': [],
            'meta': {
                'page': 0,
                'page_size': 10,
                'first_page_url': 'https://events.twilio.com/v1/Types?PageSize=10&Page=0',
                'previous_page_url': null,
                'url': 'https://events.twilio.com/v1/Types?PageSize=10&Page=0',
                'next_page_url': null,
                'key': 'types'
            }
        };
  
        holodeck.mock(new Response(200, body));
  
        var promise = client.events.v1.eventTypes.list();
        promise.then(function(response) {
          expect(response).toBeDefined();
          done();
        }, function() {
          throw new Error('failed');
        }).done();
      }
    );
    it('should generate valid read_results response',
      function(done) {
        var body = {
            'types': [
                {
                    'date_created': '2020-08-13T12:50:18Z',
                    'date_updated': '2020-08-13T13:28:48Z',
                    'type': 'com.twilio.test.example',
                    'schema_id': 'EventStreams.SampleSchema',
                    'description': 'A sample event type',
                    'url': 'https://events.twilio.com/v1/Types/com.twilio.test.example',
                    'links': {
                        'schema': 'https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions'
                    }
                },
                {
                    'date_created': '2020-08-13T12:50:19Z',
                    'date_updated': '2020-08-13T13:28:49Z',
                    'type': 'com.twilio.test.example2',
                    'schema_id': 'EventStreams.SampleSchema',
                    'description': 'Another sample event type',
                    'url': 'https://events.twilio.com/v1/Types/com.twilio.test.example2',
                    'links': {
                        'schema': 'https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions'
                    }
                }
            ],
            'meta': {
                'page': 0,
                'page_size': 20,
                'first_page_url': 'https://events.twilio.com/v1/Types?PageSize=20&Page=0',
                'previous_page_url': null,
                'url': 'https://events.twilio.com/v1/Types?PageSize=20&Page=0',
                'next_page_url': null,
                'key': 'types'
            }
        };
  
        holodeck.mock(new Response(200, body));
  
        var promise = client.events.v1.eventTypes.list();
        promise.then(function(response) {
          expect(response).toBeDefined();
          done();
        }, function() {
          throw new Error('failed');
        }).done();
      }
    );
    it('should generate valid fetch request',
      function(done) {
        holodeck.mock(new Response(500, {}));
  
        var promise = client.events.v1.eventTypes('type').fetch();
        promise.then(function() {
          throw new Error('failed');
        }, function(error) {
          expect(error.constructor).toBe(RestException.prototype.constructor);
          done();
        }).done();
  
        var type = 'type';
        var url = `https://events.twilio.com/v1/Types/${type}`;
  
        holodeck.assertHasRequest(new Request({
          method: 'GET',
          url: url
        }));
      }
    );
    it('should generate valid fetch response',
      function(done) {
        var body = {
            'date_created': '2020-08-13T12:50:18Z',
            'date_updated': '2020-08-13T13:28:48Z',
            'type': 'com.twilio.test.example',
            'schema_id': 'EventStreams.SampleSchema',
            'description': 'A sample subscription',
            'url': 'https://events.twilio.com/v1/Types/com.twilio.test.example',
            'links': {
                'schema': 'https://events.twilio.com/v1/Schemas/EventStreams.SampleSchema/Versions'
            }
        };
  
        holodeck.mock(new Response(200, body));
  
        var promise = client.events.v1.eventTypes('type').fetch();
        promise.then(function(response) {
          expect(response).toBeDefined();
          done();
        }, function() {
          throw new Error('failed');
        }).done();
      }
    );
  });
  