diff --git a/lib/client/imanagement-client.interface.ts b/lib/client/imanagement-client.interface.ts index 6f23113..3541b12 100644 --- a/lib/client/imanagement-client.interface.ts +++ b/lib/client/imanagement-client.interface.ts @@ -67,6 +67,7 @@ import { ListLanguageVariantsOfContentTypeQuery, ListLanguageVariantsOfContentTypeWithComponentsQuery, ListLanguageVariantsOfItemQuery, + ListLanguageVariantsBySpaceQuery, ListSpacesQuery, ListTaxonomiesQuery, ListLegacyWebhooksQuery, @@ -570,7 +571,7 @@ export interface IManagementClient { /** * Query to modify asset folders */ - modifyAssetFolders(): DataQuery; + modifyAssetFolders(): DataQuery; /** * Query to list collections @@ -582,6 +583,11 @@ export interface IManagementClient { */ listLanguageVariantsByCollection(): CollectionIdentifierQuery; + /** + * Query to list language variants of given space + */ + listLanguageVariantsBySpace(): SpaceIdentifierQuery; + /** * Query to set collections */ diff --git a/lib/client/management-client.class.ts b/lib/client/management-client.class.ts index 0ffc53b..ee3037c 100644 --- a/lib/client/management-client.class.ts +++ b/lib/client/management-client.class.ts @@ -64,6 +64,7 @@ import { ListLanguageVariantsOfContentTypeQuery, ListLanguageVariantsOfContentTypeWithComponentsQuery, ListLanguageVariantsOfItemQuery, + ListLanguageVariantsBySpaceQuery, ListTaxonomiesQuery, ListWebhooksQuery, ListLegacyWebhooksQuery, @@ -955,6 +956,16 @@ export class ManagementClient implements IManagementClient { ); } + listLanguageVariantsBySpace(): SpaceIdentifierQuery { + return new SpaceIdentifierQuery( + this.config, + this.queryService, + (config, queryService, identifier) => + new ListLanguageVariantsBySpaceQuery(config, queryService, identifier) + ); + } + + listLanguageVariantsOfContentTypeWithComponents(): ContentTypeCodenameAndIdIdentifierQuery { return new ContentTypeCodenameAndIdIdentifierQuery( this.config, @@ -1102,8 +1113,8 @@ export class ManagementClient implements IManagementClient { ); } - modifyAssetFolders(): DataQuery { - return new DataQuery( + modifyAssetFolders(): DataQuery { + return new DataQuery( this.config, this.queryService, (config, queryService, data) => new ModifyAssetFoldersQuery(config, queryService, data) diff --git a/lib/contracts/language-variant-contracts.ts b/lib/contracts/language-variant-contracts.ts index 9ee0663..577e898 100644 --- a/lib/contracts/language-variant-contracts.ts +++ b/lib/contracts/language-variant-contracts.ts @@ -37,6 +37,11 @@ export namespace LanguageVariantContracts { pagination: SharedContracts.IPaginationModelContract; } + export interface IListLanguageVariantsBySpaceResponseContract { + variants: ILanguageVariantModelContract[]; + pagination: SharedContracts.IPaginationModelContract; + } + export interface IListLanguageVariantsOfContentTypeResponseContract { variants: ILanguageVariantModelContract[]; pagination: SharedContracts.IPaginationModelContract; diff --git a/lib/contracts/space-contracts.ts b/lib/contracts/space-contracts.ts index ff2e4da..e52ddcd 100644 --- a/lib/contracts/space-contracts.ts +++ b/lib/contracts/space-contracts.ts @@ -5,6 +5,7 @@ export namespace SpaceContracts { name: string; codename: string; web_spotlight_root_item?: SharedContracts.IReferenceObjectContract; + collections?: SharedContracts.IReferenceObjectContract[]; } export type ISpacesListingResponseContract = ISpaceContract[]; @@ -27,5 +28,6 @@ export namespace SpaceContracts { name: string; codename: string; webSpotlightRootItem?: SharedContracts.IReferenceObjectContract; + collections?: SharedContracts.IReferenceObjectContract; } } diff --git a/lib/mappers/language-variant-mapper.ts b/lib/mappers/language-variant-mapper.ts index 2c36307..eea5076 100644 --- a/lib/mappers/language-variant-mapper.ts +++ b/lib/mappers/language-variant-mapper.ts @@ -56,6 +56,21 @@ export class LanguageVariantMapper extends BaseMapper { ); } + mapLanguageVariantsBySpaceResponse( + response: IResponse + ): LanguageVariantResponses.ListLanguageVariantsBySpaceResponse { + const variants = response.data.variants.map((m) => this.mapLanguageVariant(m)); + return new LanguageVariantResponses.ListLanguageVariantsBySpaceResponse( + super.mapResponseDebug(response), + response.data, + { + items: variants, + pagination: super.mapPagination(response.data.pagination) + } + ); + } + + mapLanguageVariantsOfContentTypeResponse( response: IResponse ): LanguageVariantResponses.ListLanguageVariantsOfContentTypeResponse { @@ -70,6 +85,8 @@ export class LanguageVariantMapper extends BaseMapper { ); } + + mapLanguageVariantsOfContentTypeWithComponentsResponse( response: IResponse ): LanguageVariantResponses.ListLanguageVariantsOfContentTypeWithComponentsResponse { diff --git a/lib/mappers/space-mapper.ts b/lib/mappers/space-mapper.ts index c457dcf..7f22ab4 100644 --- a/lib/mappers/space-mapper.ts +++ b/lib/mappers/space-mapper.ts @@ -48,6 +48,7 @@ export class SpacesMapper extends BaseMapper { id: rawItem.id, name: rawItem.name, webSpotlightRootItem: rawItem.web_spotlight_root_item, + collections: rawItem.collections, _raw: rawItem }); } diff --git a/lib/models/asset-folders/asset-folder.models.ts b/lib/models/asset-folders/asset-folder.models.ts index 342829e..0acf10c 100644 --- a/lib/models/asset-folders/asset-folder.models.ts +++ b/lib/models/asset-folders/asset-folder.models.ts @@ -2,7 +2,6 @@ import { AssetFolderContracts } from '../../contracts'; import { SharedModels } from '../shared/shared-models'; export namespace AssetFolderModels { - export class AssetFolder implements SharedModels.IBaseModel { public id: string; public name: string; @@ -25,30 +24,43 @@ export namespace AssetFolderModels { } } - export interface IAddOrModifyAssetFolderData { + export interface IAssetFolderValue { name: string; - folders: IAddOrModifyAssetFolderData[]; + folders: IAssetFolderValue[]; external_id?: string; } export interface IAddAssetFoldersData { - folders: IAddOrModifyAssetFolderData[]; + folders: IAssetFolderValue[]; } - export interface IModifyAssetFoldersData { - op: 'addInto' | 'remove' | 'rename'; - value?: IAddOrModifyAssetFolderData; - after?: { - external_id?: string; + export type IModifyAssetFolderData = AddIntoOperation | RemoveOperation | RenameOperation; + + export type AddIntoOperation = { + op: 'addInto'; + reference?: { id?: string; + external_id?: string; }; + value: IAssetFolderValue; before?: { - external_id?: string; id?: string; - }; - reference?: { external_id?: string; + }; + after?: { id?: string; + external_id?: string; }; - } + }; + + export type RemoveOperation = { + op: 'remove'; + reference: SharedModels.ReferenceObject; + }; + + export type RenameOperation = { + op: 'rename'; + reference: SharedModels.ReferenceObject; + value: string; + }; } diff --git a/lib/models/content-management-api-endpoints.ts b/lib/models/content-management-api-endpoints.ts index fecbd0a..d68366f 100644 --- a/lib/models/content-management-api-endpoints.ts +++ b/lib/models/content-management-api-endpoints.ts @@ -217,6 +217,11 @@ export class ContentManagementApiEndpoints { listLanguageVariantsByCollection(identifier: Identifiers.CollectionIdentifier): string { return `${this.getEnvironmentsPath()}/collections/${identifier.getParamValue()}/variants`; } + + listLanguageVariantsBySpace(identifier: Identifiers.SpaceIdentifier): string { + return `${this.getEnvironmentsPath()}/spaces/${identifier.getParamValue()}/variants`; + } + listLanguageVariantsOfContentTypeWithComponents(identifier: Identifiers.ContentTypeIdentifier): string { return `${this.getEnvironmentsPath()}/types/${identifier.getParamValue()}/components`; diff --git a/lib/models/spaces/space.models.ts b/lib/models/spaces/space.models.ts index eb0bcde..1303a44 100644 --- a/lib/models/spaces/space.models.ts +++ b/lib/models/spaces/space.models.ts @@ -14,6 +14,7 @@ export namespace SpaceModels { name: string; codename?: string; web_spotlight_root_item?: SharedContracts.IReferenceObjectContract; + collections?: SharedContracts.IReferenceObjectContract[]; } export class Space implements SharedModels.IBaseModel { @@ -21,6 +22,7 @@ export namespace SpaceModels { public name!: string; public codename!: string; public webSpotlightRootItem?: SharedModels.ReferenceObject; + public collections?: SharedModels.ReferenceObject[]; public _raw!: SpaceContracts.ISpaceContract; constructor(data: { @@ -28,6 +30,7 @@ export namespace SpaceModels { name: string; codename: string; webSpotlightRootItem?: SharedModels.ReferenceObject; + collections?: SharedModels.ReferenceObject[]; _raw: SpaceContracts.ISpaceContract; }) { Object.assign(this, data); diff --git a/lib/models/workflow/workflow.models.ts b/lib/models/workflow/workflow.models.ts index 54f3f08..4b7030d 100644 --- a/lib/models/workflow/workflow.models.ts +++ b/lib/models/workflow/workflow.models.ts @@ -58,6 +58,7 @@ export namespace WorkflowModels { * If you do not provide this property, the specified language variant is published immediately. */ scheduled_to?: string; + display_timezone?: string; } export interface IUnpublishLanguageVarianthData { @@ -66,6 +67,7 @@ export namespace WorkflowModels { * If you do not provide this property, the specified language variant is published immediately. */ scheduled_to?: string; + display_timezone?: string; } export interface IChangeWorkflowOfLanguageVariantData { diff --git a/lib/queries/asset-folders/modify-asset-folders.class.ts b/lib/queries/asset-folders/modify-asset-folders.class.ts index 66d6bf8..33ddf5c 100644 --- a/lib/queries/asset-folders/modify-asset-folders.class.ts +++ b/lib/queries/asset-folders/modify-asset-folders.class.ts @@ -10,7 +10,7 @@ export class ModifyAssetFoldersQuery extends BaseQuery { + constructor( + protected config: IManagementClientConfig, + protected queryService: ManagementQueryService, + protected identifier: Identifiers.SpaceIdentifier + ) { + super(config, queryService); + } + + toPromise(): Promise { + return this.queryService.listLanguageVariantsBySpaceAsync(this.getUrl(), this.queryConfig); + } + + protected getAction(): string { + return this.apiEndpoints.listLanguageVariantsBySpace(this.identifier); + } + + protected allResponseFactory( + items: any[], + responses: LanguageVariantResponses.ListLanguageVariantsBySpaceResponse[] + ): LanguageVariantResponses.ListAllLanguageVariantsBySpaceResponse { + return new LanguageVariantResponses.ListAllLanguageVariantsBySpaceResponse({ + items: items, + responses: responses + }); + } +} diff --git a/lib/responses/language-variants/language-variant-responses.ts b/lib/responses/language-variants/language-variant-responses.ts index 06dd11f..951039f 100644 --- a/lib/responses/language-variants/language-variant-responses.ts +++ b/lib/responses/language-variants/language-variant-responses.ts @@ -79,6 +79,23 @@ export namespace LanguageVariantResponses { } } + export class ListLanguageVariantsBySpaceResponse extends BaseResponses.BaseContentManagementListResponse< + LanguageVariantContracts.IListLanguageVariantsBySpaceResponseContract, + LanguageVariantModels.ContentItemLanguageVariant +> { + constructor( + debug: BaseResponses.IContentManagementResponseDebug, + rawData: LanguageVariantContracts.IListLanguageVariantsBySpaceResponseContract, + data: { + items: LanguageVariantModels.ContentItemLanguageVariant[]; + pagination: SharedModels.Pagination; + } + ) { + super(debug, rawData, data); + } +} + + export class ListAllLanguageVariantsOfContentTypeResponse extends BaseResponses.ContentManagementListAllResponse { constructor( data: { @@ -101,6 +118,18 @@ export namespace LanguageVariantResponses { } } + export class ListAllLanguageVariantsBySpaceResponse extends BaseResponses.ContentManagementListAllResponse { + constructor( + data: { + items: LanguageVariantModels.ContentItemLanguageVariant[], + responses: ListLanguageVariantsBySpaceResponse[] + } + ) { + super(data); + } + } + + export class UpsertLanguageVariantResponse extends BaseResponses.BaseContentManagementResponse< LanguageVariantContracts.IUpsertLanguageVariantResponseContract, LanguageVariantModels.ContentItemLanguageVariant diff --git a/lib/services/management-query-service.class.ts b/lib/services/management-query-service.class.ts index 5cdbfe2..8205681 100644 --- a/lib/services/management-query-service.class.ts +++ b/lib/services/management-query-service.class.ts @@ -843,7 +843,23 @@ export class ManagementQueryService extends BaseManagementQueryService { config ) ); - } + } + + async listLanguageVariantsBySpaceAsync( + url: string, + config: IContentManagementQueryConfig + ): Promise { + return languageVariantMapper.mapLanguageVariantsBySpaceResponse( + await this.getResponseAsync( + url, + {}, + config + ) + ); + } + + + async listLanguagesAsync( url: string, @@ -988,7 +1004,7 @@ export class ManagementQueryService extends BaseManagementQueryService { async modifyAssetFoldersAsync( url: string, config: IContentManagementQueryConfig, - data: AssetFolderModels.IModifyAssetFoldersData[] + data: AssetFolderModels.IModifyAssetFolderData[] ): Promise { return assetFolderMapper.mapModifyAssetFoldersResponse( await this.patchResponseAsync( diff --git a/test/browser/asset-folders/modify-asset-folders.spec.ts b/test/browser/asset-folders/modify-asset-folders.spec.ts index 6ca975a..299ef4c 100644 --- a/test/browser/asset-folders/modify-asset-folders.spec.ts +++ b/test/browser/asset-folders/modify-asset-folders.spec.ts @@ -5,33 +5,50 @@ import { cmLiveClient, getTestClientWithJson, testEnvironmentId } from '../setup describe('Modify asset folders', () => { let response: AssetFolderResponses.ModifyAssetFoldersResponse; - beforeAll(async () => { + beforeAll(async () => { response = await getTestClientWithJson(responseJson) .modifyAssetFolders() - .withData([{ - // required - op: 'addInto', - value: { - name: 'x', - folders: [] + .withData([ + { + // required + op: 'addInto', + value: { + name: 'x', + folders: [] + }, + // optional + after: { + id: 'x' + }, + before: { + external_id: 'y' + }, + reference: { + external_id: 'c' + } }, - // optional - after: { - id: 'x' + { + op: 'remove', + reference: { + codename: 'x' + } }, - before: { - external_id: 'y' - }, - reference: { - external_id: 'c' - }, - }]) - .toPromise() - ; + { + op: 'rename', + value: 'y', + reference: { + codename: 'x' + } + } + ]) + .toPromise(); }); it(`url should be correct`, () => { - const listUrl = cmLiveClient.modifyAssetFolders().withData({} as any).getUrl(); + const listUrl = cmLiveClient + .modifyAssetFolders() + .withData({} as any) + .getUrl(); expect(listUrl).toEqual(`https://manage.kontent.ai/v2/projects/${testEnvironmentId}/folders`); }); @@ -58,9 +75,9 @@ describe('Modify asset folders', () => { expect(Array.isArray(response.data.items)).toBeTruthy(); expect(response.data.items.length).toBeGreaterThan(0); - response.data.items.forEach(m => { + response.data.items.forEach((m) => { // find original item - const originalItem = responseJson.folders.find(s => s.id === m.id); + const originalItem = responseJson.folders.find((s) => s.id === m.id); if (!originalItem) { throw Error(`Asset folder with id '${m.id}' was not found in fake response`); @@ -73,7 +90,7 @@ describe('Modify asset folders', () => { expect(m.folders).toEqual(jasmine.any(Array)); for (const nestedFolder of m.folders) { - const originalNestedFolder = originalItem.folders.find(s => s.id === nestedFolder.id); + const originalNestedFolder = originalItem.folders.find((s) => s.id === nestedFolder.id); if (!originalNestedFolder) { throw Error(`Nested Asset folder with id '${m.id}' was not found in fake response`); diff --git a/test/browser/fake-responses/language-variants/fake-list-language-variants-by-space.json b/test/browser/fake-responses/language-variants/fake-list-language-variants-by-space.json new file mode 100644 index 0000000..0134a78 --- /dev/null +++ b/test/browser/fake-responses/language-variants/fake-list-language-variants-by-space.json @@ -0,0 +1,43 @@ +{ + "variants": [ + { + "elements": [ + { + "element": { + "id": "c7c3b834-2222-5677-89c4-b46f04489109" + }, + "value": "Text element value" + }, + { + "mode": "custom", + "element": { + "id": "53a5eecb-f295-59b4-a07d-19655b6ad860" + }, + "value": "custom-url-slug-value" + } + ], + "workflow": { + "workflow_identifier": { + "id": "06ea628e-4ec7-4991-91e4-1412995151ee" + }, + "step_identifier": { + "id": "dc87d7cf-424b-4b89-9519-c9f79a3458b7" + } + }, + "workflow_step": { + "id": "dc87d7cf-424b-4b89-9519-c9f79a3458b7" + }, + "item": { + "id": "82ef61f4-ccee-42ac-95e2-1a44beda9625" + }, + "language": { + "id": "00000000-0000-0000-0000-000000000000" + }, + "last_modified": "2020-02-27T19:08:25.404Z" + } + ], + "pagination": { + "continuation_token": "W3sidG9rZW4iOiIrUklEOn...", + "next_page": "https://manage.kontent.ai/v2/your/chosen/list/endpoint" + } + } \ No newline at end of file diff --git a/test/browser/fake-responses/spaces/fake-add-space.json b/test/browser/fake-responses/spaces/fake-add-space.json index f5ddb8d..d393285 100644 --- a/test/browser/fake-responses/spaces/fake-add-space.json +++ b/test/browser/fake-responses/spaces/fake-add-space.json @@ -4,6 +4,11 @@ "codename": "space_1", "web_spotlight_root_item": { "id": "09d5a63a-49a9-4b77-9e18-54a05441483e" - } + }, + "collections": [ + { + "id":"00000000-0000-0000-0000-000000000000" + } + ] } \ No newline at end of file diff --git a/test/browser/fake-responses/spaces/fake-list-spaces.json b/test/browser/fake-responses/spaces/fake-list-spaces.json index 3d916a6..3d05f74 100644 --- a/test/browser/fake-responses/spaces/fake-list-spaces.json +++ b/test/browser/fake-responses/spaces/fake-list-spaces.json @@ -5,6 +5,13 @@ "codename": "space_1", "web_spotlight_root_item": { "id": "09d5a63a-49a9-4b77-9e18-54a05441483e" - } + }, + "collections": [ + { + "id":"00000000-0000-0000-0000-000000000000" + } + ] + + } ] \ No newline at end of file diff --git a/test/browser/fake-responses/spaces/fake-modify-space.json b/test/browser/fake-responses/spaces/fake-modify-space.json index 093ae9a..4bc3184 100644 --- a/test/browser/fake-responses/spaces/fake-modify-space.json +++ b/test/browser/fake-responses/spaces/fake-modify-space.json @@ -4,6 +4,12 @@ "codename": "space_1", "web_spotlight_root_item": { "id":"09d5a63a-49a9-4b77-9e18-54a05441483e" - } + }, + "collections": [ + { + "id":"00000000-0000-0000-0000-000000000000" + } + ] + } \ No newline at end of file diff --git a/test/browser/fake-responses/spaces/fake-view-space.json b/test/browser/fake-responses/spaces/fake-view-space.json index d178670..5bac24a 100644 --- a/test/browser/fake-responses/spaces/fake-view-space.json +++ b/test/browser/fake-responses/spaces/fake-view-space.json @@ -4,6 +4,12 @@ "codename": "space_1", "web_spotlight_root_item": { "id": "09d5a63a-49a9-4b77-9e18-54a05441483e" - } + }, + "collections": [ + { + "id":"00000000-0000-0000-0000-000000000000" + } + ] + } \ No newline at end of file diff --git a/test/browser/language-variants/list-language-variants-by-space.spec.ts b/test/browser/language-variants/list-language-variants-by-space.spec.ts new file mode 100644 index 0000000..7354dca --- /dev/null +++ b/test/browser/language-variants/list-language-variants-by-space.spec.ts @@ -0,0 +1,82 @@ +import { ElementModels, LanguageVariantResponses, SharedModels } from '../../../lib'; +import * as responseJson from '../fake-responses/language-variants/fake-list-language-variants-by-Space.json'; +import { cmLiveClient, getTestClientWithJson, testEnvironmentId } from '../setup'; + +describe('List language variants by space', () =>{ + let response: LanguageVariantResponses.ListLanguageVariantsBySpaceResponse; + + beforeAll(async () => { + response = await getTestClientWithJson(responseJson) + .listLanguageVariantsBySpace() + .bySpaceCodename('xCodename') + .toPromise(); + }); + + it(`url should be correct`, () => { + const codenameUrl = cmLiveClient.listLanguageVariantsBySpace().bySpaceCodename('xCodename').getUrl(); + const idUrl = cmLiveClient.listLanguageVariantsBySpace().bySpaceId('xId').getUrl(); + + expect(codenameUrl).toEqual( + `https://manage.kontent.ai/v2/projects/${testEnvironmentId}/spaces/codename/xCodename/variants` + ); + expect(idUrl).toEqual(`https://manage.kontent.ai/v2/projects/${testEnvironmentId}/spaces/xId/variants`); + }); + + it(`response should be instance of ListLanguageVariantsBySpaceResponse class`, () => { + expect(response).toEqual(jasmine.any(LanguageVariantResponses.ListLanguageVariantsBySpaceResponse)); + }); + + it(`response should contain debug data`, () => { + expect(response.debug).toBeDefined(); + }); + + it(`response should contain data`, () => { + expect(response.data).toBeDefined(); + expect(response.data.items).toBeDefined(); + }); + + it(`item properties should be mapped`, () => { + expect(response.data.items).toBeDefined(); + expect(response.data.items.length).toEqual(responseJson.variants.length); + expect(response.data.pagination).toEqual(jasmine.any(SharedModels.Pagination)); + + response.data.items.forEach((variant) => { + const originalItem = responseJson.variants.find((m) => m.item.id === variant.item.id); + + if (!originalItem) { + throw Error(`Could not find original item with id '${variant.item.id}'`); + } + + expect(variant.item).toBeDefined(); + expect(variant.language).toBeDefined(); + expect(variant.elements).toBeDefined(); + expect(variant.lastModified).toEqual(jasmine.any(Date)); + expect(variant.workflow.workflowIdentifier).toBeDefined(); + expect(variant.workflow.stepIdentifier.id).toEqual(originalItem.workflow.step_identifier.id); + expect(variant.workflow.workflowIdentifier.id).toEqual(originalItem.workflow.workflow_identifier.id); + + expect(variant.item).toEqual(jasmine.any(SharedModels.ReferenceObject)); + expect(variant.language).toEqual(jasmine.any(SharedModels.ReferenceObject)); + + variant.elements.forEach((element) => { + const originalElement = originalItem.elements.find((m) => m.element.id === element.element.id); + + expect(element).toEqual(jasmine.any(ElementModels.ContentItemElement)); + + if (!originalElement) { + throw Error(`Original element with id '${element.element.id}' was not found`); + } + + if (Array.isArray(element.value)) { + element.value.forEach((elementReference) => { + expect(elementReference).toEqual(jasmine.any(SharedModels.ReferenceObject)); + }); + } else { + expect(element.value).toEqual(originalElement.value as string | number); + } + }); + }); + }); +}); + + diff --git a/test/browser/spaces/add-space.spec.ts b/test/browser/spaces/add-space.spec.ts index e603cda..c700035 100644 --- a/test/browser/spaces/add-space.spec.ts +++ b/test/browser/spaces/add-space.spec.ts @@ -12,11 +12,15 @@ describe('Add space', () => { codename: 'My_Workflow', web_spotlight_root_item: { codename: 'my_root_item' + }, + collections: [ + { + id: '00000000-0000-0000-0000-000000000000' } + ] }) .toPromise(); }); - it(`url should be correct`, () => { const url = cmLiveClient .addSpace() @@ -40,10 +44,10 @@ describe('Add space', () => { it('space properties should be mapped', () => { const originalItem = responseJson; const space = response.data; - expect(space.codename).toEqual(originalItem.codename); expect(space.name).toEqual(originalItem.name); expect(space.id).toBeDefined(); - expect(space.webSpotlightRootItem).toBeDefined(); + expect(space.webSpotlightRootItem).toEqual(originalItem.web_spotlight_root_item); + expect(space.collections).toEqual(originalItem.collections) }); }); diff --git a/test/browser/spaces/list-spaces.spec.ts b/test/browser/spaces/list-spaces.spec.ts index 206627c..c36b17d 100644 --- a/test/browser/spaces/list-spaces.spec.ts +++ b/test/browser/spaces/list-spaces.spec.ts @@ -41,7 +41,8 @@ describe('List spaces', () => { expect(space).toEqual(jasmine.any(SpaceModels.Space)); expect(space.codename).toEqual(originalItem.codename); expect(space.name).toEqual(originalItem.name); - expect(space.webSpotlightRootItem).toBeDefined(); + expect(space.webSpotlightRootItem).toEqual(originalItem.web_spotlight_root_item); + expect(space.collections).toEqual(originalItem.collections); }); }); }); diff --git a/test/browser/spaces/modify-space.spec.ts b/test/browser/spaces/modify-space.spec.ts index dce74cd..ab4215f 100644 --- a/test/browser/spaces/modify-space.spec.ts +++ b/test/browser/spaces/modify-space.spec.ts @@ -44,5 +44,9 @@ describe('Modify space', () => { expect(space.codename).toEqual(originalItem.codename); expect(space.name).toEqual(originalItem.name); + expect(space.id).toBeDefined(); + expect(space.webSpotlightRootItem).toEqual(originalItem.web_spotlight_root_item); + expect(space.collections).toEqual(originalItem.collections); + }); }); diff --git a/test/browser/spaces/view-space.spec.ts b/test/browser/spaces/view-space.spec.ts index af743f9..95d6b80 100644 --- a/test/browser/spaces/view-space.spec.ts +++ b/test/browser/spaces/view-space.spec.ts @@ -32,9 +32,11 @@ describe('View space', () => { it(`space properties should be mapped`, () => { const originalItem = viewSpaceJson; const Space = response.data; - expect(Space).toEqual(jasmine.any(SpaceModels.Space)); expect(Space.codename).toEqual(originalItem.codename); expect(Space.name).toEqual(originalItem.name); + expect(Space.webSpotlightRootItem).toEqual(originalItem.web_spotlight_root_item); + expect(Space.collections).toEqual(originalItem.collections); + }); }); diff --git a/test/browser/webhook/get-webhook.spec.ts b/test/browser/webhook/get-webhook.spec.ts index ad2201a..4a206b5 100644 --- a/test/browser/webhook/get-webhook.spec.ts +++ b/test/browser/webhook/get-webhook.spec.ts @@ -7,7 +7,6 @@ describe('Get webhook', () => { beforeAll(async () => { response = await getTestClientWithJson(responseJson).getWebhook().byId('x').toPromise(); - console.log(response); }); it(`url should be correct`, () => { diff --git a/test/browser/workflow/publish-language-variant.spec.ts b/test/browser/workflow/publish-language-variant.spec.ts index a198310..d6e5ca4 100644 --- a/test/browser/workflow/publish-language-variant.spec.ts +++ b/test/browser/workflow/publish-language-variant.spec.ts @@ -18,7 +18,8 @@ describe('Publish language variant', () => { .byItemCodename('x') .byLanguageCodename('y') .withData({ - scheduled_to: '2019-01-31T11:00:00+01:00' + scheduled_to: '2019-01-31T11:00:00+01:00', + display_timezone: 'Australia/Sydney' }); response = await query.toPromise(); diff --git a/test/browser/workflow/unpublish-language-version.spec.ts b/test/browser/workflow/unpublish-language-version.spec.ts index 4835584..20c593b 100644 --- a/test/browser/workflow/unpublish-language-version.spec.ts +++ b/test/browser/workflow/unpublish-language-version.spec.ts @@ -11,7 +11,8 @@ describe('Unpublish a language version', () => { .byItemCodename('x') .byLanguageCodename('y') .withData({ - scheduled_to: '2019-01-31T11:00:00+01:00' + scheduled_to: '2019-01-31T11:00:00+01:00', + display_timezone: "Australia/Sydney" }); response = await query.toPromise();