Skip to content

Instantly share code, notes, and snippets.

@filmaj
Created September 8, 2021 13:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filmaj/f5097da82ecc9d429b983ee5561b8839 to your computer and use it in GitHub Desktop.
Save filmaj/f5097da82ecc9d429b983ee5561b8839 to your computer and use it in GitHub Desktop.
axios bug repro case v0.21.1 vs. v0.21.2
{
"name": "axios-repro",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "DEBUG=nock.scope* mocha test.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@slack/web-api": "^6.4.0",
"axios": "0.21.1",
"mocha": "^9.1.1",
"nock": "^13.1.3"
}
}
const nock = require('nock');
const { WebClient } = require('@slack/web-api');
const token = 'xoxb-faketoken';
const assert = require('assert');
describe('has all admin.usergroups.* APIs', function () {
function verify(runApiCall, methodName, expectedBody, done) {
const scope = nock('https://slack.com')
.post(`/api/${methodName}`)
.reply(200, function (_uri, body) {
return { ok: true, body: body };
});
runApiCall
.then((res) => {
assert(res.body === expectedBody);
scope.done();
done();
});
}
const client = new WebClient(token, { logLevel: 'debug' });
it('can call admin.usergroups.addChannels with a string "channel_ids"', function (done) {
verify(
client.admin.usergroups.addChannels({ team_id: 'T123', usergroup_id: 'S123', channel_ids: 'C123,C234' }),
'admin.usergroups.addChannels',
'token=xoxb-faketoken&team_id=T123&usergroup_id=S123&channel_ids=C123%2CC234',
done,
);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment