Changeset 0.37.14 (#226)
Co-authored-by: gobha <jasafpro@gmail.com> Co-committed-by: gobha <jasafpro@gmail.com>
This commit is contained in:
@@ -394,6 +394,66 @@
|
||||
}
|
||||
}
|
||||
|
||||
// ── Channel Types (group, channel) ──
|
||||
var groupChId = null;
|
||||
await T.test('crud', 'channels', 'POST /channels (type=group)', async function () {
|
||||
var d = await T.apiPost('/channels', {
|
||||
title: testTag + '-group',
|
||||
type: 'group',
|
||||
description: 'ICD group test'
|
||||
});
|
||||
T.assertShape(d, T.S.channelFull, 'group channel');
|
||||
T.assert(d.type === 'group', 'type should be group, got: ' + d.type);
|
||||
groupChId = d.id;
|
||||
T.registerCleanup(function () { if (groupChId) return T.safeDelete('/channels/' + groupChId); });
|
||||
});
|
||||
|
||||
var teamChId = null;
|
||||
await T.test('crud', 'channels', 'POST /channels (type=channel)', async function () {
|
||||
var d = await T.apiPost('/channels', {
|
||||
title: testTag + '-team-channel',
|
||||
type: 'channel',
|
||||
description: 'ICD channel test'
|
||||
});
|
||||
T.assertShape(d, T.S.channelFull, 'team channel');
|
||||
T.assert(d.type === 'channel', 'type should be channel, got: ' + d.type);
|
||||
teamChId = d.id;
|
||||
T.registerCleanup(function () { if (teamChId) return T.safeDelete('/channels/' + teamChId); });
|
||||
});
|
||||
|
||||
// ── Multi-type filter ──
|
||||
await T.test('crud', 'channels', 'GET /channels?types=group,channel (multi)', async function () {
|
||||
var d = await T.apiGet('/channels?types=group,channel&per_page=50');
|
||||
var arr = d.data || [];
|
||||
T.assert(Array.isArray(arr), 'expected data array');
|
||||
arr.forEach(function (ch) {
|
||||
T.assert(ch.type === 'group' || ch.type === 'channel',
|
||||
'multi-type filter leaked: ' + ch.type);
|
||||
});
|
||||
});
|
||||
|
||||
await T.test('crud', 'channels', 'GET /channels?types=direct,dm,group,channel (all)', async function () {
|
||||
var d = await T.apiGet('/channels?types=direct,dm,group,channel&per_page=50');
|
||||
var arr = d.data || [];
|
||||
T.assert(Array.isArray(arr), 'expected data array');
|
||||
var types = new Set(arr.map(function (ch) { return ch.type; }));
|
||||
T.assert(types.size <= 4, 'should only contain known types');
|
||||
});
|
||||
|
||||
// Cleanup channel types
|
||||
if (groupChId) {
|
||||
await T.test('crud', 'channels', 'DELETE /channels/:id (group cleanup)', async function () {
|
||||
await T.safeDelete('/channels/' + groupChId);
|
||||
groupChId = null;
|
||||
});
|
||||
}
|
||||
if (teamChId) {
|
||||
await T.test('crud', 'channels', 'DELETE /channels/:id (channel cleanup)', async function () {
|
||||
await T.safeDelete('/channels/' + teamChId);
|
||||
teamChId = null;
|
||||
});
|
||||
}
|
||||
|
||||
// ── Folders CRUD + Channel Assignment ──
|
||||
var folderId = null;
|
||||
await T.test('crud', 'channels', 'POST /folders (create)', async function () {
|
||||
|
||||
Reference in New Issue
Block a user