diff --git a/services/spelling/test/acceptance/js/CheckTest.js b/services/spelling/test/acceptance/js/CheckTest.js index fa5210d3e8..160f0de457 100644 --- a/services/spelling/test/acceptance/js/CheckTest.js +++ b/services/spelling/test/acceptance/js/CheckTest.js @@ -12,19 +12,19 @@ const checkWord = (words, language) => }) }) -describe('checking words', () => { +describe('checking words', function() { let response - describe('on successful response', () => { - beforeEach(async () => { + describe('on successful response', function() { + beforeEach(async function () { response = await checkWord(['anather']) }) - it('should return status 200', async () => { + it('should return status 200', async function () { expect(response.statusCode).to.equal(200) }) - it('should return the list of misspellings', async () => { + it('should return the list of misspellings', async function () { const body = JSON.parse(response.body) expect(body).to.deep.equal({ misspellings: [{ index: 0, suggestions: ['anther', 'another'] }] @@ -32,23 +32,23 @@ describe('checking words', () => { }) }) - describe('when multiple words are submitted', () => { - beforeEach(async () => { + describe('when multiple words are submitted', function() { + beforeEach(async function () { response = await checkWord(['anather', 'anather', 'theorie']) }) - it('should return the misspellings for all the words', async () => { + it('should return the misspellings for all the words', async function () { const body = JSON.parse(response.body) expect(body.misspellings.length).to.equal(3) }) - it('should have misspelling suggestions with consecutive indexes', async () => { + it('should have misspelling suggestions with consecutive indexes', async function () { const body = JSON.parse(response.body) const indexes = body.misspellings.map(mspl => mspl.index) expect(indexes).to.deep.equal([0, 1, 2]) }) - it('should return identical suggestions for the same entry', async () => { + it('should return identical suggestions for the same entry', async function () { const body = JSON.parse(response.body) expect(body.misspellings[0].suggestions).to.deep.equal( body.misspellings[1].suggestions @@ -56,8 +56,8 @@ describe('checking words', () => { }) }) - describe('when a very long list of words if submitted', () => { - beforeEach(async () => { + describe('when a very long list of words if submitted', function() { + beforeEach(async function () { let words = [] for (let i = 0; i <= 20000; i++) { words.push('anather') @@ -65,12 +65,12 @@ describe('checking words', () => { response = await checkWord(words) }) - it('should return misspellings for the first 10K results only', async () => { + it('should return misspellings for the first 10K results only', async function () { const body = JSON.parse(response.body) expect(body.misspellings.length).to.equal(10000) }) - it('should have misspelling suggestions with consecutive indexes', async () => { + it('should have misspelling suggestions with consecutive indexes', async function () { const body = JSON.parse(response.body) const indexList = body.misspellings.map(mspl => mspl.index) expect(indexList.length).to.equal(10000) // avoid testing over an incorrect array @@ -80,8 +80,8 @@ describe('checking words', () => { }) }) - describe('when a very long list of words with utf8 responses', () => { - beforeEach(async () => { + describe('when a very long list of words with utf8 responses', function() { + beforeEach(async function () { let words = [] for (let i = 0; i <= 20000; i++) { words.push('anéther') @@ -89,12 +89,12 @@ describe('checking words', () => { response = await checkWord(words, 'bg') // use Bulgarian to generate utf8 response }) - it('should return misspellings for the first 10K results only', async () => { + it('should return misspellings for the first 10K results only', async function () { const body = JSON.parse(response.body) expect(body.misspellings.length).to.equal(10000) }) - it('should have misspelling suggestions with consecutive indexes', async () => { + it('should have misspelling suggestions with consecutive indexes', async function () { const body = JSON.parse(response.body) const indexList = body.misspellings.map(mspl => mspl.index) expect(indexList.length).to.equal(10000) // avoid testing over an incorrect array @@ -104,23 +104,23 @@ describe('checking words', () => { }) }) - describe('when multiple words with utf8 are submitted', () => { - beforeEach(async () => { + describe('when multiple words with utf8 are submitted', function() { + beforeEach(async function () { response = await checkWord(['mneá', 'meniésn', 'meônoi', 'mneá'], 'pt_BR') }) - it('should return the misspellings for all the words', async () => { + it('should return the misspellings for all the words', async function () { const body = JSON.parse(response.body) expect(body.misspellings.length).to.equal(4) }) - it('should have misspelling suggestions with consecutive indexes', async () => { + it('should have misspelling suggestions with consecutive indexes', async function () { const body = JSON.parse(response.body) const indexes = body.misspellings.map(mspl => mspl.index) expect(indexes).to.deep.equal([0, 1, 2, 3]) }) - it('should return identical suggestions for the same entry', async () => { + it('should return identical suggestions for the same entry', async function () { const body = JSON.parse(response.body) expect(body.misspellings[0].suggestions).to.deep.equal( body.misspellings[3].suggestions diff --git a/services/spelling/test/acceptance/js/HealthCheckTest.js b/services/spelling/test/acceptance/js/HealthCheckTest.js index b4b3ef37b8..897dc43fa9 100644 --- a/services/spelling/test/acceptance/js/HealthCheckTest.js +++ b/services/spelling/test/acceptance/js/HealthCheckTest.js @@ -1,8 +1,8 @@ const { expect } = require('chai') const request = require('./helpers/request') -describe('/health_check', () => { - it('should return 200', async () => { +describe('/health_check', function() { + it('should return 200', async function () { const response = await request.get('/health_check') expect(response.statusCode).to.equal(200) }) diff --git a/services/spelling/test/acceptance/js/Init.js b/services/spelling/test/acceptance/js/Init.js index b3c281423b..4de82a6524 100644 --- a/services/spelling/test/acceptance/js/Init.js +++ b/services/spelling/test/acceptance/js/Init.js @@ -1,4 +1,4 @@ const App = require('../../../app.js') const { PORT } = require('./helpers/request') -before(done => App.listen(PORT, 'localhost', done)) +before(function(done) { return App.listen(PORT, 'localhost', done); }) diff --git a/services/spelling/test/acceptance/js/LearnTest.js b/services/spelling/test/acceptance/js/LearnTest.js index b37efc5e80..c516de3162 100644 --- a/services/spelling/test/acceptance/js/LearnTest.js +++ b/services/spelling/test/acceptance/js/LearnTest.js @@ -32,13 +32,13 @@ const deleteDict = () => url: `/user/${USER_ID}` }) -describe('learning words', () => { - it('should return status 204 when posting a word successfully', async () => { +describe('learning words', function() { + it('should return status 204 when posting a word successfully', async function () { const response = await learnWord('abcd') expect(response.statusCode).to.equal(204) }) - it('should return no misspellings after a word is learnt', async () => { + it('should return no misspellings after a word is learnt', async function () { const response = await checkWord(['abv']) const responseBody = JSON.parse(response.body) expect(responseBody.misspellings.length).to.equals(1) @@ -50,7 +50,7 @@ describe('learning words', () => { expect(responseBody2.misspellings.length).to.equals(0) }) - it('should return misspellings again after a personal dictionary is deleted', async () => { + it('should return misspellings again after a personal dictionary is deleted', async function () { await learnWord('bvc') await deleteDict() @@ -60,13 +60,13 @@ describe('learning words', () => { }) }) -describe('unlearning words', () => { - it('should return status 204 when posting a word successfully', async () => { +describe('unlearning words', function() { + it('should return status 204 when posting a word successfully', async function () { const response = await unlearnWord('anything') expect(response.statusCode).to.equal(204) }) - it('should return misspellings after a word is unlearnt', async () => { + it('should return misspellings after a word is unlearnt', async function () { await learnWord('abv') const response = await checkWord(['abv']) diff --git a/services/spelling/test/acceptance/js/StatusTest.js b/services/spelling/test/acceptance/js/StatusTest.js index bfed8033a2..9f006eebf1 100644 --- a/services/spelling/test/acceptance/js/StatusTest.js +++ b/services/spelling/test/acceptance/js/StatusTest.js @@ -1,8 +1,8 @@ const { expect } = require('chai') const request = require('./helpers/request') -describe('/status', () => { - it('should return 200', async () => { +describe('/status', function() { + it('should return 200', async function () { const response = await request.get('/health_check') expect(response.statusCode).to.equal(200) })