UNPKG

@ima/plugin-rest-client

Version:

Generic REST API client plugin for the IMA application framework.

46 lines (45 loc) 1.29 kB
/** * Tests provided set of conditions for the base class * * @param {Class} baseClass * @param {string} propertyName * @param {*} defaultValue * @param {boolean} throwsError * @param {*} testingValue */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "testStaticProperty", { enumerable: true, get: function() { return testStaticProperty; } }); function testStaticProperty(baseClass, propertyName, defaultValue, throwsError, testingValue) { class Entity1 extends baseClass { } class Entity2 extends baseClass { } if (throwsError) { expect(()=>{ return Entity1[propertyName]; }).toThrow(); } else { expect(Entity1[propertyName]).toEqual(defaultValue); } Entity2[propertyName] = testingValue; expect(Entity2[propertyName]).toBe(testingValue); // The property must not be affected on other entity classes if (throwsError) { expect(()=>{ return Entity1[propertyName]; }).toThrow(); } else { expect(Entity1[propertyName]).toEqual(defaultValue); } expect(()=>{ Entity2[propertyName] = testingValue; }).toThrow(); } //# sourceMappingURL=RestClientTestUtils.js.map