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() })
nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, [{ name: 'app1', id: 'f8c64e2a-1111-3a09-8f78-39d7adc76ec5' .reply(200, { name: 'app1', id: 'f8c64e2a-1111-3a09-8f78-39d7adc76ec5', .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) 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) .reply(200, { login: 'rvagg', name: 'Rod Vagg' 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)
nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('qnamaker')) .reply(200, { knowledgebases: [{ .reply(200) .reply(202, { operationId: 'f8c64e2a-aaaa-3a09-8f78-39d7adc76ec5' }) .reply(200, { operationState: 'Succeeded', resourceLocation: 'a/b/f8c64e2a-2222-3a09-8f78-39d7adc76ec5' .reply(200, { qnaDocuments: [{ id: 1, .reply(200) })
nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, [{ name: 'app1', id: 'f8c64e2a-1111-3a09-8f78-39d7adc76ec5' .reply(200, { name: 'app1', id: 'f8c64e2a-1111-3a09-8f78-39d7adc76ec5', .reply(429, { error: { message: 'Rate limit is exceeded' .reply(401, { error: { message: 'You do not have access'
nock('https://westus.api.cognitive.microsoft.com') .get(uri => uri.includes('apps')) .reply(200, [{ name: 'app1', id: 'f8c64e2a-1111-3a09-8f78-39d7adc76ec5' .reply(200, { name: 'app1', id: 'f8c64e2a-1111-3a09-8f78-39d7adc76ec5', .reply(429, { error: { message: 'Rate limit is exceeded' .reply(429, { error: { message: 'Rate limit is exceeded' .reply(429, { error: { message: 'Rate limit is exceeded' .reply(200, { name: 'app2', id: 'f8c64e2a-1111-3a09-8f78-39d7adc76ec5',