UNPKG

@studyportals/sp-r2d2

Version:

A framework that contains various components used when developing projects that will be deployed via AWS λ.

62 lines 2.84 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); const mocha_1 = require("@testdeck/mocha"); const Moq = require("typemoq"); const chai_1 = require("chai"); const environment_variables_catalog_class_1 = require("../../infrastructure/environment-variables/environment-variables-catalog.class"); let EnvironmentVariablesCatalogTest = class EnvironmentVariablesCatalogTest { get testInstanceMock() { return this._testInstanceMock; } get testInstance() { return this.testInstanceMock.object; } before() { this._testInstanceMock = Moq.Mock.ofType(environment_variables_catalog_class_1.EnvironmentVariablesCatalog); this.testInstanceMock.callBase = true; } i_environment_variables_provider__set() { chai_1.assert.isTrue(this.testInstance.__i_environment_variables_provider__); } get_VariableSet_SpecifiedValue() { let variableName = 'SomeVariable'; let providedValue = 'SomeValue'; let receivedValue = ''; this.testInstance.set(variableName, providedValue); receivedValue = this.testInstance.get(variableName); chai_1.assert.equal(receivedValue, providedValue); } get_VariableNotSet_Exception() { let variableName = 'SomeVariable'; let exceptionCaught = false; let exceptionMessage = ''; try { this.testInstance.get(variableName); } catch (e) { exceptionCaught = true; exceptionMessage = e.message; } chai_1.assert.isTrue(exceptionCaught, 'Exception not caught'); chai_1.assert.isTrue(-1 !== exceptionMessage.indexOf(variableName), 'Variable name not specified in message'); } }; __decorate([ mocha_1.test ], EnvironmentVariablesCatalogTest.prototype, "i_environment_variables_provider__set", null); __decorate([ mocha_1.test ], EnvironmentVariablesCatalogTest.prototype, "get_VariableSet_SpecifiedValue", null); __decorate([ mocha_1.test ], EnvironmentVariablesCatalogTest.prototype, "get_VariableNotSet_Exception", null); EnvironmentVariablesCatalogTest = __decorate([ mocha_1.suite ], EnvironmentVariablesCatalogTest); //# sourceMappingURL=environment-variables-catalog.test.js.map