test('fetchChangelogBody(<version>)', (t) => { const releasePost = require('../../scripts/release-post') const changelogFixture = path.resolve(__dirname, 'CHANGELOG.fixture.md') t.test('does not include `## header` in matched version section', (t) => { const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V4.md') .replyWithFile(200, changelogFixture) releasePost.fetchChangelogBody('4.1.0').then((body) => { t.true(body.startsWith('### Notable changes')) t.true(github.isDone(), 'githubusercontent.com was requested') t.end() }, t.fail) }) t.end() })
test('findLatestVersion<version>', (t) => { const releasePost = require('../../scripts/release-post') t.test('fetches the latest version from nodejs.org', (t) => { nock('https://nodejs.org') .get('/dist/index.json') .reply(200, [ { version: 'v4.1.1' }, { version: 'v4.1.0' } ]) releasePost.findLatestVersion().then((version) => { t.equal(version, '4.1.1') t.end() }) }) t.end() })
describe('builder: getActiveVersionIds function return version id sucessfully', () => { before(function () { nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, [{ name: 'app1', .get(uri => uri.includes('apps')) .reply(200, { name: 'app1', .get(uri => uri.includes('apps')) .reply(200, { name: 'app2', const builder = new Builder() const appNameVersioIdMap = await builder.getActiveVersionIds(['app1', 'app2'], 'f8c64e2a-3333-3a09-8f78-39d7adc76ec5', 'westus') assert.equal(appNameVersioIdMap.get('app1'), '0.1') assert.equal(appNameVersioIdMap.get('app2'), '0.2') }) })
describe('builder: importUrlOrFileReference function return lu content from url sucessfully when updating kb', () => { before(function () { nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('qnamaker')) .reply(200, { knowledgebases: .get(uri => uri.includes('operations')) .reply(200, { operationState: 'Succeeded', .get(uri => uri.includes('knowledgebases')) .reply(200, { qnaDocuments: [{
describe('builder: getActiveVersionIds function return version id failed for non rate limit issue', () => { before(function () { nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, [{ name: 'app1', .get(uri => uri.includes('apps')) .reply(200, { name: 'app1', .get(uri => uri.includes('apps')) .reply(429, { error: { .get(uri => uri.includes('apps')) .reply(401, { error: {
describe('builder: getActiveVersionIds function return version id sucessfully with retry for rate limit issue', () => { before(function () { nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, [{ name: 'app1', .get(uri => uri.includes('apps')) .reply(200, { name: 'app1', .get(uri => uri.includes('apps')) .reply(429, { error: { .get(uri => uri.includes('apps')) .reply(429, { error: { .get(uri => uri.includes('apps')) .reply(429, { error: { .get(uri => uri.includes('apps')) .reply(200, { name: 'app2', const builder = new Builder() const appNameVersioIdMap = await builder.getActiveVersionIds(['app1', 'app2'], 'f8c64e2a-3333-3a09-8f78-39d7adc76ec5', 'westus', 3, 1000) assert.equal(appNameVersioIdMap.get('app1'), '0.1')
describe('builder: getActiveVersionIds function return version id failed with maximum retry count for rate limit issue', () => { before(function () { nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, [{ name: 'app1', .get(uri => uri.includes('apps')) .reply(200, { name: 'app1', .get(uri => uri.includes('apps')) .reply(429, { error: { .get(uri => uri.includes('apps')) .reply(429, { error: { .get(uri => uri.includes('apps')) .reply(429, { error: { .get(uri => uri.includes('apps')) .reply(429, { error: {
describe('builder: importUrlOrFileReference function return lu content from file sucessfully when updating kb', () => { before(function () { nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('qnamaker')) .reply(200, { knowledgebases: .get(uri => uri.includes('operations')) .reply(200, { operationState: 'Succeeded', .get(uri => uri.includes('knowledgebases')) .reply(200, { qnaDocuments: [{