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('Template', 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 = {
            'templates': [
                {
                    'sid': 'HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                    'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                    'friendly_name': 'Base Verification Template 2 with do not share',
                    'translations': {
                        'en': {
                            'is_default_translation': true,
                            'status': 'approved',
                            'locale': 'en',
                            'text': 'Your {{friendly_name}} verification code is: {{code}}. Do not share this code with anyone.',
                            'date_updated': '2021-07-29T20:38:28.759979905Z',
                            'date_created': '2021-07-29T20:38:28.165602325Z'
                        }
                    }
                }
            ],
            'meta': {
                'page': 0,
                'page_size': 50,
                'first_page_url': 'https://verify.twilio.com/v2/Templates?PageSize=50&Page=0',
                'previous_page_url': null,
                'url': 'https://verify.twilio.com/v2/Templates?PageSize=50&Page=0',
                'next_page_url': null,
                'key': 'templates'
            }
        };
        holodeck.mock(new Response(200, body));
        client.verify.v2.templates.each(() => done());
      }
    );
    it('should treat the second arg as a callback',
      function(done) {
        var body = {
            'templates': [
                {
                    'sid': 'HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                    'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                    'friendly_name': 'Base Verification Template 2 with do not share',
                    'translations': {
                        'en': {
                            'is_default_translation': true,
                            'status': 'approved',
                            'locale': 'en',
                            'text': 'Your {{friendly_name}} verification code is: {{code}}. Do not share this code with anyone.',
                            'date_updated': '2021-07-29T20:38:28.759979905Z',
                            'date_created': '2021-07-29T20:38:28.165602325Z'
                        }
                    }
                }
            ],
            'meta': {
                'page': 0,
                'page_size': 50,
                'first_page_url': 'https://verify.twilio.com/v2/Templates?PageSize=50&Page=0',
                'previous_page_url': null,
                'url': 'https://verify.twilio.com/v2/Templates?PageSize=50&Page=0',
                'next_page_url': null,
                'key': 'templates'
            }
        };
        holodeck.mock(new Response(200, body));
        client.verify.v2.templates.each({pageSize: 20}, () => done());
        holodeck.assertHasRequest(new Request({
            method: 'GET',
            url: 'https://verify.twilio.com/v2/Templates',
            params: {PageSize: 20},
        }));
      }
    );
    it('should find the callback in the opts object',
      function(done) {
        var body = {
            'templates': [
                {
                    'sid': 'HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                    'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                    'friendly_name': 'Base Verification Template 2 with do not share',
                    'translations': {
                        'en': {
                            'is_default_translation': true,
                            'status': 'approved',
                            'locale': 'en',
                            'text': 'Your {{friendly_name}} verification code is: {{code}}. Do not share this code with anyone.',
                            'date_updated': '2021-07-29T20:38:28.759979905Z',
                            'date_created': '2021-07-29T20:38:28.165602325Z'
                        }
                    }
                }
            ],
            'meta': {
                'page': 0,
                'page_size': 50,
                'first_page_url': 'https://verify.twilio.com/v2/Templates?PageSize=50&Page=0',
                'previous_page_url': null,
                'url': 'https://verify.twilio.com/v2/Templates?PageSize=50&Page=0',
                'next_page_url': null,
                'key': 'templates'
            }
        };
        holodeck.mock(new Response(200, body));
        client.verify.v2.templates.each({callback: () => done()}, () => fail('wrong callback!'));
      }
    );
    it('should generate valid list request',
      function(done) {
        holodeck.mock(new Response(500, {}));
  
        var promise = client.verify.v2.templates.list();
        promise.then(function() {
          throw new Error('failed');
        }, function(error) {
          expect(error.constructor).toBe(RestException.prototype.constructor);
          done();
        }).done();
  
        var url = 'https://verify.twilio.com/v2/Templates';
  
        holodeck.assertHasRequest(new Request({
          method: 'GET',
          url: url
        }));
      }
    );
    it('should generate valid list_verification_templates response',
      function(done) {
        var body = {
            'templates': [
                {
                    'sid': 'HJaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                    'account_sid': 'ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa',
                    'friendly_name': 'Base Verification Template 2 with do not share',
                    'translations': {
                        'en': {
                            'is_default_translation': true,
                            'status': 'approved',
                            'locale': 'en',
                            'text': 'Your {{friendly_name}} verification code is: {{code}}. Do not share this code with anyone.',
                            'date_updated': '2021-07-29T20:38:28.759979905Z',
                            'date_created': '2021-07-29T20:38:28.165602325Z'
                        }
                    }
                }
            ],
            'meta': {
                'page': 0,
                'page_size': 50,
                'first_page_url': 'https://verify.twilio.com/v2/Templates?PageSize=50&Page=0',
                'previous_page_url': null,
                'url': 'https://verify.twilio.com/v2/Templates?PageSize=50&Page=0',
                'next_page_url': null,
                'key': 'templates'
            }
        };
  
        holodeck.mock(new Response(200, body));
  
        var promise = client.verify.v2.templates.list();
        promise.then(function(response) {
          expect(response).toBeDefined();
          done();
        }, function() {
          throw new Error('failed');
        }).done();
      }
    );
  });
  