aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/index.js8
-rw-r--r--test/unit/karma.conf.js13
-rw-r--r--test/unit/specs/components/user_profile.spec.js2
-rw-r--r--test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js9
-rw-r--r--test/unit/specs/services/gesture_service/gesture_service.spec.js2
-rw-r--r--test/unit/specs/services/notification_utils/notification_utils.spec.js5
6 files changed, 26 insertions, 13 deletions
diff --git a/test/unit/index.js b/test/unit/index.js
index 03b19e32..83a2dcdb 100644
--- a/test/unit/index.js
+++ b/test/unit/index.js
@@ -1,7 +1,3 @@
-// Polyfill fn.bind() for PhantomJS
-/* eslint-disable no-extend-native */
-Function.prototype.bind = require('function-bind')
-
// require all test files (files that ends with .spec.js)
const testsContext = require.context('./specs', true, /\.spec$/)
testsContext.keys().forEach(testsContext)
@@ -9,5 +5,5 @@ testsContext.keys().forEach(testsContext)
// require all src files except main.js for coverage.
// you can also change this to match only the subset of files that
// you want coverage for.
-const srcContext = require.context('../../src', true, /^\.\/(?!main(\.js)?$)/)
-srcContext.keys().forEach(srcContext)
+// const srcContext = require.context('../../src', true, /^\.\/(?!main(\.js)?$)/)
+// srcContext.keys().forEach(srcContext)
diff --git a/test/unit/karma.conf.js b/test/unit/karma.conf.js
index d19a2229..8465523a 100644
--- a/test/unit/karma.conf.js
+++ b/test/unit/karma.conf.js
@@ -13,7 +13,7 @@ var projectRoot = path.resolve(__dirname, '../../')
var webpackConfig = merge(baseConfig, {
// use inline sourcemap for karma-sourcemap-loader
module: {
- loaders: utils.styleLoaders()
+ rules: utils.styleLoaders()
},
devtool: '#inline-source-map',
// vue: {
@@ -53,11 +53,18 @@ module.exports = function (config) {
// 1. install corresponding karma launcher
// http://karma-runner.github.io/0.13/config/browsers.html
// 2. add it to the `browsers` array below.
- browsers: ['PhantomJS'],
+ browsers: ['FirefoxHeadless'],
frameworks: ['mocha', 'sinon-chai'],
reporters: ['mocha'],
+ customLaunchers: {
+ 'FirefoxHeadless': {
+ base: 'Firefox',
+ flags: [
+ '-headless',
+ ]
+ }
+ },
files: [
- '../../node_modules/@babel/polyfill/dist/polyfill.js',
'./index.js'
],
preprocessors: {
diff --git a/test/unit/specs/components/user_profile.spec.js b/test/unit/specs/components/user_profile.spec.js
index 847481f3..6de9491a 100644
--- a/test/unit/specs/components/user_profile.spec.js
+++ b/test/unit/specs/components/user_profile.spec.js
@@ -39,6 +39,7 @@ const externalProfileStore = new Vuex.Store({
getters: testGetters,
state: {
api: {
+ fetchers: {},
backendInteractor: backendInteractorService('')
},
interface: {
@@ -106,6 +107,7 @@ const localProfileStore = new Vuex.Store({
getters: testGetters,
state: {
api: {
+ fetchers: {},
backendInteractor: backendInteractorService('')
},
interface: {
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 2b0b0d6d..3d34c5cc 100644
--- a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
+++ b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js
@@ -129,7 +129,10 @@ const makeMockStatusMasto = (overrides = {}) => {
tags: [],
uri: 'https://shigusegubu.club/objects/16033fbb-97c0-4f0e-b834-7abb92fb8639',
url: 'https://shigusegubu.club/objects/16033fbb-97c0-4f0e-b834-7abb92fb8639',
- visibility: 'public'
+ visibility: 'public',
+ pleroma: {
+ local: true
+ }
}, overrides)
}
@@ -319,9 +322,9 @@ describe('API Entities normalizer', () => {
describe('MastoAPI emoji adder', () => {
const emojis = makeMockEmojiMasto()
- const imageHtml = '<img src="https://example.com/image.png" alt="image" class="emoji" />'
+ const imageHtml = '<img src="https://example.com/image.png" alt="image" title="image" class="emoji" />'
.replace(/"/g, '\'')
- const thinkHtml = '<img src="https://example.com/think.png" alt="thinking" class="emoji" />'
+ const thinkHtml = '<img src="https://example.com/think.png" alt="thinking" title="thinking" class="emoji" />'
.replace(/"/g, '\'')
it('correctly replaces shortcodes in supplied string', () => {
diff --git a/test/unit/specs/services/gesture_service/gesture_service.spec.js b/test/unit/specs/services/gesture_service/gesture_service.spec.js
index 4a1b009a..a91f95db 100644
--- a/test/unit/specs/services/gesture_service/gesture_service.spec.js
+++ b/test/unit/specs/services/gesture_service/gesture_service.spec.js
@@ -9,7 +9,7 @@ const mockTouchEvent = (x, y) => ({
]
})
-describe.only('GestureService', () => {
+describe('GestureService', () => {
describe('swipeGesture', () => {
it('calls the callback on a successful swipe', () => {
let swiped = false
diff --git a/test/unit/specs/services/notification_utils/notification_utils.spec.js b/test/unit/specs/services/notification_utils/notification_utils.spec.js
index e945459e..1baa5fc9 100644
--- a/test/unit/specs/services/notification_utils/notification_utils.spec.js
+++ b/test/unit/specs/services/notification_utils/notification_utils.spec.js
@@ -9,14 +9,17 @@ describe('NotificationUtils', () => {
notifications: {
data: [
{
+ id: 1,
action: { id: '1' },
type: 'like'
},
{
+ id: 2,
action: { id: '2' },
type: 'mention'
},
{
+ id: 3,
action: { id: '3' },
type: 'repeat'
}
@@ -35,10 +38,12 @@ describe('NotificationUtils', () => {
const expected = [
{
action: { id: '3' },
+ id: 3,
type: 'repeat'
},
{
action: { id: '1' },
+ id: 1,
type: 'like'
}
]