kentico-cloud-delivery
Version:
Official Kentico Cloud Delivery SDK
47 lines • 2.62 kB
JavaScript
exports.__esModule = true;
var operators_1 = require("rxjs/operators");
var setup_1 = require("../../setup");
describe('Live element', function () {
var context = new setup_1.Context();
setup_1.setup(context);
var typeCodename = 'movie';
var textElementCodename = 'title';
var multipleChoiceElementCodename = 'category';
var taxonomyElementCodename = 'releasecategory';
var textElementResponse;
var multipleChoiceElementResponse;
var taxonomyElementResponse;
beforeAll(function (done) {
context.deliveryClient.element(typeCodename, textElementCodename)
.getObservable()
.pipe(operators_1.map(function (r) { return textElementResponse = r; }), operators_1.flatMap(function () { return context.deliveryClient.element(typeCodename, multipleChoiceElementCodename).getObservable(); }), operators_1.map(function (r) { return multipleChoiceElementResponse = r; }), operators_1.flatMap(function () { return context.deliveryClient.element(typeCodename, taxonomyElementCodename).getObservable(); }), operators_1.map(function (r) { return taxonomyElementResponse = r; }))
.subscribe(function () {
done();
});
});
it("element responses should be defined", function () {
expect(textElementResponse).toBeDefined();
expect(multipleChoiceElementResponse).toBeDefined();
expect(taxonomyElementResponse).toBeDefined();
});
it("element inside responses should be defined", function () {
expect(textElementResponse.element).toBeDefined();
expect(multipleChoiceElementResponse.element).toBeDefined();
expect(taxonomyElementResponse.element).toBeDefined();
});
it("element taxonomy field should contain valid taxonomy group property", function () {
expect(taxonomyElementResponse.element.taxonomyGroup).toBeDefined();
expect(taxonomyElementResponse.element.taxonomyGroup).toEqual(jasmine.any(String));
});
it("multiple choice field should contain options", function () {
expect(multipleChoiceElementResponse.element.options).toBeDefined();
expect(multipleChoiceElementResponse.element.options.length).toBeGreaterThan(0);
});
it("element field should have all required properties defined", function () {
expect(textElementResponse.element.codename).toBeDefined();
expect(textElementResponse.element.name).toBeDefined();
expect(textElementResponse.element.type).toBeDefined();
});
});
//# sourceMappingURL=live-element.spec.js.map
;