UNPKG

kentico-cloud-delivery

Version:

Official Kentico Cloud Delivery SDK

45 lines 2.09 kB
"use strict"; exports.__esModule = true; var setup_1 = require("../../setup"); describe('Live taxonomy', function () { var context = new setup_1.Context(); setup_1.setup(context); var taxonomyCodename = 'movietype'; var termsWithNestedTermsCodename = 'film'; // codename of the taxonomy term that has nested terms var numberOfNestedTerms = 3; // this is the number of nested terms defined by 'termsWithNestedTermsCodename' var response; beforeAll(function (done) { context.deliveryClient.taxonomy(taxonomyCodename) .getObservable() .subscribe(function (r) { response = r; done(); }); }); it("taxomy should be defined", function () { expect(response.taxonomy).toBeDefined(); }); it("taxomy system attributes should be defined", function () { expect(response.taxonomy.system).toBeDefined(); expect(response.taxonomy.system.codename).toBeDefined(); expect(response.taxonomy.system.id).toBeDefined(); expect(response.taxonomy.system.lastModified).toBeDefined(); expect(response.taxonomy.system.name).toBeDefined(); }); it("taxonomy group should match requested type", function () { expect(response.taxonomy.system.codename).toEqual(taxonomyCodename); }); it("taxonomy group should have defined terms", function () { expect(response.taxonomy.terms).toBeDefined(); }); it("taxonomy group should have > 0 terms", function () { expect(response.taxonomy.terms.length).toBeGreaterThan(0); }); it("taxonomy group should contain nested taxonomies", function () { var termsWithNestedTerms = response.taxonomy.terms.find(function (m) { return m.codename === termsWithNestedTermsCodename; }); expect(termsWithNestedTerms).toBeDefined(); expect(termsWithNestedTerms.terms).toBeDefined(); expect(termsWithNestedTerms.terms.length).toEqual(numberOfNestedTerms); }); }); //# sourceMappingURL=live-taxonomy.spec.js.map