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('luis:convert with URL imports', () => { before(function () { nock('https://vkstoragetest.blob.core.windows.net') .head(/.*/) .reply(200, { status: 'OK' }) nock('https://vkstoragetest.blob.core.windows.net') .get(/.*/) .reply(200, `## None - {@add=add {@globalCount={@count={@countNumber=two} apples}}}
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', id: 'f8c64e2a-1111-3a09-8f78-39d7adc76ec5' nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, { name: 'app1', id: 'f8c64e2a-1111-3a09-8f78-39d7adc76ec5', }) nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, { name: 'app2', id: 'f8c64e2a-1111-3a09-8f78-39d7adc76ec5',
const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V4.md') .replyWithFile(200, changelogFixture) t.true(changelog.charAt(0) !== '\n') t.true(changelog.includes('Fixed a bug introduced in v4.1.0')) t.true(github.isDone(), 'githubusercontent.com was requested') const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V012.md') .replyWithFile(200, changelogLegacyFixture) t.true(github.isDone(), 'githubusercontent.com was requested') const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V012.md') .reply(200, changelogLegacyFixture) t.true(github.isDone(), 'githubusercontent.com was requested')
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, { login: 'rvagg', name: 'Rod Vagg' t.true(github.isDone(), 'githubusercontent.com was requested') t.true(api.isDone(), 'api.github.com was requested') const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V4.md') .reply(200, 'A changelog without version sections...') t.true(github.isDone(), 'githubusercontent.com was requested')
const nodejsorg = nock('https://nodejs.org') .head('/dist/v4.1.1/node-v4.1.1.tar.gz') .reply(200, 'OK') t.true(nodejsorg.isDone(), 'nodejs.org was requested') const nodejsorg = nock('https://nodejs.org') .head('/dist/v4.1.1/node-v4.1.1-linux-armv6l.tar.gz') .reply(404, 'Not found') t.true(nodejsorg.isDone(), 'nodejs.org was requested')
const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V4.md') .replyWithFile(200, changelogFixture) t.true(github.isDone(), 'githubusercontent.com was requested') const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V4.md') .replyWithFile(200, changelogFixture) t.true(github.isDone(), 'githubusercontent.com was requested') const github = nock('https://raw.githubusercontent.com') .get('/nodejs/node/master/doc/changelogs/CHANGELOG_V012.md') .replyWithFile(200, changelogLegacyFixture) t.true(github.isDone(), 'githubusercontent.com was requested')
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 - {@add=add {@globalCount={@count={@countNumber=two} apples}}} nock('https://vkstoragetest.blob.core.windows.net') .get(uri => uri.includes('Actual.lu')) .reply(200, ` ## test - one
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: [{ 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, { operationId: 'f8c64e2a-aaaa-3a09-8f78-39d7adc76ec5' }) nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('operations')) .reply(200, { operationState: 'Succeeded', resourceLocation: 'a/b/f8c64e2a-2222-3a09-8f78-39d7adc76ec5' }) nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('knowledgebases')) .reply(200, { qnaDocuments: [{ id: 1,
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 - {@add=add {@globalCount={@count={@countNumber=two} apples}}}
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', id: 'f8c64e2a-1111-3a09-8f78-39d7adc76ec5' nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, { name: 'app1', id: 'f8c64e2a-1111-3a09-8f78-39d7adc76ec5', }) nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(429, { error: { message: 'Rate limit is exceeded' nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(401, { error: { message: 'You do not have access'
const nodejsorg = nock('https://nodejs.org') .get('/dist/v4.1.1/SHASUMS256.txt.asc') .reply(200, 'LIST OF SHASUMS HERE') t.true(nodejsorg.isDone(), 'nodejs.org was requested') const nodejsorg = nock('https://nodejs.org') .get('/dist/v4.1.1/SHASUMS256.txt.asc') .reply(404, 'Not found') t.true(nodejsorg.isDone(), 'nodejs.org was requested')
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: [{ 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, { operationId: 'f8c64e2a-aaaa-3a09-8f78-39d7adc76ec5' }) nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('operations')) .reply(200, { operationState: 'Succeeded', resourceLocation: 'a/b/f8c64e2a-2222-3a09-8f78-39d7adc76ec5' }) nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('knowledgebases')) .reply(200, { qnaDocuments: [{ id: 1,