kentico-cloud-delivery
Version:
Official Kentico Cloud Delivery SDK
38 lines • 1.68 kB
JavaScript
import { Fields, sdkInfo, DeliveryHttpService } from '../../../lib';
import { Actor, Context, MockQueryService, setup, warriorMovieJson } from '../../setup';
describe('Field types', function () {
var context = new Context();
setup(context);
var mockQueryService = new MockQueryService(context.getConfig(), new DeliveryHttpService(), {
host: sdkInfo.host,
name: sdkInfo.name,
version: sdkInfo.version
});
var response;
beforeAll(function (done) {
response = mockQueryService.mockGetSingleItem(warriorMovieJson, {});
done();
});
it("check 'TextField' type", function () {
expect(response.item.title).toEqual(jasmine.any(Fields.TextField));
});
it("check 'RichTextField' type", function () {
expect(response.item.plot).toEqual(jasmine.any(Fields.RichTextField));
});
it("check 'DateTimeField' type", function () {
expect(response.item.released).toEqual(jasmine.any(Fields.DateTimeField));
});
it("check 'NumberField' type", function () {
expect(response.item.length).toEqual(jasmine.any(Fields.NumberField));
});
it("check 'MultipleChoiceField' type", function () {
expect(response.item.category).toEqual(jasmine.any(Fields.MultipleChoiceField));
});
it("check that 'stars' property contains objects of 'Actor' type", function () {
expect(response.item.stars[0]).toEqual(jasmine.any(Actor));
});
it("check 'UrlSlugField' type", function () {
expect(response.item.seoname).toEqual(jasmine.any(Fields.UrlSlugField));
});
});
//# sourceMappingURL=field-types.spec.js.map