Last active
October 8, 2020 11:50
-
-
Save jonurry/2dd301097b892173a31b3879957e1c22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.url = '/conversations.list'; | |
exports.method = 'get'; | |
exports.validateInput = false; | |
exports.additionalMocks = [ | |
{ | |
method: 'get', | |
url: '/users.list', | |
response: { | |
ok: true, | |
members: [ | |
{ | |
id: 'USER_ID', | |
name: 'username', | |
real_name: 'First Last', | |
}, | |
], | |
}, | |
}, | |
{ | |
method: 'get', | |
url: '/conversations.list', | |
expect: { | |
request: { | |
query: { | |
limit: '1000', | |
types: 'public_channel', | |
token: '123', | |
}, | |
}, | |
}, | |
response: { | |
ok: true, | |
channels: [ | |
{ | |
id: 'C024Q2C1P', | |
name: 'engineering', | |
is_channel: true, | |
is_group: false, | |
is_im: false, | |
created: 1389392606, | |
is_archived: false, | |
is_general: false, | |
unlinked: 0, | |
name_normalized: 'engineering', | |
is_shared: false, | |
parent_conversation: null, | |
creator: 'U024Q5PFC', | |
is_ext_shared: false, | |
is_org_shared: false, | |
shared_team_ids: ['T024Q5PFA'], | |
pending_shared: [], | |
pending_connected_team_ids: [], | |
is_pending_ext_shared: false, | |
is_member: true, | |
is_private: false, | |
is_mpim: false, | |
topic: { | |
value: 'almost zero downtime', | |
creator: 'U069TEU7L', | |
last_set: 1559234874, | |
}, | |
purpose: { | |
value: 'Talk about all things technical', | |
creator: 'U024Q5PFC', | |
last_set: 1400595281, | |
}, | |
previous_names: [], | |
num_members: 106, | |
}, | |
], | |
}, | |
}, | |
{ | |
method: 'get', | |
url: '/conversations.list', | |
expect: { | |
request: { | |
query: { | |
limit: '1000', | |
types: 'private_channel', | |
token: '123', | |
}, | |
}, | |
}, | |
response: { | |
ok: true, | |
channels: [ | |
{ | |
id: 'CU6UW5940', | |
name: 'connector-test-runner', | |
is_channel: true, | |
is_group: false, | |
is_im: false, | |
created: 1582109983, | |
is_archived: false, | |
is_general: false, | |
unlinked: 0, | |
name_normalized: 'connector-test-runner', | |
is_shared: false, | |
parent_conversation: null, | |
creator: 'UL7CWS0UD', | |
is_ext_shared: false, | |
is_org_shared: false, | |
shared_team_ids: ['T024Q5PFA'], | |
pending_shared: [], | |
pending_connected_team_ids: [], | |
is_pending_ext_shared: false, | |
is_member: true, | |
is_private: true, | |
is_mpim: false, | |
topic: { | |
value: '', | |
creator: '', | |
last_set: 0, | |
}, | |
purpose: { | |
value: '', | |
creator: '', | |
last_set: 0, | |
}, | |
num_members: 6, | |
}, | |
], | |
}, | |
}, | |
{ | |
method: 'get', | |
url: '/conversations.list', | |
expect: { | |
request: { | |
query: { | |
limit: '1000', | |
types: 'im', | |
token: '123', | |
}, | |
}, | |
}, | |
response: { | |
ok: true, | |
channels: [ | |
{ | |
id: 'D017BC05QSH', | |
created: 1595232726, | |
is_archived: false, | |
is_im: true, | |
is_org_shared: false, | |
user: 'USER_ID', | |
is_user_deleted: false, | |
priority: 0.020963221077195, | |
}, | |
{ | |
id: 'NO_USER_CHANNEL', | |
created: 1595232726, | |
is_archived: false, | |
is_im: true, | |
is_org_shared: false, | |
user: 'NO_USER_ID', | |
is_user_deleted: false, | |
priority: 0.020963221077195, | |
}, | |
], | |
}, | |
}, | |
]; | |
exports.mock = { | |
response: { | |
ok: true, | |
channels: [ | |
{ | |
id: 'GJQV9CJNA', | |
name: 'mpdm-jon--az--sam-1', | |
is_channel: false, | |
is_group: true, | |
is_im: false, | |
created: 1557826267, | |
is_archived: false, | |
is_general: false, | |
unlinked: 0, | |
name_normalized: 'mpdm-jon--az--sam-1', | |
is_shared: false, | |
parent_conversation: null, | |
creator: 'UJ2UWBH7B', | |
is_ext_shared: false, | |
is_org_shared: false, | |
shared_team_ids: ['T024Q5PFA'], | |
pending_shared: [], | |
pending_connected_team_ids: [], | |
is_pending_ext_shared: false, | |
is_member: true, | |
is_private: true, | |
is_mpim: true, | |
last_read: '1559296457.001400', | |
is_open: false, | |
topic: { | |
value: 'Group messaging', | |
creator: 'UJ2UWBH7B', | |
last_set: 1557826267, | |
}, | |
purpose: { | |
value: 'Group messaging with: @jon @az @sam', | |
creator: 'UJ2UWBH7B', | |
last_set: 1557826267, | |
}, | |
priority: 0, | |
}, | |
{ | |
id: 'group-no-purpose', | |
is_mpim: true, | |
purpose: { | |
value: '', | |
creator: '', | |
last_set: 0, | |
}, | |
}, | |
], | |
}, | |
}; | |
exports.expect = { | |
request: { | |
query: { | |
limit: '1000', | |
types: 'mpim', | |
token: '123', | |
}, | |
}, | |
output: { | |
result: [ | |
{ | |
text: '@unknown (user not found)', | |
value: 'NO_USER_CHANNEL', | |
}, | |
{ | |
text: '@username (First Last)', | |
value: 'D017BC05QSH', | |
}, | |
{ | |
text: 'connector-test-runner', | |
value: 'CU6UW5940', | |
}, | |
{ | |
text: 'engineering', | |
value: 'C024Q2C1P', | |
}, | |
{ | |
text: 'group-no-purpose', | |
value: 'group-no-purpose', | |
}, | |
{ | |
text: 'group: @jon @az @sam', | |
value: 'GJQV9CJNA', | |
}, | |
], | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment