describe('LU instance', function() { const response = require('./../../fixtures/translation/serviceresponses/intentsAndutterances.json') before(function(){ nock('https://api.cognitive.microsofttranslator.com') .post(/.*/) .reply(200, response) }) it('Transalte LU instance content', async () => { let luContent = await fs.readFile(path.join(__dirname, './../../fixtures/translation/files/intentsAndUtterances.lu')) let result = await fs.readFile(path.join(__dirname, './../../fixtures/translation/translatedfiles/intentsAndUtterances.lu')) const luInstance = new LU(luContent.toString()) await luInstance.translate('xxxxxxx', 'fr', true, false) compareLuFiles(luInstance.content, result) }); });
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, [{ nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, { }) nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, {
const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V4.md') .replyWithFile(200, changelogFixture) const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V012.md') .replyWithFile(200, changelogLegacyFixture) const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V012.md') .reply(200, changelogLegacyFixture)
const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V4.md') .replyWithFile(200, changelogFixture) const api = nock('https://api.github.com') .get('/users/rvagg') .reply(200, { const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V4.md') .reply(200, 'A changelog without version sections...')
const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V4.md') .replyWithFile(200, changelogFixture) const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V4.md') .replyWithFile(200, changelogFixture) const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V012.md') .replyWithFile(200, changelogLegacyFixture)
describe('luis:convert with URL imports', function() { before(function () { nock('https://vkstoragetest.blob.core.windows.net') .head(/.*/) .reply(200, { status: 'OK' }) nock('https://vkstoragetest.blob.core.windows.net') .get(uri => uri.includes('Expected.lu')) .reply(200, `## None nock('https://vkstoragetest.blob.core.windows.net') .get(uri => uri.includes('Actual.lu')) .reply(200, `
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, { }) nock('https://westus.api.cognitive.microsoft.com') .delete(uri => uri.includes('knowledgebases')) .reply(200) nock('https://westus.api.cognitive.microsoft.com') .post(uri => uri.includes('createasync')) .reply(202, { }) nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('operations')) .reply(200, { nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('knowledgebases')) .reply(200, { nock('https://westus.api.cognitive.microsoft.com') .delete(uri => uri.includes('knowledgebases')) .reply(200)
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, [{ nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, { }) nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(429, { nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(401, {
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, [{ nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, { }) nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(429, { nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(429, { nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(429, { nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, {