mattermost-mobile-upstream/app/client/rest/properties.test.ts
Devin Binnie daec2522f3
[MM-68255] Enable mobile support for Managed Categories (#9683)
* [MM-68255] Enable mobile support for Managed Categories

* Fix error handling

* More feedback

* Move function to correct file

* PR feedback

* Some changes

* Feedback
2026-04-16 10:01:51 -04:00

41 lines
1.5 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import TestHelper from '@test/test_helper';
import type ClientBase from './base';
import type {ClientPropertiesMix} from './properties';
describe('ClientProperties', () => {
let client: ClientPropertiesMix & ClientBase;
beforeAll(() => {
client = TestHelper.createClient();
client.doFetch = jest.fn();
});
test('getPropertyValues', async () => {
const groupName = 'managed_channel_categories';
const objectType = 'channel';
const targetId = 'channel_id_1';
const expectedUrl = `${client.urlVersion}/properties/groups/${groupName}/${objectType}/values/${targetId}`;
const expectedOptions = {method: 'get'};
await client.getPropertyValues<string>(groupName, objectType, targetId);
expect(client.doFetch).toHaveBeenCalledWith(expectedUrl, expectedOptions);
});
test('getPropertyFields', async () => {
const groupName = 'managed_channel_categories';
const objectType = 'channel';
const targetType = 'system';
const expectedUrl = `${client.urlVersion}/properties/groups/${groupName}/${objectType}/fields?target_type=${targetType}`;
const expectedOptions = {method: 'get'};
await client.getPropertyFields(groupName, objectType, targetType);
expect(client.doFetch).toHaveBeenCalledWith(expectedUrl, expectedOptions);
});
});