Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit c59556a

Browse files
committed
Reverting to string comparison on qnamaker translate test
1 parent f471368 commit c59556a

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

packages/luis/test/commands/qnamaker/translate.test.ts

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,6 @@ const compareLuFiles = async function(file1: string, file2: string) {
1313
return result === fixtureFile
1414
}
1515

16-
const parseJsonFiles = async function(file1: string, file2: string) {
17-
let result = await fs.readJson(path.join(__dirname, file1))
18-
let fixtureFile = await fs.readJson(path.join(__dirname, file2))
19-
result = sanitizeExampleJson(JSON.stringify(result))
20-
fixtureFile = sanitizeExampleJson(JSON.stringify(fixtureFile))
21-
return [JSON.parse(result), JSON.parse(fixtureFile)]
22-
}
23-
24-
function sanitizeExampleJson(fileContent: string) {
25-
let escapedExampleNewLine = JSON.stringify('\r\n').replace(/"/g, '').replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
26-
let escapedNewLine = JSON.stringify(NEWLINE).replace(/"/g, '');
27-
return fileContent.replace(new RegExp(escapedExampleNewLine, 'g'), escapedNewLine);
28-
}
29-
3016
describe('qnamaker:translate qna.lu', () => {
3117
after(async function(){
3218
await fs.remove(path.join(__dirname, './../../../fr/'))
@@ -63,7 +49,6 @@ describe('qnamaker:translate qna.json', () => {
6349
.stdout()
6450
.command(['qnamaker:translate', '--translatekey','xxxxxxx', '--in', `${path.join(__dirname, './../../fixtures/translation/en/qna.json')}`, '--tgtlang', 'fr', '--out', './'])
6551
.it('runs qnamaker:translate --translatekey xxxxxx --in file.lu --tgtlang fr --out ./', async (ctx) => {
66-
let parsedObjects = await parseJsonFiles('./../../../fr/qna.json', './../../fixtures/translation/fr/qna.json')
67-
expect(parsedObjects[0]).to.deep.equal(parsedObjects[1])
52+
expect(await compareLuFiles('./../../../fr/qna.json', './../../fixtures/translation/fr/qna.json')).to.be.true
6853
})
6954
})

0 commit comments

Comments
 (0)