'use strict';

var _assert = require('assert');

var _assert2 = _interopRequireDefault(_assert);

var _mocha = require('mocha');

var _allowPut = require('../../src/behaviors/allowPut.js');

var _fs = require('fs');

var _fs2 = _interopRequireDefault(_fs);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

(0, _mocha.describe)('BehaviorAllowPut', function () {
    (0, _mocha.describe)('enabled', function () {
        (0, _mocha.it)('should return expected lua', function (done) {
            _fs2.default.readFile(__dirname + '/allowPut.enabled.papi.json', 'utf8', function (err, options) {
                if (err) {
                    throw err;
                }
                var opts = JSON.parse(options);

                var expected = 'aka_request_method_status["PUT"] = "ALLOW"';
                var actual = new _allowPut.BehaviorAllowPut(opts).process();
                _assert2.default.equal(actual, expected);
                done();
            });
        });
    });

    (0, _mocha.describe)('disabled', function () {
        (0, _mocha.it)('should return expected lua', function (done) {
            _fs2.default.readFile(__dirname + '/allowPut.disabled.papi.json', 'utf8', function (err, options) {
                if (err) {
                    throw err;
                }
                var opts = JSON.parse(options);

                var expected = 'aka_request_method_status["PUT"] = "DENY"';
                var actual = new _allowPut.BehaviorAllowPut(opts).process();
                _assert2.default.equal(actual, expected);
                done();
            });
        });
    });
});