kentico-cloud-delivery
Version:
Official Kentico Cloud Delivery SDK
73 lines • 3.04 kB
JavaScript
exports.__esModule = true;
var lib_1 = require("../../../lib");
var setup_1 = require("../../setup");
describe('Isolated item', function () {
var context = new setup_1.Context();
setup_1.setup(context);
var mockQueryService = new setup_1.MockQueryService(context.getConfig(), new lib_1.DeliveryHttpService(), {
host: lib_1.sdkInfo.host,
name: lib_1.sdkInfo.name,
version: lib_1.sdkInfo.version
});
var response;
beforeAll(function (done) {
response = mockQueryService.mockGetSingleItem(setup_1.warriorMovieJson, {});
done();
});
it("checks system codename", function () {
expect(response.item.system.codename).toEqual('warrior');
});
it("checks system id", function () {
expect(response.item.system.id).toEqual('325e2acb-1c14-47f6-af9a-27bc8b6c16fe');
});
it("checks system type", function () {
expect(response.item.system.type).toEqual('movie');
});
it("checks last modified", function () {
expect(response.item.system.lastModified.toString()).toEqual('2017-06-21T12:22:09.1437891Z');
});
it("checks language", function () {
expect(response.item.system.language).toEqual('en');
});
it("checks site map locations", function () {
var locations = [
'main_sitemap'
];
expect(response.item.system.sitemapLocations).toEqual(locations);
});
it("checks taxonomy field", function () {
expect(response.item.releaseCategory.taxonomyTerms[0].codename).toEqual('global_release');
});
it("checks text field", function () {
expect(response.item.title.text).toEqual('Warrior');
});
it("checks datetime field", function () {
expect(response.item.released.datetime).toEqual(new Date('2011-09-09T00:00:00Z'));
});
it("checks Nunmber field", function () {
expect(response.item.length.number).toEqual(151);
});
it("checks url slug field", function () {
expect(response.item.seoname.getUrl()).toEqual('testSlugUrl/warrior');
});
it("checks assets field", function () {
expect(response.item.stars.length).toEqual(2);
});
it("checks that modular items are defined", function () {
expect(response.item.stars).toBeDefined();
});
it("checks that correct number of modular items are created", function () {
expect(response.item.stars.length).toEqual(2);
});
it("checks that modular items are of proper type", function () {
expect(response.item.stars[0]).toEqual(jasmine.any(setup_1.Actor));
});
it("checks that text field in first modular item is set", function () {
expect(response.item.stars[0].firstName.text).toEqual('Tom');
});
it("checks that text field in second modular item is set", function () {
expect(response.item.stars[1].firstName.text).toEqual('Joel');
});
});
//# sourceMappingURL=item.spec.js.map
;