diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/e2e/custom-assertions/elementCount.js | 2 | ||||
| -rw-r--r-- | test/e2e/nightwatch.conf.js | 54 | ||||
| -rw-r--r-- | test/e2e/runner.js | 8 | ||||
| -rw-r--r-- | test/unit/karma.conf.js | 14 | ||||
| -rw-r--r-- | test/unit/specs/boot/routes.spec.js | 3 | ||||
| -rw-r--r-- | test/unit/specs/components/emoji_input.spec.js | 2 | ||||
| -rw-r--r-- | test/unit/specs/components/rich_content.spec.js | 2 | ||||
| -rw-r--r-- | test/unit/specs/components/user_profile.spec.js | 6 | ||||
| -rw-r--r-- | test/unit/specs/modules/statuses.spec.js | 4 | ||||
| -rw-r--r-- | test/unit/specs/services/chat_service/chat_service.spec.js | 24 | ||||
| -rw-r--r-- | test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js | 8 | ||||
| -rw-r--r-- | test/unit/specs/services/file_size_format/file_size_format.spec.js | 4 | ||||
| -rw-r--r-- | test/unit/specs/services/theme_data/sanity_checks.spec.js | 2 |
13 files changed, 68 insertions, 65 deletions
diff --git a/test/e2e/custom-assertions/elementCount.js b/test/e2e/custom-assertions/elementCount.js index c0d5fe00..5d5a57b9 100644 --- a/test/e2e/custom-assertions/elementCount.js +++ b/test/e2e/custom-assertions/elementCount.js @@ -16,7 +16,7 @@ exports.assertion = function (selector, count) { return res.value } this.command = function (cb) { - var self = this + const self = this return this.api.execute(function (selector) { return document.querySelectorAll(selector).length }, [selector], function (res) { diff --git a/test/e2e/nightwatch.conf.js b/test/e2e/nightwatch.conf.js index 07d974df..4041c698 100644 --- a/test/e2e/nightwatch.conf.js +++ b/test/e2e/nightwatch.conf.js @@ -1,45 +1,45 @@ require('@babel/register') -var config = require('../../config') +const config = require('../../config') // http://nightwatchjs.org/guide#settings-file module.exports = { - 'src_folders': ['test/e2e/specs'], - 'output_folder': 'test/e2e/reports', - 'custom_assertions_path': ['test/e2e/custom-assertions'], + src_folders: ['test/e2e/specs'], + output_folder: 'test/e2e/reports', + custom_assertions_path: ['test/e2e/custom-assertions'], - 'selenium': { - 'start_process': true, - 'server_path': 'node_modules/selenium-server/lib/runner/selenium-server-standalone-2.53.1.jar', - 'host': '127.0.0.1', - 'port': 4444, - 'cli_args': { + selenium: { + start_process: true, + server_path: 'node_modules/selenium-server/lib/runner/selenium-server-standalone-2.53.1.jar', + host: '127.0.0.1', + port: 4444, + cli_args: { 'webdriver.chrome.driver': require('chromedriver').path } }, - 'test_settings': { - 'default': { - 'selenium_port': 4444, - 'selenium_host': 'localhost', - 'silent': true, - 'globals': { - 'devServerURL': 'http://localhost:' + (process.env.PORT || config.dev.port) + test_settings: { + default: { + selenium_port: 4444, + selenium_host: 'localhost', + silent: true, + globals: { + devServerURL: 'http://localhost:' + (process.env.PORT || config.dev.port) } }, - 'chrome': { - 'desiredCapabilities': { - 'browserName': 'chrome', - 'javascriptEnabled': true, - 'acceptSslCerts': true + chrome: { + desiredCapabilities: { + browserName: 'chrome', + javascriptEnabled: true, + acceptSslCerts: true } }, - 'firefox': { - 'desiredCapabilities': { - 'browserName': 'firefox', - 'javascriptEnabled': true, - 'acceptSslCerts': true + firefox: { + desiredCapabilities: { + browserName: 'firefox', + javascriptEnabled: true, + acceptSslCerts: true } } } diff --git a/test/e2e/runner.js b/test/e2e/runner.js index 2a5c6ef9..57abc2e1 100644 --- a/test/e2e/runner.js +++ b/test/e2e/runner.js @@ -1,6 +1,6 @@ // 1. start the dev server using production config process.env.NODE_ENV = 'testing' -var server = require('../../build/dev-server.js') +const server = require('../../build/dev-server.js') // 2. run the nightwatch test suite against it // to run in additional browsers: @@ -9,7 +9,7 @@ var server = require('../../build/dev-server.js') // or override the environment flag, for example: `npm run e2e -- --env chrome,firefox` // For more information on Nightwatch's config file, see // http://nightwatchjs.org/guide#settings-file -var opts = process.argv.slice(2) +let opts = process.argv.slice(2) if (opts.indexOf('--config') === -1) { opts = opts.concat(['--config', 'test/e2e/nightwatch.conf.js']) } @@ -17,8 +17,8 @@ if (opts.indexOf('--env') === -1) { opts = opts.concat(['--env', 'chrome']) } -var spawn = require('cross-spawn') -var runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) +const spawn = require('cross-spawn') +const runner = spawn('./node_modules/.bin/nightwatch', opts, { stdio: 'inherit' }) runner.on('exit', function (code) { server.close() diff --git a/test/unit/karma.conf.js b/test/unit/karma.conf.js index 45d74f14..8959e009 100644 --- a/test/unit/karma.conf.js +++ b/test/unit/karma.conf.js @@ -4,14 +4,14 @@ // https://github.com/webpack/karma-webpack // var path = require('path') -var merge = require('webpack-merge') -var HtmlWebpackPlugin = require('html-webpack-plugin') -var baseConfig = require('../../build/webpack.base.conf') -var utils = require('../../build/utils') -var webpack = require('webpack') +const merge = require('webpack-merge') +const HtmlWebpackPlugin = require('html-webpack-plugin') +const baseConfig = require('../../build/webpack.base.conf') +const utils = require('../../build/utils') +const webpack = require('webpack') // var projectRoot = path.resolve(__dirname, '../../') -var webpackConfig = merge(baseConfig, { +const webpackConfig = merge(baseConfig, { // use inline sourcemap for karma-sourcemap-loader module: { rules: utils.styleLoaders() @@ -63,7 +63,7 @@ module.exports = function (config) { frameworks: ['mocha', 'sinon-chai'], reporters: ['mocha'], customLaunchers: { - 'FirefoxHeadless': { + FirefoxHeadless: { base: 'Firefox', flags: [ '-headless' diff --git a/test/unit/specs/boot/routes.spec.js b/test/unit/specs/boot/routes.spec.js index 439aefd4..5cffefbb 100644 --- a/test/unit/specs/boot/routes.spec.js +++ b/test/unit/specs/boot/routes.spec.js @@ -19,6 +19,7 @@ describe('routes', () => { const matchedComponents = router.currentRoute.value.matched + // eslint-disable-next-line no-prototype-builtins expect(matchedComponents[0].components.default.components.hasOwnProperty('Timeline')).to.eql(true) }) @@ -27,6 +28,7 @@ describe('routes', () => { const matchedComponents = router.currentRoute.value.matched + // eslint-disable-next-line no-prototype-builtins expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true) }) @@ -35,6 +37,7 @@ describe('routes', () => { const matchedComponents = router.currentRoute.value.matched + // eslint-disable-next-line no-prototype-builtins expect(matchedComponents[0].components.default.components.hasOwnProperty('UserCard')).to.eql(true) }) }) diff --git a/test/unit/specs/components/emoji_input.spec.js b/test/unit/specs/components/emoji_input.spec.js index 6188308e..752111ef 100644 --- a/test/unit/specs/components/emoji_input.spec.js +++ b/test/unit/specs/components/emoji_input.spec.js @@ -29,7 +29,7 @@ const generateInput = (value, padEmoji = true) => { modelValue: value }, slots: { - 'default': () => h('input', '') + default: () => h('input', '') } }) return wrapper diff --git a/test/unit/specs/components/rich_content.spec.js b/test/unit/specs/components/rich_content.spec.js index 8a18a08b..616df6a0 100644 --- a/test/unit/specs/components/rich_content.spec.js +++ b/test/unit/specs/components/rich_content.spec.js @@ -4,7 +4,7 @@ import RichContent from 'src/components/rich_content/rich_content.jsx' const attentions = [] const global = { mocks: { - '$store': { + $store: { state: {}, getters: { mergedConfig: () => ({ diff --git a/test/unit/specs/components/user_profile.spec.js b/test/unit/specs/components/user_profile.spec.js index 584758f7..0fbab722 100644 --- a/test/unit/specs/components/user_profile.spec.js +++ b/test/unit/specs/components/user_profile.spec.js @@ -163,7 +163,7 @@ const localProfileStore = createStore({ currentUser: { credentials: '' }, - usersObject: { 100: localUser, 'testuser': localUser }, + usersObject: { 100: localUser, testuser: localUser }, users: [localUser], relationships: {} } @@ -175,7 +175,7 @@ describe.skip('UserProfile', () => { it('renders external profile', () => { const wrapper = mount(UserProfile, { global: { - plugins: [ externalProfileStore ], + plugins: [externalProfileStore], mocks: { $route: { params: { id: 100 }, @@ -192,7 +192,7 @@ describe.skip('UserProfile', () => { it('renders local profile', () => { const wrapper = mount(UserProfile, { global: { - plugins: [ localProfileStore ], + plugins: [localProfileStore], mocks: { $route: { params: { name: 'testUser' }, diff --git a/test/unit/specs/modules/statuses.spec.js b/test/unit/specs/modules/statuses.spec.js index b790b231..a8d0e5a3 100644 --- a/test/unit/specs/modules/statuses.spec.js +++ b/test/unit/specs/modules/statuses.spec.js @@ -245,7 +245,7 @@ describe('Statuses module', () => { it('increments count in existing reaction', () => { const state = defaultState() const status = makeMockStatus({ id: '1' }) - status.emoji_reactions = [ { name: '😂', count: 1, accounts: [] } ] + status.emoji_reactions = [{ name: '😂', count: 1, accounts: [] }] mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' }) mutations.addOwnReaction(state, { id: '1', emoji: '😂', currentUser: { id: 'me' } }) @@ -269,7 +269,7 @@ describe('Statuses module', () => { it('decreases count in existing reaction', () => { const state = defaultState() const status = makeMockStatus({ id: '1' }) - status.emoji_reactions = [ { name: '😂', count: 2, accounts: [{ id: 'me' }] } ] + status.emoji_reactions = [{ name: '😂', count: 2, accounts: [{ id: 'me' }] }] mutations.addNewStatuses(state, { statuses: [status], showImmediately: true, timeline: 'public' }) mutations.removeOwnReaction(state, { id: '1', emoji: '😂', currentUser: { id: 'me' } }) diff --git a/test/unit/specs/services/chat_service/chat_service.spec.js b/test/unit/specs/services/chat_service/chat_service.spec.js index fbbca436..a42269b4 100644 --- a/test/unit/specs/services/chat_service/chat_service.spec.js +++ b/test/unit/specs/services/chat_service/chat_service.spec.js @@ -24,23 +24,23 @@ describe('chatService', () => { describe('.add', () => { it("Doesn't add duplicates", () => { const chat = chatService.empty() - chatService.add(chat, { messages: [ message1 ] }) - chatService.add(chat, { messages: [ message1 ] }) + chatService.add(chat, { messages: [message1] }) + chatService.add(chat, { messages: [message1] }) expect(chat.messages.length).to.eql(1) - chatService.add(chat, { messages: [ message2 ] }) + chatService.add(chat, { messages: [message2] }) expect(chat.messages.length).to.eql(2) }) it('Updates minId and lastMessage and newMessageCount', () => { const chat = chatService.empty() - chatService.add(chat, { messages: [ message1 ] }) + chatService.add(chat, { messages: [message1] }) expect(chat.maxId).to.eql(message1.id) expect(chat.minId).to.eql(message1.id) expect(chat.newMessageCount).to.eql(1) - chatService.add(chat, { messages: [ message2 ] }) + chatService.add(chat, { messages: [message2] }) expect(chat.maxId).to.eql(message2.id) expect(chat.minId).to.eql(message1.id) expect(chat.newMessageCount).to.eql(2) @@ -50,7 +50,7 @@ describe('chatService', () => { expect(chat.lastSeenMessageId).to.eql(message2.id) // Add message with higher id - chatService.add(chat, { messages: [ message3 ] }) + chatService.add(chat, { messages: [message3] }) expect(chat.newMessageCount).to.eql(1) }) }) @@ -59,9 +59,9 @@ describe('chatService', () => { it('Updates minId and lastMessage', () => { const chat = chatService.empty() - chatService.add(chat, { messages: [ message1 ] }) - chatService.add(chat, { messages: [ message2 ] }) - chatService.add(chat, { messages: [ message3 ] }) + chatService.add(chat, { messages: [message1] }) + chatService.add(chat, { messages: [message2] }) + chatService.add(chat, { messages: [message3] }) expect(chat.maxId).to.eql(message3.id) expect(chat.minId).to.eql(message1.id) @@ -80,9 +80,9 @@ describe('chatService', () => { it('Inserts date separators', () => { const chat = chatService.empty() - chatService.add(chat, { messages: [ message1 ] }) - chatService.add(chat, { messages: [ message2 ] }) - chatService.add(chat, { messages: [ message3 ] }) + chatService.add(chat, { messages: [message1] }) + chatService.add(chat, { messages: [message2] }) + chatService.add(chat, { messages: [message3] }) const view = chatService.getView(chat) expect(view.map(i => i.type)).to.eql(['date', 'message', 'message', 'date', 'message']) diff --git a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js index 03fb32c9..525e57a5 100644 --- a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js +++ b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js @@ -314,8 +314,8 @@ describe('API Entities normalizer', () => { const linkHeader = '<https://example.com/api/v1/notifications?max_id=861676>; rel="next", <https://example.com/api/v1/notifications?min_id=861741>; rel="prev"' const result = parseLinkHeaderPagination(linkHeader) expect(result).to.eql({ - 'maxId': 861676, - 'minId': 861741 + maxId: 861676, + minId: 861741 }) }) @@ -323,8 +323,8 @@ describe('API Entities normalizer', () => { const linkHeader = '<http://example.com/api/v1/timelines/home?max_id=9waQx5IIS48qVue2Ai>; rel="next", <http://example.com/api/v1/timelines/home?min_id=9wi61nIPnfn674xgie>; rel="prev"' const result = parseLinkHeaderPagination(linkHeader, { flakeId: true }) expect(result).to.eql({ - 'maxId': '9waQx5IIS48qVue2Ai', - 'minId': '9wi61nIPnfn674xgie' + maxId: '9waQx5IIS48qVue2Ai', + minId: '9wi61nIPnfn674xgie' }) }) }) diff --git a/test/unit/specs/services/file_size_format/file_size_format.spec.js b/test/unit/specs/services/file_size_format/file_size_format.spec.js index e02ac379..6804b6eb 100644 --- a/test/unit/specs/services/file_size_format/file_size_format.spec.js +++ b/test/unit/specs/services/file_size_format/file_size_format.spec.js @@ -25,8 +25,8 @@ describe('fileSizeFormat', () => { } ] - var res = [] - for (var value in values) { + const res = [] + for (const value in values) { res.push(fileSizeFormatService.fileSizeFormat(values[value])) } expect(res).to.eql(expected) diff --git a/test/unit/specs/services/theme_data/sanity_checks.spec.js b/test/unit/specs/services/theme_data/sanity_checks.spec.js index f0072e7d..f94c6a08 100644 --- a/test/unit/specs/services/theme_data/sanity_checks.spec.js +++ b/test/unit/specs/services/theme_data/sanity_checks.spec.js @@ -6,7 +6,7 @@ const checkColors = (output) => { expect(v, key).to.be.an('object') expect(v, key).to.include.all.keys('r', 'g', 'b') 'rgba'.split('').forEach(k => { - if ((k === 'a' && v.hasOwnProperty('a')) || k !== 'a') { + if ((k === 'a' && Object.prototype.hasOwnProperty.call(v, 'a')) || k !== 'a') { expect(v[k], key + '.' + k).to.be.a('number') expect(v[k], key + '.' + k).to.be.least(0) expect(v[k], key + '.' + k).to.be.most(k === 'a' ? 1 : 255) |
