mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Merge branch 'master' into maintenance-mode-script
This commit is contained in:
commit
7f97e7e1ca
203
.github/dependabot.yml
vendored
203
.github/dependabot.yml
vendored
@ -1,179 +1,62 @@
|
|||||||
version: 2
|
version: 2
|
||||||
updates:
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: weekly
|
||||||
|
day: "saturday"
|
||||||
|
timezone: "Europe/Berlin"
|
||||||
|
time: "03:00"
|
||||||
|
# open-pull-requests-limit: 10
|
||||||
|
# ignore:
|
||||||
|
|
||||||
- package-ecosystem: npm
|
- package-ecosystem: npm
|
||||||
directory: "/"
|
directory: "/"
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: weekly
|
||||||
time: "04:00"
|
day: "saturday"
|
||||||
open-pull-requests-limit: 10
|
timezone: "Europe/Berlin"
|
||||||
ignore:
|
time: "03:00"
|
||||||
- dependency-name: cypress
|
|
||||||
versions:
|
|
||||||
- 6.3.0
|
|
||||||
- 6.4.0
|
|
||||||
- 6.5.0
|
|
||||||
- 6.6.0
|
|
||||||
- 6.7.1
|
|
||||||
- 6.8.0
|
|
||||||
- 7.0.0
|
|
||||||
- 7.0.1
|
|
||||||
- 7.1.0
|
|
||||||
- dependency-name: cypress-cucumber-preprocessor
|
|
||||||
versions:
|
|
||||||
- 4.0.0
|
|
||||||
- 4.0.1
|
|
||||||
- 4.0.3
|
|
||||||
- dependency-name: date-fns
|
|
||||||
versions:
|
|
||||||
- 2.16.1
|
|
||||||
- 2.17.0
|
|
||||||
- 2.18.0
|
|
||||||
- 2.19.0
|
|
||||||
- 2.20.0
|
|
||||||
- 2.20.1
|
|
||||||
- 2.20.2
|
|
||||||
- 2.20.3
|
|
||||||
- 2.21.0
|
|
||||||
- dependency-name: cypress-file-upload
|
|
||||||
versions:
|
|
||||||
- 5.0.2
|
|
||||||
- 5.0.3
|
|
||||||
- 5.0.4
|
|
||||||
- 5.0.5
|
|
||||||
- dependency-name: neo4j-driver
|
|
||||||
versions:
|
|
||||||
- 4.2.2
|
|
||||||
- package-ecosystem: npm
|
- package-ecosystem: npm
|
||||||
directory: "/backend"
|
directory: "/backend"
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: weekly
|
||||||
time: "04:00"
|
day: "saturday"
|
||||||
open-pull-requests-limit: 10
|
timezone: "Europe/Berlin"
|
||||||
ignore:
|
time: "03:00"
|
||||||
- dependency-name: y18n
|
|
||||||
versions:
|
|
||||||
- 4.0.1
|
|
||||||
- 4.0.2
|
|
||||||
- dependency-name: metascraper-publisher
|
|
||||||
versions:
|
|
||||||
- 5.16.16
|
|
||||||
- 5.18.1
|
|
||||||
- 5.18.12
|
|
||||||
- 5.18.2
|
|
||||||
- 5.18.4
|
|
||||||
- 5.18.5
|
|
||||||
- 5.18.6
|
|
||||||
- 5.18.9
|
|
||||||
- 5.20.0
|
|
||||||
- 5.21.0
|
|
||||||
- 5.21.2
|
|
||||||
- 5.21.3
|
|
||||||
- 5.21.4
|
|
||||||
- 5.21.5
|
|
||||||
- dependency-name: metascraper-author
|
|
||||||
versions:
|
|
||||||
- 5.16.16
|
|
||||||
- 5.18.1
|
|
||||||
- 5.18.12
|
|
||||||
- 5.18.2
|
|
||||||
- 5.18.4
|
|
||||||
- 5.18.5
|
|
||||||
- 5.18.6
|
|
||||||
- 5.18.9
|
|
||||||
- 5.20.0
|
|
||||||
- 5.21.0
|
|
||||||
- 5.21.2
|
|
||||||
- 5.21.3
|
|
||||||
- 5.21.4
|
|
||||||
- 5.21.5
|
|
||||||
- dependency-name: neo4j-driver
|
|
||||||
versions:
|
|
||||||
- 4.2.2
|
|
||||||
- dependency-name: neo4j-graphql-js
|
|
||||||
versions:
|
|
||||||
- 2.19.1
|
|
||||||
- dependency-name: mustache
|
|
||||||
versions:
|
|
||||||
- 4.1.0
|
|
||||||
- package-ecosystem: npm
|
- package-ecosystem: npm
|
||||||
directory: "/webapp"
|
directory: "/webapp"
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: weekly
|
||||||
time: "04:00"
|
day: "saturday"
|
||||||
open-pull-requests-limit: 10
|
timezone: "Europe/Berlin"
|
||||||
ignore:
|
time: "03:00"
|
||||||
- dependency-name: nuxt
|
|
||||||
versions:
|
|
||||||
- 2.14.12
|
|
||||||
- 2.15.0
|
|
||||||
- 2.15.1
|
|
||||||
- 2.15.2
|
|
||||||
- 2.15.3
|
|
||||||
- dependency-name: v-tooltip
|
|
||||||
versions:
|
|
||||||
- 2.1.2
|
|
||||||
- dependency-name: "@vue/server-test-utils"
|
|
||||||
versions:
|
|
||||||
- 1.1.2
|
|
||||||
- 1.1.3
|
|
||||||
- dependency-name: node-notifier
|
|
||||||
versions:
|
|
||||||
- 8.0.1
|
|
||||||
- package-ecosystem: docker
|
|
||||||
directory: "/webapp"
|
|
||||||
schedule:
|
|
||||||
interval: daily
|
|
||||||
time: "04:00"
|
|
||||||
open-pull-requests-limit: 10
|
|
||||||
ignore:
|
|
||||||
- dependency-name: node
|
|
||||||
versions:
|
|
||||||
- ">= 15.5.a, < 15.6"
|
|
||||||
- dependency-name: node
|
|
||||||
versions:
|
|
||||||
- 15.10.0.pre.alpine3.10
|
|
||||||
- 15.11.0.pre.alpine3.10
|
|
||||||
- 15.12.0.pre.alpine3.10
|
|
||||||
- 15.13.0.pre.alpine3.10
|
|
||||||
- 15.7.0.pre.alpine3.10
|
|
||||||
- 15.8.0.pre.alpine3.10
|
|
||||||
- 15.9.0.pre.alpine3.10
|
|
||||||
- package-ecosystem: docker
|
- package-ecosystem: docker
|
||||||
directory: "/backend"
|
directory: "/backend"
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: weekly
|
||||||
time: "04:00"
|
day: "saturday"
|
||||||
open-pull-requests-limit: 10
|
timezone: "Europe/Berlin"
|
||||||
ignore:
|
time: "03:00"
|
||||||
- dependency-name: node
|
- package-ecosystem: docker
|
||||||
versions:
|
directory: "/webapp"
|
||||||
- ">= 15.4.a, < 15.5"
|
schedule:
|
||||||
- dependency-name: node
|
interval: weekly
|
||||||
versions:
|
day: "saturday"
|
||||||
- ">= 15.5.a, < 15.6"
|
timezone: "Europe/Berlin"
|
||||||
- dependency-name: node
|
time: "03:00"
|
||||||
versions:
|
|
||||||
- 15.10.0.pre.alpine3.10
|
|
||||||
- 15.11.0.pre.alpine3.10
|
|
||||||
- 15.12.0.pre.alpine3.10
|
|
||||||
- 15.13.0.pre.alpine3.10
|
|
||||||
- 15.7.0.pre.alpine3.10
|
|
||||||
- 15.8.0.pre.alpine3.10
|
|
||||||
- 15.9.0.pre.alpine3.10
|
|
||||||
- package-ecosystem: docker
|
- package-ecosystem: docker
|
||||||
directory: "/neo4j"
|
directory: "/neo4j"
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: weekly
|
||||||
time: "04:00"
|
day: "saturday"
|
||||||
open-pull-requests-limit: 10
|
timezone: "Europe/Berlin"
|
||||||
ignore:
|
time: "03:00"
|
||||||
- dependency-name: neo4j
|
|
||||||
versions:
|
|
||||||
- 4.2.3
|
|
||||||
- 4.2.4
|
|
||||||
- package-ecosystem: docker
|
- package-ecosystem: docker
|
||||||
directory: "/deployment/legacy-migration/maintenance-worker"
|
directory: "/deployment/src/docker"
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: weekly
|
||||||
time: "04:00"
|
day: "saturday"
|
||||||
open-pull-requests-limit: 10
|
timezone: "Europe/Berlin"
|
||||||
|
time: "03:00"
|
||||||
|
|||||||
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@ -168,6 +168,8 @@ jobs:
|
|||||||
name: Unit tests - backend
|
name: Unit tests - backend
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build_test_neo4j,build_test_backend]
|
needs: [build_test_neo4j,build_test_backend]
|
||||||
|
permissions:
|
||||||
|
checks: write
|
||||||
steps:
|
steps:
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# CHECKOUT CODE ##########################################################
|
# CHECKOUT CODE ##########################################################
|
||||||
@ -225,6 +227,8 @@ jobs:
|
|||||||
name: Unit tests - webapp
|
name: Unit tests - webapp
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [build_test_webapp]
|
needs: [build_test_webapp]
|
||||||
|
permissions:
|
||||||
|
checks: write
|
||||||
steps:
|
steps:
|
||||||
##########################################################################
|
##########################################################################
|
||||||
# CHECKOUT CODE ##########################################################
|
# CHECKOUT CODE ##########################################################
|
||||||
@ -269,7 +273,7 @@ jobs:
|
|||||||
report_name: Coverage Webapp
|
report_name: Coverage Webapp
|
||||||
type: lcov
|
type: lcov
|
||||||
result_path: ./coverage/lcov.info
|
result_path: ./coverage/lcov.info
|
||||||
min_coverage: 63
|
min_coverage: 83
|
||||||
token: ${{ github.token }}
|
token: ${{ github.token }}
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|||||||
@ -7,6 +7,7 @@ services:
|
|||||||
dockerfile: ../webapp/Dockerfile
|
dockerfile: ../webapp/Dockerfile
|
||||||
context: ../webapp
|
context: ../webapp
|
||||||
target: base
|
target: base
|
||||||
|
command: sleep 0
|
||||||
|
|
||||||
webapp-code:
|
webapp-code:
|
||||||
image: ocelotsocialnetwork/webapp:local-code
|
image: ocelotsocialnetwork/webapp:local-code
|
||||||
@ -14,10 +15,11 @@ services:
|
|||||||
dockerfile: ../webapp/Dockerfile
|
dockerfile: ../webapp/Dockerfile
|
||||||
context: ../webapp
|
context: ../webapp
|
||||||
target: code
|
target: code
|
||||||
|
command: sleep 0
|
||||||
|
|
||||||
webapp:
|
webapp:
|
||||||
image: ocelotsocialnetwork/webapp-branded:local-${CONFIGURATION}
|
image: ocelotsocialnetwork/webapp-branded:local-${CONFIGURATION}
|
||||||
container_name: webapp
|
container_name: webapp-branded
|
||||||
build:
|
build:
|
||||||
dockerfile: src/docker/webapp.Dockerfile
|
dockerfile: src/docker/webapp.Dockerfile
|
||||||
target: branded
|
target: branded
|
||||||
@ -51,6 +53,7 @@ services:
|
|||||||
dockerfile: ../backend/Dockerfile
|
dockerfile: ../backend/Dockerfile
|
||||||
context: ../backend
|
context: ../backend
|
||||||
target: base
|
target: base
|
||||||
|
command: sleep 0
|
||||||
|
|
||||||
backend-code:
|
backend-code:
|
||||||
image: ocelotsocialnetwork/backend:local-code
|
image: ocelotsocialnetwork/backend:local-code
|
||||||
@ -58,13 +61,14 @@ services:
|
|||||||
dockerfile: ../backend/Dockerfile
|
dockerfile: ../backend/Dockerfile
|
||||||
context: ../backend
|
context: ../backend
|
||||||
target: code
|
target: code
|
||||||
|
command: sleep 0
|
||||||
|
|
||||||
backend:
|
backend:
|
||||||
image: ocelotsocialnetwork/backend-branded:local-${CONFIGURATION}
|
image: ocelotsocialnetwork/backend-branded:local-${CONFIGURATION}
|
||||||
container_name: backend
|
container_name: backend
|
||||||
build:
|
build:
|
||||||
dockerfile: src/docker/backend.Dockerfile
|
dockerfile: src/docker/backend.Dockerfile
|
||||||
target: branded
|
target: branded-branded
|
||||||
context: .
|
context: .
|
||||||
args:
|
args:
|
||||||
- CONFIGURATION=$CONFIGURATION
|
- CONFIGURATION=$CONFIGURATION
|
||||||
@ -106,6 +110,7 @@ services:
|
|||||||
dockerfile: ../webapp/Dockerfile.maintenance
|
dockerfile: ../webapp/Dockerfile.maintenance
|
||||||
context: ../webapp
|
context: ../webapp
|
||||||
target: base
|
target: base
|
||||||
|
command: sleep 0
|
||||||
|
|
||||||
maintenance-code:
|
maintenance-code:
|
||||||
image: ocelotsocialnetwork/maintenance:local-code
|
image: ocelotsocialnetwork/maintenance:local-code
|
||||||
@ -113,11 +118,12 @@ services:
|
|||||||
dockerfile: ../webapp/Dockerfile.maintenance
|
dockerfile: ../webapp/Dockerfile.maintenance
|
||||||
context: ../webapp
|
context: ../webapp
|
||||||
target: code
|
target: code
|
||||||
|
command: sleep 0
|
||||||
|
|
||||||
maintenance:
|
maintenance:
|
||||||
# name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
|
# name the image so that it cannot be found in a DockerHub repository, otherwise it will not be built locally from the 'dockerfile' but pulled from there
|
||||||
image: ocelotsocialnetwork/maintenance-branded:local-${CONFIGURATION}
|
image: ocelotsocialnetwork/maintenance-branded:local-${CONFIGURATION}
|
||||||
container_name: maintenance
|
container_name: maintenance-branded
|
||||||
build:
|
build:
|
||||||
# TODO: Separate from webapp, this must be independent
|
# TODO: Separate from webapp, this must be independent
|
||||||
dockerfile: src/docker/maintenance.Dockerfile
|
dockerfile: src/docker/maintenance.Dockerfile
|
||||||
@ -152,7 +158,7 @@ services:
|
|||||||
|
|
||||||
mailserver:
|
mailserver:
|
||||||
image: djfarrelly/maildev
|
image: djfarrelly/maildev
|
||||||
container_name: mailserver
|
container_name: mailserver-branded
|
||||||
ports:
|
ports:
|
||||||
- 1080:80
|
- 1080:80
|
||||||
networks:
|
networks:
|
||||||
|
|||||||
@ -14,7 +14,12 @@ ARG CONFIGURATION=example
|
|||||||
# copy public constants into the Docker image to brand it
|
# copy public constants into the Docker image to brand it
|
||||||
COPY configurations/${CONFIGURATION}/branding/static/ static/
|
COPY configurations/${CONFIGURATION}/branding/static/ static/
|
||||||
COPY configurations/${CONFIGURATION}/branding/constants/ constants/
|
COPY configurations/${CONFIGURATION}/branding/constants/ constants/
|
||||||
COPY configurations/${CONFIGURATION}/branding/locales/ locales/
|
|
||||||
|
# locales
|
||||||
|
COPY configurations/${CONFIGURATION}/branding/locales/*.json locales/tmp/
|
||||||
|
COPY src/tools/ tools/
|
||||||
|
RUN apk add --no-cache bash jq
|
||||||
|
RUN tools/merge-locales.sh
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
# BUILD ##########################################################################
|
# BUILD ##########################################################################
|
||||||
|
|||||||
@ -12,17 +12,16 @@ FROM $APP_IMAGE_CODE as code
|
|||||||
ARG CONFIGURATION=example
|
ARG CONFIGURATION=example
|
||||||
|
|
||||||
# copy public constants into the Docker image to brand it
|
# copy public constants into the Docker image to brand it
|
||||||
COPY src/tools/ tools/
|
|
||||||
COPY configurations/${CONFIGURATION}/branding/static/ static/
|
COPY configurations/${CONFIGURATION}/branding/static/ static/
|
||||||
COPY configurations/${CONFIGURATION}/branding/constants/ constants/
|
COPY configurations/${CONFIGURATION}/branding/constants/ constants/
|
||||||
COPY configurations/${CONFIGURATION}/branding/locales/html/ locales/html/
|
COPY configurations/${CONFIGURATION}/branding/locales/html/ locales/html/
|
||||||
# COPY configurations/${CONFIGURATION}/branding/locales/index.js locales/index.js
|
|
||||||
COPY configurations/${CONFIGURATION}/branding/locales/*.json locales/tmp/
|
|
||||||
COPY configurations/${CONFIGURATION}/branding/assets/styles/imports/ assets/styles/imports/
|
COPY configurations/${CONFIGURATION}/branding/assets/styles/imports/ assets/styles/imports/
|
||||||
COPY configurations/${CONFIGURATION}/branding/assets/fonts/ assets/fonts/
|
COPY configurations/${CONFIGURATION}/branding/assets/fonts/ assets/fonts/
|
||||||
|
|
||||||
|
# locales
|
||||||
|
COPY configurations/${CONFIGURATION}/branding/locales/*.json locales/tmp/
|
||||||
|
COPY src/tools/ tools/
|
||||||
RUN apk add --no-cache bash jq
|
RUN apk add --no-cache bash jq
|
||||||
|
|
||||||
RUN tools/merge-locales.sh
|
RUN tools/merge-locales.sh
|
||||||
|
|
||||||
##################################################################################
|
##################################################################################
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import AvatarMenu from './AvatarMenu.vue'
|
import AvatarMenu from './AvatarMenu.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['router-link'] = '<span><slot /></span>'
|
'nuxt-link': true,
|
||||||
|
'router-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('AvatarMenu.vue', () => {
|
describe('AvatarMenu.vue', () => {
|
||||||
let propsData, getters, wrapper, mocks
|
let propsData, getters, wrapper, mocks
|
||||||
@ -34,7 +36,7 @@ describe('AvatarMenu.vue', () => {
|
|||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
getters,
|
getters,
|
||||||
})
|
})
|
||||||
return mount(AvatarMenu, { propsData, localVue, store, mocks })
|
return mount(AvatarMenu, { propsData, localVue, store, mocks, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
|
|||||||
@ -14,7 +14,7 @@ describe('Badges.vue', () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
it('has class "hc-badges"', () => {
|
it('has class "hc-badges"', () => {
|
||||||
expect(Wrapper().contains('.hc-badges')).toBe(true)
|
expect(Wrapper().find('.hc-badges').exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('given a badge', () => {
|
describe('given a badge', () => {
|
||||||
@ -23,7 +23,7 @@ describe('Badges.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('proxies badge icon, which is just a URL without metadata', () => {
|
it('proxies badge icon, which is just a URL without metadata', () => {
|
||||||
expect(Wrapper().contains('img[src="/api/path/to/some/icon"]')).toBe(true)
|
expect(Wrapper().find('img[src="/api/path/to/some/icon"]').exists()).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { shallowMount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
|
|
||||||
import Category from './index'
|
import Category from './index'
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ describe('Category', () => {
|
|||||||
let name
|
let name
|
||||||
|
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return shallowMount(Category, {
|
return mount(Category, {
|
||||||
localVue,
|
localVue,
|
||||||
propsData: {
|
propsData: {
|
||||||
icon,
|
icon,
|
||||||
@ -27,8 +27,9 @@ describe('Category', () => {
|
|||||||
it('shows Name', () => {
|
it('shows Name', () => {
|
||||||
expect(Wrapper().text()).toContain('Peter')
|
expect(Wrapper().text()).toContain('Peter')
|
||||||
})
|
})
|
||||||
it('shows Icon Svg', () => {
|
|
||||||
expect(Wrapper().contains('svg'))
|
it('shows base icon', () => {
|
||||||
|
expect(Wrapper().find('.base-icon').exists()).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import CommentCard from './CommentCard.vue'
|
import CommentCard from './CommentCard.vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
localVue.directive('scrollTo', jest.fn())
|
localVue.directive('scrollTo', jest.fn())
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
|
||||||
|
|
||||||
describe('CommentCard.vue', () => {
|
describe('CommentCard.vue', () => {
|
||||||
let propsData, mocks, stubs, getters, wrapper, Wrapper
|
let propsData, mocks, stubs, getters, wrapper, Wrapper
|
||||||
|
|
||||||
@ -46,6 +43,8 @@ describe('CommentCard.vue', () => {
|
|||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
ContentViewer: true,
|
ContentViewer: true,
|
||||||
|
'client-only': true,
|
||||||
|
'nuxt-link': true,
|
||||||
}
|
}
|
||||||
getters = {
|
getters = {
|
||||||
'auth/user': () => {
|
'auth/user': () => {
|
||||||
@ -56,7 +55,9 @@ describe('CommentCard.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
beforeEach(jest.useFakeTimers)
|
beforeEach(() => {
|
||||||
|
jest.useFakeTimers()
|
||||||
|
})
|
||||||
|
|
||||||
Wrapper = () => {
|
Wrapper = () => {
|
||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import CommentList from './CommentList'
|
import CommentList from './CommentList'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
@ -8,10 +8,6 @@ const localVue = global.localVue
|
|||||||
localVue.filter('truncate', (string) => string)
|
localVue.filter('truncate', (string) => string)
|
||||||
localVue.directive('scrollTo', jest.fn())
|
localVue.directive('scrollTo', jest.fn())
|
||||||
|
|
||||||
config.stubs['v-popover'] = '<span><slot /></span>'
|
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
|
||||||
|
|
||||||
describe('CommentList.vue', () => {
|
describe('CommentList.vue', () => {
|
||||||
let mocks, store, wrapper, propsData, stubs
|
let mocks, store, wrapper, propsData, stubs
|
||||||
|
|
||||||
@ -72,7 +68,10 @@ describe('CommentList.vue', () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
EditorContent: "<div class='stub'></div>",
|
EditorContent: true,
|
||||||
|
'v-popover': true,
|
||||||
|
'nuxt-link': true,
|
||||||
|
'client-only': true,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -92,7 +91,9 @@ describe('CommentList.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('scrollToAnchor mixin', () => {
|
describe('scrollToAnchor mixin', () => {
|
||||||
beforeEach(jest.useFakeTimers)
|
beforeEach(() => {
|
||||||
|
jest.useFakeTimers()
|
||||||
|
})
|
||||||
|
|
||||||
describe('$route.hash !== `#comments`', () => {
|
describe('$route.hash !== `#comments`', () => {
|
||||||
it('skips $scrollTo', () => {
|
it('skips $scrollTo', () => {
|
||||||
|
|||||||
@ -52,7 +52,7 @@ describe('ComponentSlider.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBe(true)
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('click on next Button', async () => {
|
it('click on next Button', async () => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount, createLocalVue } from '@vue/test-utils'
|
import { mount, createLocalVue } from '@vue/test-utils'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import VTooltip from 'v-tooltip'
|
import VTooltip from 'v-tooltip'
|
||||||
import Styleguide from '@human-connection/styleguide'
|
import Styleguide from '@human-connection/styleguide'
|
||||||
@ -10,7 +10,11 @@ localVue.use(Styleguide)
|
|||||||
localVue.use(VTooltip)
|
localVue.use(VTooltip)
|
||||||
localVue.use(Vuex)
|
localVue.use(Vuex)
|
||||||
|
|
||||||
config.stubs['router-link'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'router-link': {
|
||||||
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
let getters, mutations, mocks, menuToggle, openModalSpy
|
let getters, mutations, mocks, menuToggle, openModalSpy
|
||||||
|
|
||||||
@ -36,7 +40,7 @@ describe('ContentMenu.vue', () => {
|
|||||||
'auth/isAdmin': () => false,
|
'auth/isAdmin': () => false,
|
||||||
}
|
}
|
||||||
|
|
||||||
const openContentMenu = (values = {}) => {
|
const openContentMenu = async (values = {}) => {
|
||||||
const store = new Vuex.Store({ mutations, getters })
|
const store = new Vuex.Store({ mutations, getters })
|
||||||
const wrapper = mount(ContentMenu, {
|
const wrapper = mount(ContentMenu, {
|
||||||
propsData: {
|
propsData: {
|
||||||
@ -45,16 +49,17 @@ describe('ContentMenu.vue', () => {
|
|||||||
mocks,
|
mocks,
|
||||||
store,
|
store,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
menuToggle = wrapper.find('[data-test="content-menu-button"]')
|
menuToggle = wrapper.find('[data-test="content-menu-button"]')
|
||||||
menuToggle.trigger('click')
|
await menuToggle.trigger('click')
|
||||||
return wrapper
|
return wrapper
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('owner of contribution', () => {
|
describe('owner of contribution', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
beforeEach(() => {
|
beforeEach(async () => {
|
||||||
wrapper = openContentMenu({
|
wrapper = await openContentMenu({
|
||||||
isOwner: true,
|
isOwner: true,
|
||||||
resourceType: 'contribution',
|
resourceType: 'contribution',
|
||||||
resource: {
|
resource: {
|
||||||
@ -86,9 +91,9 @@ describe('ContentMenu.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('admin can', () => {
|
describe('admin can', () => {
|
||||||
it('pin unpinned post', () => {
|
it('pin unpinned post', async () => {
|
||||||
getters['auth/isAdmin'] = () => true
|
getters['auth/isAdmin'] = () => true
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'contribution',
|
resourceType: 'contribution',
|
||||||
resource: {
|
resource: {
|
||||||
@ -111,8 +116,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('unpin pinned post', () => {
|
it('unpin pinned post', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'contribution',
|
resourceType: 'contribution',
|
||||||
resource: {
|
resource: {
|
||||||
@ -135,11 +140,11 @@ describe('ContentMenu.vue', () => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can delete another user', () => {
|
it('can delete another user', async () => {
|
||||||
getters['auth/user'] = () => {
|
getters['auth/user'] = () => {
|
||||||
return { id: 'some-user', slug: 'some-user' }
|
return { id: 'some-user', slug: 'some-user' }
|
||||||
}
|
}
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
resourceType: 'user',
|
resourceType: 'user',
|
||||||
resource: {
|
resource: {
|
||||||
id: 'another-user',
|
id: 'another-user',
|
||||||
@ -161,8 +166,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can not delete the own account', () => {
|
it('can not delete the own account', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
resourceType: 'user',
|
resourceType: 'user',
|
||||||
resource: {
|
resource: {
|
||||||
id: 'some-user',
|
id: 'some-user',
|
||||||
@ -179,8 +184,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
|
|
||||||
describe('owner of comment can', () => {
|
describe('owner of comment can', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
beforeEach(() => {
|
beforeEach(async () => {
|
||||||
wrapper = openContentMenu({
|
wrapper = await openContentMenu({
|
||||||
isOwner: true,
|
isOwner: true,
|
||||||
resourceType: 'comment',
|
resourceType: 'comment',
|
||||||
resource: {
|
resource: {
|
||||||
@ -208,10 +213,10 @@ describe('ContentMenu.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('reporting', () => {
|
describe('reporting', () => {
|
||||||
it('a post of another user is possible', () => {
|
it('a post of another user is possible', async () => {
|
||||||
getters['auth/isAdmin'] = () => false
|
getters['auth/isAdmin'] = () => false
|
||||||
getters['auth/isModerator'] = () => false
|
getters['auth/isModerator'] = () => false
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'contribution',
|
resourceType: 'contribution',
|
||||||
resource: {
|
resource: {
|
||||||
@ -227,8 +232,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
expect(openModalSpy).toHaveBeenCalledWith('report')
|
expect(openModalSpy).toHaveBeenCalledWith('report')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('a comment of another user is possible', () => {
|
it('a comment of another user is possible', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'comment',
|
resourceType: 'comment',
|
||||||
resource: {
|
resource: {
|
||||||
@ -244,8 +249,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
expect(openModalSpy).toHaveBeenCalledWith('report')
|
expect(openModalSpy).toHaveBeenCalledWith('report')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('another user is possible', () => {
|
it('another user is possible', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'user',
|
resourceType: 'user',
|
||||||
resource: {
|
resource: {
|
||||||
@ -261,8 +266,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
expect(openModalSpy).toHaveBeenCalledWith('report')
|
expect(openModalSpy).toHaveBeenCalledWith('report')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('another organization is possible', () => {
|
it('another organization is possible', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'organization',
|
resourceType: 'organization',
|
||||||
resource: {
|
resource: {
|
||||||
@ -280,10 +285,10 @@ describe('ContentMenu.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('moderator', () => {
|
describe('moderator', () => {
|
||||||
it('can disable posts', () => {
|
it('can disable posts', async () => {
|
||||||
getters['auth/isAdmin'] = () => false
|
getters['auth/isAdmin'] = () => false
|
||||||
getters['auth/isModerator'] = () => true
|
getters['auth/isModerator'] = () => true
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'contribution',
|
resourceType: 'contribution',
|
||||||
resource: {
|
resource: {
|
||||||
@ -300,8 +305,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can disable comments', () => {
|
it('can disable comments', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'comment',
|
resourceType: 'comment',
|
||||||
resource: {
|
resource: {
|
||||||
@ -318,8 +323,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can disable users', () => {
|
it('can disable users', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'user',
|
resourceType: 'user',
|
||||||
resource: {
|
resource: {
|
||||||
@ -336,8 +341,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can disable organizations', () => {
|
it('can disable organizations', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'organization',
|
resourceType: 'organization',
|
||||||
resource: {
|
resource: {
|
||||||
@ -354,8 +359,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
expect(openModalSpy).toHaveBeenCalledWith('disable')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can release posts', () => {
|
it('can release posts', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'contribution',
|
resourceType: 'contribution',
|
||||||
resource: {
|
resource: {
|
||||||
@ -372,8 +377,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
expect(openModalSpy).toHaveBeenCalledWith('release')
|
expect(openModalSpy).toHaveBeenCalledWith('release')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can release comments', () => {
|
it('can release comments', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'comment',
|
resourceType: 'comment',
|
||||||
resource: {
|
resource: {
|
||||||
@ -390,8 +395,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
expect(openModalSpy).toHaveBeenCalledWith('release')
|
expect(openModalSpy).toHaveBeenCalledWith('release')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can release users', () => {
|
it('can release users', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'user',
|
resourceType: 'user',
|
||||||
resource: {
|
resource: {
|
||||||
@ -408,8 +413,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
expect(openModalSpy).toHaveBeenCalledWith('release')
|
expect(openModalSpy).toHaveBeenCalledWith('release')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can release organizations', () => {
|
it('can release organizations', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'organization',
|
resourceType: 'organization',
|
||||||
resource: {
|
resource: {
|
||||||
@ -428,10 +433,10 @@ describe('ContentMenu.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('user', () => {
|
describe('user', () => {
|
||||||
it('can access settings', () => {
|
it('can access settings', async () => {
|
||||||
getters['auth/isAdmin'] = () => false
|
getters['auth/isAdmin'] = () => false
|
||||||
getters['auth/isModerator'] = () => false
|
getters['auth/isModerator'] = () => false
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: true,
|
isOwner: true,
|
||||||
resourceType: 'user',
|
resourceType: 'user',
|
||||||
resource: {
|
resource: {
|
||||||
@ -448,8 +453,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
).toBe('/settings')
|
).toBe('/settings')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can mute other users', () => {
|
it('can mute other users', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'user',
|
resourceType: 'user',
|
||||||
resource: {
|
resource: {
|
||||||
@ -472,8 +477,8 @@ describe('ContentMenu.vue', () => {
|
|||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can unmute muted users', () => {
|
it('can unmute muted users', async () => {
|
||||||
const wrapper = openContentMenu({
|
const wrapper = await openContentMenu({
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
resourceType: 'user',
|
resourceType: 'user',
|
||||||
resource: {
|
resource: {
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import GroupContentMenu from './GroupContentMenu.vue'
|
import GroupContentMenu from './GroupContentMenu.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['router-link'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'router-link': {
|
||||||
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
const propsData = {
|
const propsData = {
|
||||||
usage: 'groupTeaser',
|
usage: 'groupTeaser',
|
||||||
@ -24,7 +28,7 @@ describe('GroupContentMenu', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(GroupContentMenu, { propsData, mocks, localVue })
|
return mount(GroupContentMenu, { propsData, mocks, localVue, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import ContributionForm from './ContributionForm.vue'
|
import ContributionForm from './ContributionForm.vue'
|
||||||
|
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
@ -11,9 +11,11 @@ global.MutationObserver = MutationObserver
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
'client-only': true,
|
||||||
config.stubs['v-popover'] = '<span><slot /></span>'
|
'nuxt-link': true,
|
||||||
|
'v-popover': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('ContributionForm.vue', () => {
|
describe('ContributionForm.vue', () => {
|
||||||
let wrapper, postTitleInput, expectedParams, cancelBtn, mocks, propsData
|
let wrapper, postTitleInput, expectedParams, cancelBtn, mocks, propsData
|
||||||
@ -88,6 +90,7 @@ describe('ContributionForm.vue', () => {
|
|||||||
localVue,
|
localVue,
|
||||||
store,
|
store,
|
||||||
propsData,
|
propsData,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +166,7 @@ describe('ContributionForm.vue', () => {
|
|||||||
.mockImplementation(function () {
|
.mockImplementation(function () {
|
||||||
this.onload({ target: { result: 'someUrlToImage' } })
|
this.onload({ target: { result: 'someUrlToImage' } })
|
||||||
})
|
})
|
||||||
wrapper.find(ImageUploader).vm.$emit('addHeroImage', imageUpload)
|
wrapper.findComponent(ImageUploader).vm.$emit('addHeroImage', imageUpload)
|
||||||
await wrapper.find('form').trigger('submit')
|
await wrapper.find('form').trigger('submit')
|
||||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expect.objectContaining(expectedParams))
|
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expect.objectContaining(expectedParams))
|
||||||
expect(spy).toHaveBeenCalledWith(imageUpload)
|
expect(spy).toHaveBeenCalledWith(imageUpload)
|
||||||
|
|||||||
@ -115,9 +115,9 @@ describe('DeleteData.vue', () => {
|
|||||||
enableContributionDeletionCheckbox = wrapper.find(
|
enableContributionDeletionCheckbox = wrapper.find(
|
||||||
'[data-test="contributions-deletion-checkbox"]',
|
'[data-test="contributions-deletion-checkbox"]',
|
||||||
)
|
)
|
||||||
enableContributionDeletionCheckbox.trigger('click')
|
enableContributionDeletionCheckbox.setChecked(true)
|
||||||
enableCommentDeletionCheckbox = wrapper.find('[data-test="comments-deletion-checkbox"]')
|
enableCommentDeletionCheckbox = wrapper.find('[data-test="comments-deletion-checkbox"]')
|
||||||
enableCommentDeletionCheckbox.trigger('click')
|
enableCommentDeletionCheckbox.setChecked(true)
|
||||||
deleteAccountBtn.trigger('click')
|
deleteAccountBtn.trigger('click')
|
||||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
@ -133,7 +133,7 @@ describe('DeleteData.vue', () => {
|
|||||||
enableContributionDeletionCheckbox = wrapper.find(
|
enableContributionDeletionCheckbox = wrapper.find(
|
||||||
'[data-test="contributions-deletion-checkbox"]',
|
'[data-test="contributions-deletion-checkbox"]',
|
||||||
)
|
)
|
||||||
enableContributionDeletionCheckbox.trigger('click')
|
enableContributionDeletionCheckbox.setChecked(true)
|
||||||
deleteAccountBtn.trigger('click')
|
deleteAccountBtn.trigger('click')
|
||||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
@ -147,7 +147,7 @@ describe('DeleteData.vue', () => {
|
|||||||
|
|
||||||
it("deletes a user's comments if requested", () => {
|
it("deletes a user's comments if requested", () => {
|
||||||
enableCommentDeletionCheckbox = wrapper.find('[data-test="comments-deletion-checkbox"]')
|
enableCommentDeletionCheckbox = wrapper.find('[data-test="comments-deletion-checkbox"]')
|
||||||
enableCommentDeletionCheckbox.trigger('click')
|
enableCommentDeletionCheckbox.setChecked(true)
|
||||||
deleteAccountBtn.trigger('click')
|
deleteAccountBtn.trigger('click')
|
||||||
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
expect(mocks.$apollo.mutate).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
|
|||||||
@ -35,7 +35,7 @@ describe('Editor.vue', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(Wrapper().is('div')).toBe(true)
|
expect(Wrapper().element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('given a piece of text', () => {
|
describe('given a piece of text', () => {
|
||||||
|
|||||||
@ -42,7 +42,7 @@ describe('Embed.vue', () => {
|
|||||||
propsData.node = { attrs: { href: 'https://www.youtube.com/watch?v=qkdXAtO40Fo' } }
|
propsData.node = { attrs: { href: 'https://www.youtube.com/watch?v=qkdXAtO40Fo' } }
|
||||||
const wrapper = Wrapper({ propsData })
|
const wrapper = Wrapper({ propsData })
|
||||||
await wrapper.html()
|
await wrapper.html()
|
||||||
expect(wrapper.contains('embed-component-stub')).toBe(true)
|
expect(wrapper.find('embed-component-stub').exists()).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -160,7 +160,7 @@ describe('EmbedComponent.vue', () => {
|
|||||||
|
|
||||||
describe('sets permanently', () => {
|
describe('sets permanently', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
wrapper.find('input[type=checkbox]').trigger('click')
|
wrapper.find('input[type=checkbox]').setChecked(true)
|
||||||
wrapper.find('[data-test="play-now-button"]').trigger('click')
|
wrapper.find('[data-test="play-now-button"]').trigger('click')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,9 @@ describe('EnterNonce ', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
beforeEach(jest.useFakeTimers)
|
beforeEach(() => {
|
||||||
|
jest.useFakeTimers()
|
||||||
|
})
|
||||||
|
|
||||||
Wrapper = () => {
|
Wrapper = () => {
|
||||||
return mount(EnterNonce, {
|
return mount(EnterNonce, {
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import GroupForm from './GroupForm.vue'
|
import GroupForm from './GroupForm.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
const propsData = {
|
const propsData = {
|
||||||
update: false,
|
update: false,
|
||||||
@ -25,7 +27,7 @@ describe('GroupForm', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(GroupForm, { propsData, mocks, localVue })
|
return mount(GroupForm, { propsData, mocks, localVue, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import { config, shallowMount } from '@vue/test-utils'
|
import { shallowMount } from '@vue/test-utils'
|
||||||
|
|
||||||
import Hashtag from './Hashtag'
|
import Hashtag from './Hashtag'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('Hashtag', () => {
|
describe('Hashtag', () => {
|
||||||
let id
|
let id
|
||||||
@ -15,6 +17,7 @@ describe('Hashtag', () => {
|
|||||||
propsData: {
|
propsData: {
|
||||||
id,
|
id,
|
||||||
},
|
},
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ describe('HashtagsFilter.vue', () => {
|
|||||||
|
|
||||||
it('renders a card', () => {
|
it('renders a card', () => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
expect(wrapper.is('.base-card')).toBe(true)
|
expect(wrapper.classes('base-card')).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('click clear search button', () => {
|
describe('click clear search button', () => {
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import InviteButton from './InviteButton.vue'
|
import InviteButton from './InviteButton.vue'
|
||||||
|
|
||||||
config.stubs['v-popover'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'v-popover': {
|
||||||
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
describe('InviteButton.vue', () => {
|
describe('InviteButton.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -22,7 +26,7 @@ describe('InviteButton.vue', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(InviteButton, { mocks, propsData })
|
return mount(InviteButton, { mocks, propsData, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@ -30,12 +34,12 @@ describe('InviteButton.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.contains('.invite-button')).toBe(true)
|
expect(wrapper.find('.invite-button').exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('open popup', () => {
|
it('open popup', () => {
|
||||||
wrapper.find('.base-button').trigger('click')
|
wrapper.find('.base-button').trigger('click')
|
||||||
expect(wrapper.contains('.invite-button')).toBe(true)
|
expect(wrapper.find('.invite-button').exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('invite codes not available', async () => {
|
it('invite codes not available', async () => {
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
|
|
||||||
import LocaleSwitch from './LocaleSwitch.vue'
|
import LocaleSwitch from './LocaleSwitch.vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'client-only': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('LocaleSwitch.vue', () => {
|
describe('LocaleSwitch.vue', () => {
|
||||||
let wrapper, mocks, computed, deutschLanguageItem, getters
|
let wrapper, mocks, computed, deutschLanguageItem, getters
|
||||||
@ -65,7 +67,7 @@ describe('LocaleSwitch.vue', () => {
|
|||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
getters,
|
getters,
|
||||||
})
|
})
|
||||||
return mount(LocaleSwitch, { mocks, localVue, computed, store })
|
return mount(LocaleSwitch, { mocks, localVue, computed, store, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('with current user', () => {
|
describe('with current user', () => {
|
||||||
|
|||||||
@ -1,7 +1,10 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import LoginButton from './LoginButton.vue'
|
import LoginButton from './LoginButton.vue'
|
||||||
|
|
||||||
config.stubs['v-popover'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'v-popover': true,
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('LoginButton.vue', () => {
|
describe('LoginButton.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -22,7 +25,7 @@ describe('LoginButton.vue', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(LoginButton, { mocks, propsData })
|
return mount(LoginButton, { mocks, propsData, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@ -30,12 +33,12 @@ describe('LoginButton.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.contains('.login-button')).toBe(true)
|
expect(wrapper.find('.login-button').exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('open popup', () => {
|
it('open popup', () => {
|
||||||
wrapper.find('.base-button').trigger('click')
|
wrapper.find('.base-button').trigger('click')
|
||||||
expect(wrapper.contains('.login-button')).toBe(true)
|
expect(wrapper.find('.login-button').exists()).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -2,15 +2,17 @@ import Vue from 'vue'
|
|||||||
import LoginForm from './LoginForm.vue'
|
import LoginForm from './LoginForm.vue'
|
||||||
import Styleguide from '@human-connection/styleguide'
|
import Styleguide from '@human-connection/styleguide'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import { config, mount, createLocalVue } from '@vue/test-utils'
|
import { mount, createLocalVue } from '@vue/test-utils'
|
||||||
|
|
||||||
const localVue = createLocalVue()
|
const localVue = createLocalVue()
|
||||||
localVue.use(Vuex)
|
localVue.use(Vuex)
|
||||||
localVue.use(Styleguide)
|
localVue.use(Styleguide)
|
||||||
|
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['locale-switch'] = '<span><slot /></span>'
|
'nuxt-link': true,
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
'locale-switch': true,
|
||||||
|
'client-only': true,
|
||||||
|
}
|
||||||
|
|
||||||
const authUserMock = jest.fn().mockReturnValue({ activeCategories: [] })
|
const authUserMock = jest.fn().mockReturnValue({ activeCategories: [] })
|
||||||
|
|
||||||
@ -46,7 +48,7 @@ describe('LoginForm', () => {
|
|||||||
error: jest.fn(),
|
error: jest.fn(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
return mount(LoginForm, { mocks, localVue, propsData, store })
|
return mount(LoginForm, { mocks, localVue, propsData, store, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('fill in email and password and submit', () => {
|
describe('fill in email and password and submit', () => {
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import MasonryGridItem from './MasonryGridItem'
|
import MasonryGridItem from './MasonryGridItem'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['ds-grid-item'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'ds-grid-item': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('MasonryGridItem', () => {
|
describe('MasonryGridItem', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -11,34 +13,34 @@ describe('MasonryGridItem', () => {
|
|||||||
describe('given an imageAspectRatio', () => {
|
describe('given an imageAspectRatio', () => {
|
||||||
it('sets the initial rowSpan to 13 when the ratio is higher than 1.3', () => {
|
it('sets the initial rowSpan to 13 when the ratio is higher than 1.3', () => {
|
||||||
const propsData = { imageAspectRatio: 2 }
|
const propsData = { imageAspectRatio: 2 }
|
||||||
wrapper = mount(MasonryGridItem, { localVue, propsData })
|
wrapper = mount(MasonryGridItem, { localVue, propsData, stubs })
|
||||||
|
|
||||||
expect(wrapper.vm.rowSpan).toBe(13)
|
expect(wrapper.vm.rowSpan).toBe(13)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('sets the initial rowSpan to 15 when the ratio is between 1.3 and 1', () => {
|
it('sets the initial rowSpan to 15 when the ratio is between 1.3 and 1', () => {
|
||||||
const propsData = { imageAspectRatio: 1.1 }
|
const propsData = { imageAspectRatio: 1.1 }
|
||||||
wrapper = mount(MasonryGridItem, { localVue, propsData })
|
wrapper = mount(MasonryGridItem, { localVue, propsData, stubs })
|
||||||
|
|
||||||
expect(wrapper.vm.rowSpan).toBe(15)
|
expect(wrapper.vm.rowSpan).toBe(15)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('sets the initial rowSpan to 18 when the ratio is between 1 and 0.7', () => {
|
it('sets the initial rowSpan to 18 when the ratio is between 1 and 0.7', () => {
|
||||||
const propsData = { imageAspectRatio: 0.7 }
|
const propsData = { imageAspectRatio: 0.7 }
|
||||||
wrapper = mount(MasonryGridItem, { localVue, propsData })
|
wrapper = mount(MasonryGridItem, { localVue, propsData, stubs })
|
||||||
|
|
||||||
expect(wrapper.vm.rowSpan).toBe(18)
|
expect(wrapper.vm.rowSpan).toBe(18)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('sets the initial rowSpan to 25 when the ratio is lower than 0.7', () => {
|
it('sets the initial rowSpan to 25 when the ratio is lower than 0.7', () => {
|
||||||
const propsData = { imageAspectRatio: 0.3 }
|
const propsData = { imageAspectRatio: 0.3 }
|
||||||
wrapper = mount(MasonryGridItem, { localVue, propsData })
|
wrapper = mount(MasonryGridItem, { localVue, propsData, stubs })
|
||||||
expect(wrapper.vm.rowSpan).toBe(25)
|
expect(wrapper.vm.rowSpan).toBe(25)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('given no aspect ratio', () => {
|
describe('given no aspect ratio', () => {
|
||||||
it('sets the initial rowSpan to 8 when not given an imageAspectRatio', () => {
|
it('sets the initial rowSpan to 8 when not given an imageAspectRatio', () => {
|
||||||
wrapper = mount(MasonryGridItem, { localVue })
|
wrapper = mount(MasonryGridItem, { localVue, stubs })
|
||||||
expect(wrapper.vm.rowSpan).toBe(8)
|
expect(wrapper.vm.rowSpan).toBe(8)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -57,9 +57,9 @@ describe('Modal.vue', () => {
|
|||||||
|
|
||||||
it('initially empty', () => {
|
it('initially empty', () => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
expect(wrapper.contains(ConfirmModal)).toBe(false)
|
expect(wrapper.findComponent(ConfirmModal).exists()).toBe(false)
|
||||||
expect(wrapper.contains(DisableModal)).toBe(false)
|
expect(wrapper.findComponent(DisableModal).exists()).toBe(false)
|
||||||
expect(wrapper.contains(ReportModal)).toBe(false)
|
expect(wrapper.findComponent(ReportModal).exists()).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('store/modal holds data to disable', () => {
|
describe('store/modal holds data to disable', () => {
|
||||||
@ -78,11 +78,11 @@ describe('Modal.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders disable modal', () => {
|
it('renders disable modal', () => {
|
||||||
expect(wrapper.contains(DisableModal)).toBe(true)
|
expect(wrapper.findComponent(DisableModal).exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('passes data to disable modal', () => {
|
it('passes data to disable modal', () => {
|
||||||
expect(wrapper.find(DisableModal).props()).toEqual({
|
expect(wrapper.findComponent(DisableModal).props()).toEqual({
|
||||||
type: 'contribution',
|
type: 'contribution',
|
||||||
name: 'some title',
|
name: 'some title',
|
||||||
id: 'c456',
|
id: 'c456',
|
||||||
@ -91,9 +91,9 @@ describe('Modal.vue', () => {
|
|||||||
|
|
||||||
describe('child component emits close', () => {
|
describe('child component emits close', () => {
|
||||||
it('turns empty', async () => {
|
it('turns empty', async () => {
|
||||||
wrapper.find(DisableModal).vm.$emit('close')
|
wrapper.findComponent(DisableModal).vm.$emit('close')
|
||||||
await Vue.nextTick()
|
await Vue.nextTick()
|
||||||
expect(wrapper.contains(DisableModal)).toBe(false)
|
expect(wrapper.findComponent(DisableModal).exists()).toBe(false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ describe('Modal.vue', () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
expect(wrapper.find(DisableModal).props()).toEqual({
|
expect(wrapper.findComponent(DisableModal).props()).toEqual({
|
||||||
type: 'comment',
|
type: 'comment',
|
||||||
name: 'Author name',
|
name: 'Author name',
|
||||||
id: 'c456',
|
id: 'c456',
|
||||||
@ -124,7 +124,7 @@ describe('Modal.vue', () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
expect(wrapper.find(DisableModal).props()).toEqual({
|
expect(wrapper.findComponent(DisableModal).props()).toEqual({
|
||||||
type: 'comment',
|
type: 'comment',
|
||||||
name: '',
|
name: '',
|
||||||
id: 'c456',
|
id: 'c456',
|
||||||
@ -142,7 +142,7 @@ describe('Modal.vue', () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
expect(wrapper.find(DisableModal).props()).toEqual({
|
expect(wrapper.findComponent(DisableModal).props()).toEqual({
|
||||||
type: 'user',
|
type: 'user',
|
||||||
name: 'Username',
|
name: 'Username',
|
||||||
id: 'u456',
|
id: 'u456',
|
||||||
@ -160,7 +160,7 @@ describe('Modal.vue', () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
expect(wrapper.find(DisableModal).props()).toEqual({
|
expect(wrapper.findComponent(DisableModal).props()).toEqual({
|
||||||
type: 'something',
|
type: 'something',
|
||||||
name: null,
|
name: null,
|
||||||
id: 's456',
|
id: 's456',
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
import { config, shallowMount, mount } from '@vue/test-utils'
|
import { shallowMount, mount } from '@vue/test-utils'
|
||||||
|
|
||||||
import ConfirmModal from './ConfirmModal.vue'
|
import ConfirmModal from './ConfirmModal.vue'
|
||||||
import { postMenuModalsData } from '~/components/utils/PostHelpers'
|
import { postMenuModalsData } from '~/components/utils/PostHelpers'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['sweetalert-icon'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'sweetalert-icon': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('ConfirmModal.vue', () => {
|
describe('ConfirmModal.vue', () => {
|
||||||
let Wrapper
|
let Wrapper
|
||||||
@ -41,6 +43,7 @@ describe('ConfirmModal.vue', () => {
|
|||||||
propsData,
|
propsData,
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -90,10 +93,13 @@ describe('ConfirmModal.vue', () => {
|
|||||||
propsData,
|
propsData,
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(jest.useFakeTimers)
|
beforeEach(() => {
|
||||||
|
jest.useFakeTimers()
|
||||||
|
})
|
||||||
|
|
||||||
describe('given post id', () => {
|
describe('given post id', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
import { config, mount, shallowMount } from '@vue/test-utils'
|
import { mount, shallowMount } from '@vue/test-utils'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import DeleteUserModal from './DeleteUserModal.vue'
|
import DeleteUserModal from './DeleteUserModal.vue'
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
config.stubs['sweetalert-icon'] = '<span><slot /></span>'
|
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'sweetalert-icon': true,
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
localVue.use(DeleteUserModal)
|
localVue.use(DeleteUserModal)
|
||||||
|
|
||||||
@ -49,6 +52,7 @@ describe('DeleteUserModal.vue', () => {
|
|||||||
mocks,
|
mocks,
|
||||||
store,
|
store,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,9 +78,12 @@ describe('DeleteUserModal.vue', () => {
|
|||||||
mocks,
|
mocks,
|
||||||
store,
|
store,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
beforeEach(jest.useFakeTimers)
|
beforeEach(() => {
|
||||||
|
jest.useFakeTimers()
|
||||||
|
})
|
||||||
|
|
||||||
describe('given another user', () => {
|
describe('given another user', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@ -102,7 +102,9 @@ describe('DisableModal.vue', () => {
|
|||||||
localVue,
|
localVue,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
beforeEach(jest.useFakeTimers)
|
beforeEach(() => {
|
||||||
|
jest.useFakeTimers()
|
||||||
|
})
|
||||||
|
|
||||||
describe('given id', () => {
|
describe('given id', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import { config, shallowMount, mount } from '@vue/test-utils'
|
import { shallowMount, mount } from '@vue/test-utils'
|
||||||
import ReportModal from './ReportModal.vue'
|
import ReportModal from './ReportModal.vue'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['sweetalert-icon'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'sweetalert-icon': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('ReportModal.vue', () => {
|
describe('ReportModal.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -39,6 +41,7 @@ describe('ReportModal.vue', () => {
|
|||||||
propsData,
|
propsData,
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,13 +112,16 @@ describe('ReportModal.vue', () => {
|
|||||||
propsData,
|
propsData,
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(jest.useFakeTimers)
|
beforeEach(() => {
|
||||||
|
jest.useFakeTimers()
|
||||||
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(Wrapper().is('div')).toBe(true)
|
expect(Wrapper().element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('given id', () => {
|
describe('given id', () => {
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
import { config, mount, RouterLinkStub } from '@vue/test-utils'
|
import { mount, RouterLinkStub } from '@vue/test-utils'
|
||||||
import Notification from './Notification.vue'
|
import Notification from './Notification.vue'
|
||||||
|
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
|
||||||
|
|
||||||
describe('Notification', () => {
|
describe('Notification', () => {
|
||||||
let stubs
|
let stubs
|
||||||
let getters
|
let getters
|
||||||
@ -20,6 +18,7 @@ describe('Notification', () => {
|
|||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
NuxtLink: RouterLinkStub,
|
NuxtLink: RouterLinkStub,
|
||||||
|
'client-only': true,
|
||||||
}
|
}
|
||||||
getters = {
|
getters = {
|
||||||
'auth/user': () => {
|
'auth/user': () => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, shallowMount, mount, RouterLinkStub } from '@vue/test-utils'
|
import { shallowMount, mount, RouterLinkStub } from '@vue/test-utils'
|
||||||
import NotificationList from './NotificationList'
|
import NotificationList from './NotificationList'
|
||||||
import Notification from '../Notification/Notification'
|
import Notification from '../Notification/Notification'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
@ -9,9 +9,6 @@ const localVue = global.localVue
|
|||||||
|
|
||||||
localVue.filter('truncate', (string) => string)
|
localVue.filter('truncate', (string) => string)
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
|
||||||
config.stubs['v-popover'] = '<span><slot /></span>'
|
|
||||||
|
|
||||||
describe('NotificationList.vue', () => {
|
describe('NotificationList.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
let mocks
|
let mocks
|
||||||
@ -33,6 +30,8 @@ describe('NotificationList.vue', () => {
|
|||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
NuxtLink: RouterLinkStub,
|
NuxtLink: RouterLinkStub,
|
||||||
|
'client-only': true,
|
||||||
|
'v-popover': true,
|
||||||
}
|
}
|
||||||
propsData = { notifications }
|
propsData = { notifications }
|
||||||
})
|
})
|
||||||
@ -44,6 +43,7 @@ describe('NotificationList.vue', () => {
|
|||||||
mocks,
|
mocks,
|
||||||
store,
|
store,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ describe('NotificationList.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders Notification.vue for each notification of the user', () => {
|
it('renders Notification.vue for each notification of the user', () => {
|
||||||
expect(wrapper.findAll(Notification)).toHaveLength(2)
|
expect(wrapper.findAllComponents(Notification)).toHaveLength(2)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ describe('NotificationList.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders Notification.vue zero times', () => {
|
it('renders Notification.vue zero times', () => {
|
||||||
expect(wrapper.findAll(Notification)).toHaveLength(0)
|
expect(wrapper.findAllComponents(Notification)).toHaveLength(0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,12 +1,10 @@
|
|||||||
import { config, mount, RouterLinkStub } from '@vue/test-utils'
|
import { mount, RouterLinkStub } from '@vue/test-utils'
|
||||||
import NotificationMenu from './NotificationMenu'
|
import NotificationMenu from './NotificationMenu'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
localVue.filter('truncate', (string) => string)
|
localVue.filter('truncate', (string) => string)
|
||||||
|
|
||||||
config.stubs.dropdown = '<span class="dropdown"><slot :toggleMenu="() => null" /></span>'
|
|
||||||
|
|
||||||
describe('NotificationMenu.vue', () => {
|
describe('NotificationMenu.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
let mocks
|
let mocks
|
||||||
@ -23,6 +21,8 @@ describe('NotificationMenu.vue', () => {
|
|||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
NuxtLink: RouterLinkStub,
|
NuxtLink: RouterLinkStub,
|
||||||
|
UserTeaser: true,
|
||||||
|
'client-only': true,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -38,13 +38,13 @@ describe('NotificationMenu.vue', () => {
|
|||||||
|
|
||||||
it('renders as link without counter', () => {
|
it('renders as link without counter', () => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
expect(wrapper.is('a.notifications-menu')).toBe(true)
|
expect(wrapper.classes('notifications-menu')).toBe(true)
|
||||||
expect(() => wrapper.get('.count')).toThrow()
|
expect(() => wrapper.get('.count')).toThrow()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('no dropdown is rendered', () => {
|
it('no dropdown is rendered', () => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
expect(wrapper.contains('.dropdown')).toBe(false)
|
expect(wrapper.find('.dropdown').exists()).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('given only read notifications', () => {
|
describe('given only read notifications', () => {
|
||||||
@ -73,13 +73,13 @@ describe('NotificationMenu.vue', () => {
|
|||||||
|
|
||||||
it('renders as link without counter', () => {
|
it('renders as link without counter', () => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
expect(wrapper.is('a.notifications-menu')).toBe(true)
|
expect(wrapper.classes('notifications-menu')).toBe(true)
|
||||||
expect(() => wrapper.get('.count')).toThrow()
|
expect(() => wrapper.get('.count')).toThrow()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('no dropdown is rendered', () => {
|
it('no dropdown is rendered', () => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
expect(wrapper.contains('.dropdown')).toBe(false)
|
expect(wrapper.find('.dropdown').exists()).toBe(false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -101,6 +101,14 @@ describe('NotificationMenu.vue', () => {
|
|||||||
name: 'John Doe',
|
name: 'John Doe',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
from: {
|
||||||
|
title: 'Title',
|
||||||
|
author: {
|
||||||
|
id: 'reporter',
|
||||||
|
slug: 'reporter',
|
||||||
|
name: 'reporter',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'notification-42',
|
id: 'notification-42',
|
||||||
@ -115,6 +123,14 @@ describe('NotificationMenu.vue', () => {
|
|||||||
name: 'John Doe',
|
name: 'John Doe',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
from: {
|
||||||
|
title: 'Title',
|
||||||
|
author: {
|
||||||
|
id: 'reporter',
|
||||||
|
slug: 'reporter',
|
||||||
|
name: 'reporter',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'notification-43',
|
id: 'notification-43',
|
||||||
@ -129,6 +145,14 @@ describe('NotificationMenu.vue', () => {
|
|||||||
name: 'John Doe',
|
name: 'John Doe',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
from: {
|
||||||
|
title: 'Title',
|
||||||
|
author: {
|
||||||
|
id: 'reporter',
|
||||||
|
slug: 'reporter',
|
||||||
|
name: 'reporter',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount, RouterLinkStub } from '@vue/test-utils'
|
import { mount, RouterLinkStub } from '@vue/test-utils'
|
||||||
|
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import NotificationsTable from './NotificationsTable'
|
import NotificationsTable from './NotificationsTable'
|
||||||
@ -8,8 +8,6 @@ const localVue = global.localVue
|
|||||||
|
|
||||||
localVue.filter('truncate', (string) => string)
|
localVue.filter('truncate', (string) => string)
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
|
||||||
|
|
||||||
describe('NotificationsTable.vue', () => {
|
describe('NotificationsTable.vue', () => {
|
||||||
let wrapper, mocks, propsData, stubs
|
let wrapper, mocks, propsData, stubs
|
||||||
const postNotification = notifications[0]
|
const postNotification = notifications[0]
|
||||||
@ -21,6 +19,7 @@ describe('NotificationsTable.vue', () => {
|
|||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
NuxtLink: RouterLinkStub,
|
NuxtLink: RouterLinkStub,
|
||||||
|
'client-only': true,
|
||||||
}
|
}
|
||||||
propsData = {}
|
propsData = {}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import PageFooter from './PageFooter.vue'
|
import PageFooter from './PageFooter.vue'
|
||||||
import linksDefault from '~/constants/links.js'
|
import linksDefault from '~/constants/links.js'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['nuxt-link'] = '<span class="nuxt-link"><slot /></span>'
|
const stubs = {
|
||||||
|
'nuxt-link': {
|
||||||
|
template: '<span class="nuxt-link"><slot /></span>',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
describe('PageFooter.vue', () => {
|
describe('PageFooter.vue', () => {
|
||||||
let mocks
|
let mocks
|
||||||
@ -21,7 +25,7 @@ describe('PageFooter.vue', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(PageFooter, { mocks, localVue })
|
return mount(PageFooter, { mocks, localVue, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('links.js', () => {
|
describe('links.js', () => {
|
||||||
|
|||||||
@ -90,9 +90,8 @@ describe('ChangePassword.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('submit form', () => {
|
describe('submit form', () => {
|
||||||
beforeEach(async (done) => {
|
beforeEach(async () => {
|
||||||
await wrapper.find('form').trigger('submit')
|
await wrapper.find('form').trigger('submit')
|
||||||
done()
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('calls changePassword mutation', () => {
|
it('calls changePassword mutation', () => {
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import ChangePassword from './ChangePassword'
|
import ChangePassword from './ChangePassword'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['sweetalert-icon'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'sweetalert-icon': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('ChangePassword ', () => {
|
describe('ChangePassword ', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -27,13 +29,16 @@ describe('ChangePassword ', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
beforeEach(jest.useFakeTimers)
|
beforeEach(() => {
|
||||||
|
jest.useFakeTimers()
|
||||||
|
})
|
||||||
|
|
||||||
Wrapper = () => {
|
Wrapper = () => {
|
||||||
return mount(ChangePassword, {
|
return mount(ChangePassword, {
|
||||||
mocks,
|
mocks,
|
||||||
propsData,
|
propsData,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,8 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Request from './Request'
|
import Request from './Request'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['sweetalert-icon'] = '<span><slot /></span>'
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
|
||||||
|
|
||||||
describe('Request', () => {
|
describe('Request', () => {
|
||||||
let wrapper, Wrapper, mocks, stubs
|
let wrapper, Wrapper, mocks, stubs
|
||||||
|
|
||||||
@ -26,12 +22,17 @@ describe('Request', () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
LocaleSwitch: "<div class='stub'></div>",
|
LocaleSwitch: true,
|
||||||
|
'sweetalert-icon': true,
|
||||||
|
'client-only': true,
|
||||||
|
'nuxt-link': true,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
beforeEach(jest.useFakeTimers)
|
beforeEach(() => {
|
||||||
|
jest.useFakeTimers()
|
||||||
|
})
|
||||||
|
|
||||||
Wrapper = () => {
|
Wrapper = () => {
|
||||||
return mount(Request, {
|
return mount(Request, {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, shallowMount, mount, RouterLinkStub } from '@vue/test-utils'
|
import { shallowMount, mount, RouterLinkStub } from '@vue/test-utils'
|
||||||
|
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
|
|
||||||
@ -6,9 +6,6 @@ import PostTeaser from './PostTeaser.vue'
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
|
||||||
config.stubs['v-popover'] = '<span><slot /></span>'
|
|
||||||
|
|
||||||
describe('PostTeaser', () => {
|
describe('PostTeaser', () => {
|
||||||
let store
|
let store
|
||||||
let stubs
|
let stubs
|
||||||
@ -35,6 +32,8 @@ describe('PostTeaser', () => {
|
|||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
NuxtLink: RouterLinkStub,
|
NuxtLink: RouterLinkStub,
|
||||||
|
'client-only': true,
|
||||||
|
'v-popover': true,
|
||||||
}
|
}
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: jest.fn(),
|
$t: jest.fn(),
|
||||||
@ -77,7 +76,9 @@ describe('PostTeaser', () => {
|
|||||||
spy.mockReset()
|
spy.mockReset()
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(jest.useFakeTimers)
|
beforeEach(() => {
|
||||||
|
jest.useFakeTimers()
|
||||||
|
})
|
||||||
|
|
||||||
describe('test Post callbacks', () => {
|
describe('test Post callbacks', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Signup, { SignupMutation } from './Signup'
|
import Signup, { SignupMutation } from './Signup'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['sweetalert-icon'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
'sweetalert-icon': true,
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('Signup', () => {
|
describe('Signup', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -28,13 +30,16 @@ describe('Signup', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
beforeEach(jest.useFakeTimers)
|
beforeEach(() => {
|
||||||
|
jest.useFakeTimers()
|
||||||
|
})
|
||||||
|
|
||||||
Wrapper = () => {
|
Wrapper = () => {
|
||||||
return mount(Signup, {
|
return mount(Signup, {
|
||||||
mocks,
|
mocks,
|
||||||
propsData,
|
propsData,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -42,7 +42,7 @@ describe('RelativeDateTime', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(Wrapper().is('span')).toBe(true)
|
expect(Wrapper().element.tagName).toBe('SPAN')
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("locale == 'en'", () => {
|
describe("locale == 'en'", () => {
|
||||||
|
|||||||
@ -100,7 +100,9 @@ describe('ReleaseModal.vue', () => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(jest.useFakeTimers)
|
beforeEach(() => {
|
||||||
|
jest.useFakeTimers()
|
||||||
|
})
|
||||||
|
|
||||||
describe('given id', () => {
|
describe('given id', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@ -1,8 +1,10 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import SocialMedia from './SocialMedia.vue'
|
import SocialMedia from './SocialMedia.vue'
|
||||||
|
|
||||||
config.stubs['ds-space'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['ds-text'] = '<span><slot /></span>'
|
'ds-space': true,
|
||||||
|
'ds-text': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('SocialMedia.vue', () => {
|
describe('SocialMedia.vue', () => {
|
||||||
let propsData
|
let propsData
|
||||||
@ -18,7 +20,7 @@ describe('SocialMedia.vue', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(SocialMedia, { propsData, mocks })
|
return mount(SocialMedia, { propsData, mocks, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('socialMedia card title', () => {
|
describe('socialMedia card title', () => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import SearchResults from './SearchResults'
|
import SearchResults from './SearchResults'
|
||||||
import helpers from '~/storybook/helpers'
|
import helpers from '~/storybook/helpers'
|
||||||
@ -9,8 +9,10 @@ const localVue = global.localVue
|
|||||||
|
|
||||||
localVue.directive('scrollTo', jest.fn())
|
localVue.directive('scrollTo', jest.fn())
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
'client-only': true,
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('SearchResults', () => {
|
describe('SearchResults', () => {
|
||||||
let mocks, getters, propsData, wrapper
|
let mocks, getters, propsData, wrapper
|
||||||
@ -18,7 +20,7 @@ describe('SearchResults', () => {
|
|||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
getters,
|
getters,
|
||||||
})
|
})
|
||||||
return mount(SearchResults, { mocks, localVue, propsData, store })
|
return mount(SearchResults, { mocks, localVue, propsData, store, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@ -19,7 +19,7 @@ describe('CounterIcon.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders the icon', () => {
|
it('renders the icon', () => {
|
||||||
expect(wrapper.find(BaseIcon).exists()).toBe(true)
|
expect(wrapper.findComponent(BaseIcon).exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders the count', () => {
|
it('renders the count', () => {
|
||||||
@ -35,7 +35,7 @@ describe('CounterIcon.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders the icon', () => {
|
it('renders the icon', () => {
|
||||||
expect(wrapper.find(BaseIcon).exists()).toBe(true)
|
expect(wrapper.findComponent(BaseIcon).exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders the capped count with a plus', () => {
|
it('renders the capped count with a plus', () => {
|
||||||
|
|||||||
@ -20,7 +20,7 @@ describe('ProfileAvatar', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders an icon', () => {
|
it('renders an icon', () => {
|
||||||
expect(wrapper.find(BaseIcon).exists()).toBe(true)
|
expect(wrapper.findComponent(BaseIcon).exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('given a profile', () => {
|
describe('given a profile', () => {
|
||||||
@ -38,7 +38,7 @@ describe('ProfileAvatar', () => {
|
|||||||
it('renders an icon', () => {
|
it('renders an icon', () => {
|
||||||
propsData = { profile: { name: null } }
|
propsData = { profile: { name: null } }
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
expect(wrapper.find(BaseIcon).exists()).toBe(true)
|
expect(wrapper.findComponent(BaseIcon).exists()).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ describe('ProfileAvatar', () => {
|
|||||||
it('renders an icon', () => {
|
it('renders an icon', () => {
|
||||||
propsData = { profile: { name: 'Anonymous' } }
|
propsData = { profile: { name: 'Anonymous' } }
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
expect(wrapper.find(BaseIcon).exists()).toBe(true)
|
expect(wrapper.findComponent(BaseIcon).exists()).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,16 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import TabNavigation from './TabNavigation'
|
import TabNavigation from './TabNavigation'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'client-only': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('TabNavigation', () => {
|
describe('TabNavigation', () => {
|
||||||
let mocks, propsData, wrapper
|
let mocks, propsData, wrapper
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(TabNavigation, { mocks, localVue, propsData })
|
return mount(TabNavigation, { mocks, localVue, propsData, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount, RouterLinkStub } from '@vue/test-utils'
|
import { mount, RouterLinkStub } from '@vue/test-utils'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import FiledReportsTable from './FiledReportsTable'
|
import FiledReportsTable from './FiledReportsTable'
|
||||||
import { reports } from '~/components/features/ReportList/ReportList.story.js'
|
import { reports } from '~/components/features/ReportList/ReportList.story.js'
|
||||||
@ -7,8 +7,6 @@ const localVue = global.localVue
|
|||||||
|
|
||||||
localVue.filter('truncate', (string) => string)
|
localVue.filter('truncate', (string) => string)
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
|
||||||
|
|
||||||
describe('FiledReportsTable.vue', () => {
|
describe('FiledReportsTable.vue', () => {
|
||||||
let wrapper, mocks, propsData, stubs, filed
|
let wrapper, mocks, propsData, stubs, filed
|
||||||
|
|
||||||
@ -18,6 +16,7 @@ describe('FiledReportsTable.vue', () => {
|
|||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
NuxtLink: RouterLinkStub,
|
NuxtLink: RouterLinkStub,
|
||||||
|
'client-only': true,
|
||||||
}
|
}
|
||||||
propsData = {}
|
propsData = {}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
|
|
||||||
import helpers from '~/storybook/helpers'
|
import helpers from '~/storybook/helpers'
|
||||||
@ -6,9 +6,11 @@ import FollowList from './FollowList.vue'
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['ds-space'] = '<span><slot /></span>'
|
'client-only': true,
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
'ds-space': true,
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
const user = {
|
const user = {
|
||||||
...helpers.fakeUser()[0],
|
...helpers.fakeUser()[0],
|
||||||
@ -45,6 +47,7 @@ describe('FollowList.vue', () => {
|
|||||||
$t: jest.fn((str) => str),
|
$t: jest.fn((str) => str),
|
||||||
},
|
},
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
@ -138,11 +141,11 @@ describe('FollowList.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders the user-teasers as an overflowing list', () => {
|
it('renders the user-teasers as an overflowing list', () => {
|
||||||
expect(wrapper.find('.--overflow').is('ul')).toBe(true)
|
expect(wrapper.find('.--overflow').element.tagName).toBe('UL')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders a filter text input', () => {
|
it('renders a filter text input', () => {
|
||||||
expect(wrapper.find('[name="followingFilter"]').is('input')).toBe(true)
|
expect(wrapper.find('[name="followingFilter"]').element.tagName).toBe('INPUT')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import ReportList from './ReportList'
|
import ReportList from './ReportList'
|
||||||
import { reports } from './ReportList.story'
|
import { reports } from './ReportList.story'
|
||||||
@ -7,8 +7,10 @@ import DropdownFilter from '~/components/DropdownFilter/DropdownFilter'
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
'client-only': true,
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('ReportList', () => {
|
describe('ReportList', () => {
|
||||||
let mocks, mutations, getters, wrapper
|
let mocks, mutations, getters, wrapper
|
||||||
@ -45,7 +47,7 @@ describe('ReportList', () => {
|
|||||||
mutations,
|
mutations,
|
||||||
getters,
|
getters,
|
||||||
})
|
})
|
||||||
return mount(ReportList, { mocks, localVue, store })
|
return mount(ReportList, { mocks, localVue, store, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('renders children components', () => {
|
describe('renders children components', () => {
|
||||||
@ -54,11 +56,11 @@ describe('ReportList', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders DropdownFilter', () => {
|
it('renders DropdownFilter', () => {
|
||||||
expect(wrapper.find(DropdownFilter).exists()).toBe(true)
|
expect(wrapper.findComponent(DropdownFilter).exists()).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders ReportsTable', () => {
|
it('renders ReportsTable', () => {
|
||||||
expect(wrapper.find(ReportsTable).exists()).toBe(true)
|
expect(wrapper.findComponent(ReportsTable).exists()).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -66,7 +68,7 @@ describe('ReportList', () => {
|
|||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
wrapper.setData({ reports })
|
wrapper.setData({ reports })
|
||||||
wrapper.find(ReportsTable).vm.$emit('confirm', reports[0])
|
wrapper.findComponent(ReportsTable).vm.$emit('confirm', reports[0])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('calls modal/SET_OPEN', () => {
|
it('calls modal/SET_OPEN', () => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount, RouterLinkStub } from '@vue/test-utils'
|
import { mount, RouterLinkStub } from '@vue/test-utils'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import ReportRow from './ReportRow.vue'
|
import ReportRow from './ReportRow.vue'
|
||||||
import BaseIcon from '~/components/_new/generic/BaseIcon/BaseIcon'
|
import BaseIcon from '~/components/_new/generic/BaseIcon/BaseIcon'
|
||||||
@ -6,8 +6,6 @@ import { reports } from '~/components/features/ReportList/ReportList.story.js'
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
|
||||||
|
|
||||||
describe('ReportRow', () => {
|
describe('ReportRow', () => {
|
||||||
let propsData, mocks, stubs, getters, wrapper
|
let propsData, mocks, stubs, getters, wrapper
|
||||||
|
|
||||||
@ -18,6 +16,7 @@ describe('ReportRow', () => {
|
|||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
NuxtLink: RouterLinkStub,
|
NuxtLink: RouterLinkStub,
|
||||||
|
'client-only': true,
|
||||||
}
|
}
|
||||||
getters = {
|
getters = {
|
||||||
'auth/user': () => {
|
'auth/user': () => {
|
||||||
@ -85,7 +84,9 @@ describe('ReportRow', () => {
|
|||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
it('renders the disabled icon', () => {
|
it('renders the disabled icon', () => {
|
||||||
expect(wrapper.find('.status-line').find(BaseIcon).props().name).toEqual('eye-slash')
|
expect(wrapper.find('.status-line').findComponent(BaseIcon).props().name).toEqual(
|
||||||
|
'eye-slash',
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders its current status', () => {
|
it('renders its current status', () => {
|
||||||
@ -99,7 +100,7 @@ describe('ReportRow', () => {
|
|||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
})
|
})
|
||||||
it('renders the enabled icon', () => {
|
it('renders the enabled icon', () => {
|
||||||
expect(wrapper.find('.status-line').find(BaseIcon).props().name).toEqual('eye')
|
expect(wrapper.find('.status-line').findComponent(BaseIcon).props().name).toEqual('eye')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders its current status', () => {
|
it('renders its current status', () => {
|
||||||
@ -120,7 +121,7 @@ describe('ReportRow', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders a comments icon', () => {
|
it('renders a comments icon', () => {
|
||||||
const commentsIcon = wrapper.find(BaseIcon).props().name
|
const commentsIcon = wrapper.findComponent(BaseIcon).props().name
|
||||||
expect(commentsIcon).toEqual('comments')
|
expect(commentsIcon).toEqual('comments')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -142,7 +143,7 @@ describe('ReportRow', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders a bookmark icon', () => {
|
it('renders a bookmark icon', () => {
|
||||||
const postIcon = wrapper.find(BaseIcon).props().name
|
const postIcon = wrapper.findComponent(BaseIcon).props().name
|
||||||
expect(postIcon).toEqual('bookmark')
|
expect(postIcon).toEqual('bookmark')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -164,7 +165,7 @@ describe('ReportRow', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders a user icon', () => {
|
it('renders a user icon', () => {
|
||||||
const userIcon = wrapper.find(BaseIcon).props().name
|
const userIcon = wrapper.findComponent(BaseIcon).props().name
|
||||||
expect(userIcon).toEqual('user')
|
expect(userIcon).toEqual('user')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import ReportsTable from './ReportsTable.vue'
|
import ReportsTable from './ReportsTable.vue'
|
||||||
import { reports } from '~/components/features/ReportList/ReportList.story.js'
|
import { reports } from '~/components/features/ReportList/ReportList.story.js'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
'client-only': true,
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('ReportsTable', () => {
|
describe('ReportsTable', () => {
|
||||||
let propsData, mocks, getters, wrapper, reportsTable
|
let propsData, mocks, getters, wrapper, reportsTable
|
||||||
@ -29,7 +31,7 @@ describe('ReportsTable', () => {
|
|||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
getters,
|
getters,
|
||||||
})
|
})
|
||||||
return mount(ReportsTable, { propsData, mocks, localVue, store })
|
return mount(ReportsTable, { propsData, mocks, localVue, store, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('given no reports', () => {
|
describe('given no reports', () => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import SearchField from './SearchField.vue'
|
import SearchField from './SearchField.vue'
|
||||||
import SearchableInput from '~/components/generic/SearchableInput/SearchableInput'
|
import SearchableInput from '~/components/generic/SearchableInput/SearchableInput'
|
||||||
@ -7,7 +7,10 @@ const localVue = global.localVue
|
|||||||
|
|
||||||
localVue.filter('truncate', () => 'truncated string')
|
localVue.filter('truncate', () => 'truncated string')
|
||||||
localVue.filter('dateTime', () => Date.now)
|
localVue.filter('dateTime', () => Date.now)
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
|
||||||
|
const stubs = {
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('SearchField.vue', () => {
|
describe('SearchField.vue', () => {
|
||||||
let mocks, wrapper, getters
|
let mocks, wrapper, getters
|
||||||
@ -26,14 +29,14 @@ describe('SearchField.vue', () => {
|
|||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
getters,
|
getters,
|
||||||
})
|
})
|
||||||
return mount(SearchField, { mocks, localVue, store })
|
return mount(SearchField, { mocks, localVue, store, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
describe('Emitted events', () => {
|
describe('Emitted events', () => {
|
||||||
let searchableInputComponent
|
let searchableInputComponent
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
searchableInputComponent = wrapper.find(SearchableInput)
|
searchableInputComponent = wrapper.findComponent(SearchableInput)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('query event', () => {
|
describe('query event', () => {
|
||||||
|
|||||||
@ -37,11 +37,11 @@ describe('SearchPost.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders post commentsCount', () => {
|
it('renders post commentsCount', () => {
|
||||||
expect(counts.text()).toContain(propsData.option.commentsCount)
|
expect(counts.text()).toContain(propsData.option.commentsCount.toString())
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders post shoutedCount', () => {
|
it('renders post shoutedCount', () => {
|
||||||
expect(counts.text()).toContain(propsData.option.shoutedCount)
|
expect(counts.text()).toContain(propsData.option.shoutedCount.toString())
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders post author', () => {
|
it('renders post author', () => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import SearchableInput from './SearchableInput'
|
import SearchableInput from './SearchableInput'
|
||||||
@ -8,7 +8,10 @@ const localVue = global.localVue
|
|||||||
|
|
||||||
localVue.filter('truncate', () => 'truncated string')
|
localVue.filter('truncate', () => 'truncated string')
|
||||||
localVue.filter('dateTime', () => Date.now)
|
localVue.filter('dateTime', () => Date.now)
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
|
||||||
|
const stubs = {
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('SearchableInput.vue', () => {
|
describe('SearchableInput.vue', () => {
|
||||||
let mocks, propsData, getters, wrapper
|
let mocks, propsData, getters, wrapper
|
||||||
@ -28,7 +31,7 @@ describe('SearchableInput.vue', () => {
|
|||||||
const store = new Vuex.Store({
|
const store = new Vuex.Store({
|
||||||
getters,
|
getters,
|
||||||
})
|
})
|
||||||
return mount(SearchableInput, { mocks, localVue, propsData, store })
|
return mount(SearchableInput, { mocks, localVue, propsData, store, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
|
|||||||
@ -22,12 +22,14 @@ module.exports = {
|
|||||||
'^.+\\.js$': 'babel-jest',
|
'^.+\\.js$': 'babel-jest',
|
||||||
},
|
},
|
||||||
testMatch: ['**/?(*.)+(spec|test).js?(x)'],
|
testMatch: ['**/?(*.)+(spec|test).js?(x)'],
|
||||||
modulePathIgnorePatterns: ['<rootDir>/build/'],
|
modulePathIgnorePatterns: ['<rootDir>/dist/'],
|
||||||
moduleNameMapper: {
|
moduleNameMapper: {
|
||||||
'\\.(svg)$': '<rootDir>/test/fileMock.js',
|
'\\.(svg)$': '<rootDir>/test/fileMock.js',
|
||||||
'\\.(css|less)$': 'identity-obj-proxy',
|
'\\.(css|less)$': 'identity-obj-proxy',
|
||||||
|
'@mapbox/mapbox-gl-geocoder': 'identity-obj-proxy',
|
||||||
'^@/(.*)$': '<rootDir>/src/$1',
|
'^@/(.*)$': '<rootDir>/src/$1',
|
||||||
'^~/(.*)$': '<rootDir>/$1',
|
'^~/(.*)$': '<rootDir>/$1',
|
||||||
},
|
},
|
||||||
moduleFileExtensions: ['js', 'json', 'vue'],
|
moduleFileExtensions: ['js', 'json', 'vue'],
|
||||||
|
testEnvironment: 'jest-environment-jsdom',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import { config, shallowMount } from '@vue/test-utils'
|
import { shallowMount } from '@vue/test-utils'
|
||||||
import Basic from './basic.vue'
|
import Basic from './basic.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs.nuxt = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
nuxt: {
|
||||||
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
describe('basic.vue', () => {
|
describe('basic.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -28,6 +32,7 @@ describe('basic.vue', () => {
|
|||||||
store,
|
store,
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +41,7 @@ describe('basic.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.layout-blank')).toBe(true)
|
expect(wrapper.classes('layout-blank')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
import { config, shallowMount } from '@vue/test-utils'
|
import { shallowMount } from '@vue/test-utils'
|
||||||
import Blank from './blank.vue'
|
import Blank from './blank.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs.nuxt = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
nuxt: {
|
||||||
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
describe('blank.vue', () => {
|
describe('blank.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -20,6 +24,7 @@ describe('blank.vue', () => {
|
|||||||
return shallowMount(Blank, {
|
return shallowMount(Blank, {
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +33,7 @@ describe('blank.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.layout-blank')).toBe(true)
|
expect(wrapper.classes('layout-blank')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,13 +1,21 @@
|
|||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import { config, shallowMount } from '@vue/test-utils'
|
import { shallowMount } from '@vue/test-utils'
|
||||||
import Default from './default.vue'
|
import Default from './default.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
localVue.directive('scrollTo', jest.fn())
|
localVue.directive('scrollTo', jest.fn())
|
||||||
|
|
||||||
config.stubs.nuxt = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
nuxt: {
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
'client-only': {
|
||||||
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
'nuxt-link': {
|
||||||
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
describe('default.vue', () => {
|
describe('default.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -38,6 +46,7 @@ describe('default.vue', () => {
|
|||||||
store,
|
store,
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +55,7 @@ describe('default.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.layout-default')).toBe(true)
|
expect(wrapper.classes('layout-default')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,9 +1,13 @@
|
|||||||
import { config, shallowMount } from '@vue/test-utils'
|
import { shallowMount } from '@vue/test-utils'
|
||||||
import Error from './error.vue'
|
import Error from './error.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'nuxt-link': {
|
||||||
|
template: '<span><slot /></span>',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
describe('error.vue', () => {
|
describe('error.vue', () => {
|
||||||
let mocks, wrapper
|
let mocks, wrapper
|
||||||
@ -15,7 +19,7 @@ describe('error.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const Wrapper = (propsData = {}) => {
|
const Wrapper = (propsData = {}) => {
|
||||||
return shallowMount(Error, { mocks, propsData, localVue })
|
return shallowMount(Error, { mocks, propsData, localVue, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('shallowMount', () => {
|
describe('shallowMount', () => {
|
||||||
|
|||||||
@ -67,7 +67,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "~7.12.3",
|
"@babel/core": "~7.12.3",
|
||||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||||
"@babel/preset-env": "~7.9.0",
|
"@babel/preset-env": "^7.20.2",
|
||||||
"@faker-js/faker": "5.1.0",
|
"@faker-js/faker": "5.1.0",
|
||||||
"@nuxtjs/composition-api": "0.32.0",
|
"@nuxtjs/composition-api": "0.32.0",
|
||||||
"@storybook/addon-a11y": "^6.3.6",
|
"@storybook/addon-a11y": "^6.3.6",
|
||||||
@ -77,11 +77,11 @@
|
|||||||
"@vue/cli-shared-utils": "~4.3.1",
|
"@vue/cli-shared-utils": "~4.3.1",
|
||||||
"@vue/eslint-config-prettier": "~6.0.0",
|
"@vue/eslint-config-prettier": "~6.0.0",
|
||||||
"@vue/server-test-utils": "~1.0.0-beta.31",
|
"@vue/server-test-utils": "~1.0.0-beta.31",
|
||||||
"@vue/test-utils": "~1.0.0-beta.31",
|
"@vue/test-utils": "1.3.4",
|
||||||
"async-validator": "^3.2.4",
|
"async-validator": "^3.2.4",
|
||||||
"babel-core": "~7.0.0-bridge.0",
|
"babel-core": "~7.0.0-bridge.0",
|
||||||
"babel-eslint": "~10.1.0",
|
"babel-eslint": "~10.1.0",
|
||||||
"babel-jest": "~25.3.0",
|
"babel-jest": "29.4",
|
||||||
"babel-loader": "~8.1.0",
|
"babel-loader": "~8.1.0",
|
||||||
"babel-plugin-require-context-hook": "^1.0.0",
|
"babel-plugin-require-context-hook": "^1.0.0",
|
||||||
"babel-preset-vue": "~2.0.2",
|
"babel-preset-vue": "~2.0.2",
|
||||||
@ -100,7 +100,8 @@
|
|||||||
"eslint-plugin-vue": "~6.2.2",
|
"eslint-plugin-vue": "~6.2.2",
|
||||||
"flush-promises": "^1.0.2",
|
"flush-promises": "^1.0.2",
|
||||||
"identity-obj-proxy": "^3.0.0",
|
"identity-obj-proxy": "^3.0.0",
|
||||||
"jest": "~26.6.3",
|
"jest": "29.4",
|
||||||
|
"jest-environment-jsdom": "^29.4.2",
|
||||||
"mutation-observer": "^1.0.3",
|
"mutation-observer": "^1.0.3",
|
||||||
"prettier": "~2.7.1",
|
"prettier": "~2.7.1",
|
||||||
"sass-loader": "~10.1.1",
|
"sass-loader": "~10.1.1",
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import admin from './admin.vue'
|
import admin from './admin.vue'
|
||||||
|
|
||||||
config.stubs['nuxt-child'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'nuxt-child': true,
|
||||||
|
}
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
@ -20,6 +22,7 @@ describe('admin.vue', () => {
|
|||||||
return mount(admin, {
|
return mount(admin, {
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +31,7 @@ describe('admin.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBe(true)
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -26,7 +26,7 @@ describe('categories.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.base-card')).toBe(true)
|
expect(wrapper.classes('base-card')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -57,7 +57,7 @@ describe('donations.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.base-card')).toBe(true)
|
expect(wrapper.classes('base-card')).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('displays', () => {
|
describe('displays', () => {
|
||||||
@ -88,24 +88,18 @@ describe('donations.vue', () => {
|
|||||||
|
|
||||||
describe('form component click', () => {
|
describe('form component click', () => {
|
||||||
it('on #showDonations checkbox changes "showDonations" to true', async () => {
|
it('on #showDonations checkbox changes "showDonations" to true', async () => {
|
||||||
// starts with false
|
await wrapper.find('#showDonations').setChecked(true)
|
||||||
wrapper.find('#showDonations').trigger('click') // set to true
|
|
||||||
await wrapper.vm.$nextTick()
|
|
||||||
expect(wrapper.vm.showDonations).toBe(true)
|
expect(wrapper.vm.showDonations).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('on #showDonations checkbox twice changes "showDonations" back to false', async () => {
|
it('on #showDonations checkbox twice changes "showDonations" back to false', async () => {
|
||||||
// starts with false
|
await wrapper.find('#showDonations').setChecked(true)
|
||||||
wrapper.find('#showDonations').trigger('click') // set to true
|
await wrapper.find('#showDonations').setChecked(false)
|
||||||
wrapper.find('#showDonations').trigger('click') // set to false
|
|
||||||
await wrapper.vm.$nextTick()
|
|
||||||
expect(wrapper.vm.showDonations).toBe(false)
|
expect(wrapper.vm.showDonations).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('on donations-goal and enter value XXX', async () => {
|
it.skip('on donations-goal and enter value XXX', async () => {
|
||||||
wrapper.find('#donations-goal').setValue('20000')
|
await wrapper.find('#donations-goal').setValue('20000')
|
||||||
await wrapper.vm.$nextTick()
|
|
||||||
// console.log(wrapper.find('#donations-goal').element.value)
|
|
||||||
expect(wrapper.vm.formData.goal).toBe('20000')
|
expect(wrapper.vm.formData.goal).toBe('20000')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -141,7 +135,7 @@ describe('donations.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('calls mutation with input values once', async () => {
|
it('calls mutation with input values once', async () => {
|
||||||
wrapper.find('#showDonations').trigger('click') // set to true
|
wrapper.find('#showDonations').setChecked(true)
|
||||||
await wrapper.vm.$nextTick()
|
await wrapper.vm.$nextTick()
|
||||||
wrapper.find('#donations-goal').setValue('20000')
|
wrapper.find('#donations-goal').setValue('20000')
|
||||||
await wrapper.vm.$nextTick()
|
await wrapper.vm.$nextTick()
|
||||||
|
|||||||
@ -26,7 +26,7 @@ describe('hashtags.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.base-card')).toBe(true)
|
expect(wrapper.classes('base-card')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -29,7 +29,7 @@ describe('invite.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.ds-section')).toBe(true)
|
expect(wrapper.classes('ds-section')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -29,7 +29,7 @@ describe('notifications.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.base-card')).toBe(true)
|
expect(wrapper.classes('base-card')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -29,7 +29,7 @@ describe('organizations.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.base-card')).toBe(true)
|
expect(wrapper.classes('base-card')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -29,7 +29,7 @@ describe('pages.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.base-card')).toBe(true)
|
expect(wrapper.classes('base-card')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -29,7 +29,7 @@ describe('settings.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.base-card')).toBe(true)
|
expect(wrapper.classes('base-card')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,9 +1,12 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import Users from './users.vue'
|
import Users from './users.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
|
||||||
|
const stubs = {
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('Users', () => {
|
describe('Users', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -49,12 +52,13 @@ describe('Users', () => {
|
|||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
store,
|
store,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
expect(wrapper.is('div')).toBe(true)
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('search', () => {
|
describe('search', () => {
|
||||||
|
|||||||
@ -33,7 +33,7 @@ describe('code-of-conduct.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBeTruthy()
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has correct <head> content', () => {
|
it('has correct <head> content', () => {
|
||||||
|
|||||||
@ -33,7 +33,7 @@ describe('data-privacy.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBeTruthy()
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has correct <head> content', () => {
|
it('has correct <head> content', () => {
|
||||||
|
|||||||
@ -37,7 +37,7 @@ describe('donate.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBeTruthy()
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has correct <head> content', () => {
|
it('has correct <head> content', () => {
|
||||||
|
|||||||
@ -33,7 +33,7 @@ describe('faq.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBeTruthy()
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has correct <head> content', () => {
|
it('has correct <head> content', () => {
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import _id from './_id.vue'
|
import _id from './_id.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['nuxt-child'] = '<span class="nuxt-child"><slot /></span>'
|
const stubs = {
|
||||||
|
'nuxt-child': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('Group profile _id.vue', () => {
|
describe('Group profile _id.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -19,6 +21,7 @@ describe('Group profile _id.vue', () => {
|
|||||||
return mount(_id, {
|
return mount(_id, {
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +30,7 @@ describe('Group profile _id.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.findAll('.nuxt-child')).toHaveLength(1)
|
expect(wrapper.findComponent({ name: 'nuxt-child' }).exists()).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,15 +1,18 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import GroupProfileSlug from './_slug.vue'
|
import GroupProfileSlug from './_slug.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
localVue.filter('date', (d) => d)
|
localVue.filter('date', (d) => d)
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['v-popover'] = '<span><slot /></span>'
|
'client-only': true,
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
'v-popover': true,
|
||||||
config.stubs['infinite-loading'] = '<span><slot /></span>'
|
'nuxt-link': true,
|
||||||
config.stubs['follow-list'] = '<span><slot /></span>'
|
'router-link': true,
|
||||||
|
'infinite-loading': true,
|
||||||
|
'follow-list': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('GroupProfileSlug', () => {
|
describe('GroupProfileSlug', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -201,6 +204,7 @@ describe('GroupProfileSlug', () => {
|
|||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
data,
|
data,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import groups from './groups.vue'
|
import groups from './groups.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['nuxt-link'] = '<span class="nuxt-link"><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['client-only'] = '<span class="client-only"><slot /></span>'
|
'nuxt-link': true,
|
||||||
|
'client-only': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('groups', () => {
|
describe('groups', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -21,6 +23,7 @@ describe('groups', () => {
|
|||||||
return mount(groups, {
|
return mount(groups, {
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,7 +32,7 @@ describe('groups', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBe(true)
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -37,7 +37,7 @@ describe('imprint.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBeTruthy()
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has correct <head> content', () => {
|
it('has correct <head> content', () => {
|
||||||
|
|||||||
@ -1,14 +1,16 @@
|
|||||||
import { config, shallowMount, mount } from '@vue/test-utils'
|
import { shallowMount, mount } from '@vue/test-utils'
|
||||||
import PostIndex from './index.vue'
|
import PostIndex from './index.vue'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import HashtagsFilter from '~/components/HashtagsFilter/HashtagsFilter'
|
import HashtagsFilter from '~/components/HashtagsFilter/HashtagsFilter'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['router-link'] = '<span><slot /></span>'
|
'client-only': true,
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
'router-link': true,
|
||||||
config.stubs['infinite-loading'] = '<span><slot /></span>'
|
'nuxt-link': true,
|
||||||
|
'infinite-loading': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('PostIndex', () => {
|
describe('PostIndex', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -95,7 +97,7 @@ describe('PostIndex', () => {
|
|||||||
it('clears the search when the filter menu emits clearSearch', () => {
|
it('clears the search when the filter menu emits clearSearch', () => {
|
||||||
mocks.$route.query.hashtag = '#samplehashtag'
|
mocks.$route.query.hashtag = '#samplehashtag'
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
wrapper.find(HashtagsFilter).vm.$emit('clearSearch')
|
wrapper.findComponent(HashtagsFilter).vm.$emit('clearSearch')
|
||||||
expect(wrapper.vm.hashtag).toBeNull()
|
expect(wrapper.vm.hashtag).toBeNull()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -123,6 +125,7 @@ describe('PostIndex', () => {
|
|||||||
store,
|
store,
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import login from './login.vue'
|
import login from './login.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span class="client-only"><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['nuxt-link'] = '<span class="nuxt-link"><slot /></span>'
|
'client-only': true,
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('Login.vue', () => {
|
describe('Login.vue', () => {
|
||||||
let store
|
let store
|
||||||
@ -50,6 +52,7 @@ describe('Login.vue', () => {
|
|||||||
store,
|
store,
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ describe('logout.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBe(true)
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('logs out and redirects to login', () => {
|
it('logs out and redirects to login', () => {
|
||||||
|
|||||||
@ -4,6 +4,11 @@ import { mount } from '@vue/test-utils'
|
|||||||
import VueMeta from 'vue-meta'
|
import VueMeta from 'vue-meta'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import Map from './map'
|
import Map from './map'
|
||||||
|
import MapboxGeocoder from '@mapbox/mapbox-gl-geocoder'
|
||||||
|
|
||||||
|
jest.mock('@mapbox/mapbox-gl-geocoder', () => {
|
||||||
|
return jest.fn().mockImplementation(jest.fn())
|
||||||
|
})
|
||||||
|
|
||||||
jest.mock('mapbox-gl', () => {
|
jest.mock('mapbox-gl', () => {
|
||||||
return {
|
return {
|
||||||
@ -68,6 +73,7 @@ describe('map', () => {
|
|||||||
let mocks
|
let mocks
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
MapboxGeocoder.mockClear()
|
||||||
mocks = {
|
mocks = {
|
||||||
$t: (t) => t,
|
$t: (t) => t,
|
||||||
$env: {
|
$env: {
|
||||||
@ -95,7 +101,7 @@ describe('map', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBeTruthy()
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has correct <head> content', () => {
|
it('has correct <head> content', () => {
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import moderation from './moderation.vue'
|
import moderation from './moderation.vue'
|
||||||
|
|
||||||
config.stubs['nuxt-child'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'nuxt-child': true,
|
||||||
|
}
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
@ -20,6 +22,7 @@ describe('moderation.vue', () => {
|
|||||||
return mount(moderation, {
|
return mount(moderation, {
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +31,7 @@ describe('moderation.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBe(true)
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Moderation from './index.vue'
|
import Moderation from './index.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
|
||||||
|
const stubs = {
|
||||||
|
'client-only': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('moderation/index.vue', () => {
|
describe('moderation/index.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -16,7 +19,7 @@ describe('moderation/index.vue', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(Moderation, { mocks, localVue })
|
return mount(Moderation, { mocks, localVue, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@ -24,7 +27,7 @@ describe('moderation/index.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.base-card')).toBe(true)
|
expect(wrapper.classes('base-card')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, shallowMount, mount } from '@vue/test-utils'
|
import { shallowMount, mount } from '@vue/test-utils'
|
||||||
import NotificationsPage from './index.vue'
|
import NotificationsPage from './index.vue'
|
||||||
|
|
||||||
import DropdownFilter from '~/components/DropdownFilter/DropdownFilter'
|
import DropdownFilter from '~/components/DropdownFilter/DropdownFilter'
|
||||||
@ -7,7 +7,9 @@ import PaginationButtons from '~/components/_new/generic/PaginationButtons/Pagin
|
|||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'client-only': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('PostIndex', () => {
|
describe('PostIndex', () => {
|
||||||
let wrapper, Wrapper, mocks, propsData
|
let wrapper, Wrapper, mocks, propsData
|
||||||
@ -42,6 +44,7 @@ describe('PostIndex', () => {
|
|||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
propsData,
|
propsData,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
@ -67,6 +70,7 @@ describe('PostIndex', () => {
|
|||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
propsData,
|
propsData,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -79,7 +83,7 @@ describe('PostIndex', () => {
|
|||||||
{ label: 'Unread', value: false },
|
{ label: 'Unread', value: false },
|
||||||
]
|
]
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
wrapper.find(DropdownFilter).vm.$emit('filter', propsData.filterOptions[1])
|
wrapper.findComponent(DropdownFilter).vm.$emit('filter', propsData.filterOptions[1])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('sets `notificationRead` to value of received option', () => {
|
it('sets `notificationRead` to value of received option', () => {
|
||||||
@ -98,7 +102,9 @@ describe('PostIndex', () => {
|
|||||||
describe('markNotificationAsRead', () => {
|
describe('markNotificationAsRead', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
wrapper.find(NotificationsTable).vm.$emit('markNotificationAsRead', 'notificationSourceId')
|
wrapper
|
||||||
|
.findComponent(NotificationsTable)
|
||||||
|
.vm.$emit('markNotificationAsRead', 'notificationSourceId')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('calls markNotificationAsRead mutation', () => {
|
it('calls markNotificationAsRead mutation', () => {
|
||||||
@ -112,7 +118,7 @@ describe('PostIndex', () => {
|
|||||||
mocks.$apollo.mutate = jest.fn().mockRejectedValueOnce({ message: 'Some error message' })
|
mocks.$apollo.mutate = jest.fn().mockRejectedValueOnce({ message: 'Some error message' })
|
||||||
wrapper = Wrapper()
|
wrapper = Wrapper()
|
||||||
wrapper
|
wrapper
|
||||||
.find(NotificationsTable)
|
.findComponent(NotificationsTable)
|
||||||
.vm.$emit('markNotificationAsRead', 'notificationSourceId')
|
.vm.$emit('markNotificationAsRead', 'notificationSourceId')
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -129,7 +135,7 @@ describe('PostIndex', () => {
|
|||||||
|
|
||||||
describe('next: given a user is on the first page', () => {
|
describe('next: given a user is on the first page', () => {
|
||||||
it('adds offset to pageSize to skip first x notifications and display next page', () => {
|
it('adds offset to pageSize to skip first x notifications and display next page', () => {
|
||||||
wrapper.find(PaginationButtons).vm.$emit('next')
|
wrapper.findComponent(PaginationButtons).vm.$emit('next')
|
||||||
expect(wrapper.vm.offset).toEqual(12)
|
expect(wrapper.vm.offset).toEqual(12)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -137,7 +143,7 @@ describe('PostIndex', () => {
|
|||||||
describe('back: given a user is on the third page', () => {
|
describe('back: given a user is on the third page', () => {
|
||||||
it('sets offset when back is emitted', () => {
|
it('sets offset when back is emitted', () => {
|
||||||
wrapper.setData({ offset: 24 })
|
wrapper.setData({ offset: 24 })
|
||||||
wrapper.find(PaginationButtons).vm.$emit('back')
|
wrapper.findComponent(PaginationButtons).vm.$emit('back')
|
||||||
expect(wrapper.vm.offset).toEqual(12)
|
expect(wrapper.vm.offset).toEqual(12)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -37,7 +37,7 @@ describe('organization.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBeTruthy()
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('has correct <head> content', () => {
|
it('has correct <head> content', () => {
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import PasswordReset from './password-reset.vue'
|
import PasswordReset from './password-reset.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span class="client-only"><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['nuxt-child'] = '<span class="nuxt-child"><slot /></span>'
|
'client-only': true,
|
||||||
|
'nuxt-child': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('password-reset.vue', () => {
|
describe('password-reset.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -47,12 +49,13 @@ describe('password-reset.vue', () => {
|
|||||||
return mount(PasswordReset, {
|
return mount(PasswordReset, {
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
it('renders', async () => {
|
it('renders', async () => {
|
||||||
wrapper = await Wrapper()
|
wrapper = await Wrapper()
|
||||||
expect(wrapper.is('div')).toBe(true)
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('renders with asyncData and not loggedIn', async () => {
|
it('renders with asyncData and not loggedIn', async () => {
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import enterNonce from './enter-nonce.vue'
|
import enterNonce from './enter-nonce.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['nuxt-link'] = '<span class="nuxt-link"><slot /></span>'
|
const stubs = {
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('enter-nonce.vue', () => {
|
describe('enter-nonce.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -20,7 +22,7 @@ describe('enter-nonce.vue', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(enterNonce, { mocks, localVue })
|
return mount(enterNonce, { mocks, localVue, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import request from './request.vue'
|
import request from './request.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
// config.stubs['sweetalert-icon'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['nuxt-link'] = '<span class="nuxt-link"><slot /></span>'
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('request.vue', () => {
|
describe('request.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -29,7 +30,7 @@ describe('request.vue', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(request, { mocks, localVue })
|
return mount(request, { mocks, localVue, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import PostSlug from './index.vue'
|
import PostSlug from './index.vue'
|
||||||
@ -6,10 +6,6 @@ import CommentList from '~/components/CommentList/CommentList'
|
|||||||
import HcHashtag from '~/components/Hashtag/Hashtag'
|
import HcHashtag from '~/components/Hashtag/Hashtag'
|
||||||
import VueMeta from 'vue-meta'
|
import VueMeta from 'vue-meta'
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
|
||||||
config.stubs['router-link'] = '<span><slot /></span>'
|
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
localVue.directive('scrollTo', jest.fn())
|
localVue.directive('scrollTo', jest.fn())
|
||||||
localVue.use(VueMeta, { keyName: 'head' })
|
localVue.use(VueMeta, { keyName: 'head' })
|
||||||
@ -81,6 +77,9 @@ describe('PostSlug', () => {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
stubs = {
|
stubs = {
|
||||||
|
'client-only': true,
|
||||||
|
'nuxt-link': true,
|
||||||
|
'router-link': true,
|
||||||
HcEditor: { render: () => {}, methods: { insertReply: jest.fn(() => null) } },
|
HcEditor: { render: () => {}, methods: { insertReply: jest.fn(() => null) } },
|
||||||
ContentViewer: true,
|
ContentViewer: true,
|
||||||
}
|
}
|
||||||
@ -148,7 +147,7 @@ describe('PostSlug', () => {
|
|||||||
describe('reply method called when emitted reply received', () => {
|
describe('reply method called when emitted reply received', () => {
|
||||||
it('CommentList', async () => {
|
it('CommentList', async () => {
|
||||||
wrapper = await Wrapper()
|
wrapper = await Wrapper()
|
||||||
wrapper.find(CommentList).vm.$emit('reply', {
|
wrapper.findComponent(CommentList).vm.$emit('reply', {
|
||||||
id: 'commentAuthorId',
|
id: 'commentAuthorId',
|
||||||
slug: 'ogerly',
|
slug: 'ogerly',
|
||||||
})
|
})
|
||||||
@ -176,12 +175,12 @@ describe('PostSlug', () => {
|
|||||||
|
|
||||||
it('are present', async () => {
|
it('are present', async () => {
|
||||||
// Get length from backendData and compare against number of tags present in component.
|
// Get length from backendData and compare against number of tags present in component.
|
||||||
expect(wrapper.findAll(HcHashtag).length).toBe(backendData.post.tags.length)
|
expect(wrapper.findAllComponents(HcHashtag).length).toBe(backendData.post.tags.length)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('are alphabetically ordered', async () => {
|
it('are alphabetically ordered', async () => {
|
||||||
// Get all HcHastag components
|
// Get all HcHastag components
|
||||||
const wrappers = wrapper.findAll(HcHashtag).wrappers
|
const wrappers = wrapper.findAllComponents(HcHashtag).wrappers
|
||||||
// Exctract ID properties (tag names) from component.
|
// Exctract ID properties (tag names) from component.
|
||||||
const ids = []
|
const ids = []
|
||||||
wrappers.forEach((x) => {
|
wrappers.forEach((x) => {
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import _id from './_id.vue'
|
import _id from './_id.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['nuxt-child'] = '<span class="nuxt-child"><slot /></span>'
|
const stubs = {
|
||||||
|
'nuxt-child': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('Profile _id.vue', () => {
|
describe('Profile _id.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -19,6 +21,7 @@ describe('Profile _id.vue', () => {
|
|||||||
return mount(_id, {
|
return mount(_id, {
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +30,7 @@ describe('Profile _id.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.findAll('.nuxt-child')).toHaveLength(1)
|
expect(wrapper.findComponent({ name: 'nuxt-child' }).exists()).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,15 +1,18 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import ProfileSlug from './_slug.vue'
|
import ProfileSlug from './_slug.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
localVue.filter('date', (d) => d)
|
localVue.filter('date', (d) => d)
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['v-popover'] = '<span><slot /></span>'
|
'client-only': true,
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
'v-popover': true,
|
||||||
config.stubs['infinite-loading'] = '<span><slot /></span>'
|
'nuxt-link': true,
|
||||||
config.stubs['follow-list'] = '<span><slot /></span>'
|
'infinite-loading': true,
|
||||||
|
'follow-list': true,
|
||||||
|
'router-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('ProfileSlug', () => {
|
describe('ProfileSlug', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -51,6 +54,7 @@ describe('ProfileSlug', () => {
|
|||||||
return mount(ProfileSlug, {
|
return mount(ProfileSlug, {
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,16 @@
|
|||||||
import Vuex from 'vuex'
|
import Vuex from 'vuex'
|
||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import Registration from './registration.vue'
|
import Registration from './registration.vue'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
config.stubs['router-link'] = '<span><slot /></span>'
|
'client-only': true,
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
'router-link': true,
|
||||||
config.stubs['infinite-loading'] = '<span><slot /></span>'
|
'nuxt-link': true,
|
||||||
|
'infinite-loading': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('Registration', () => {
|
describe('Registration', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -73,6 +75,7 @@ describe('Registration', () => {
|
|||||||
return mount(Registration, {
|
return mount(Registration, {
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +313,7 @@ describe('Registration', () => {
|
|||||||
|
|
||||||
it('renders', async () => {
|
it('renders', async () => {
|
||||||
wrapper = await Wrapper()
|
wrapper = await Wrapper()
|
||||||
expect(wrapper.is('.registration-slider')).toBe(true)
|
expect(wrapper.classes('registration-slider')).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
// The asyncTests must go last
|
// The asyncTests must go last
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import searchResults from './search-results.vue'
|
import searchResults from './search-results.vue'
|
||||||
import VueMeta from 'vue-meta'
|
import VueMeta from 'vue-meta'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
localVue.use(VueMeta, { keyName: 'head' })
|
localVue.use(VueMeta, { keyName: 'head' })
|
||||||
|
|
||||||
config.stubs['client-only'] = '<span class="client-only"><slot /></span>'
|
const stubs = {
|
||||||
|
'client-only': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('search-results.vue', () => {
|
describe('search-results.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -32,7 +34,7 @@ describe('search-results.vue', () => {
|
|||||||
return { ...data, ...aData }
|
return { ...data, ...aData }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mount(searchResults, { mocks, localVue })
|
return mount(searchResults, { mocks, localVue, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
it('renders', async () => {
|
it('renders', async () => {
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
import { config, mount } from '@vue/test-utils'
|
import { mount } from '@vue/test-utils'
|
||||||
import settings from './settings.vue'
|
import settings from './settings.vue'
|
||||||
|
|
||||||
const localVue = global.localVue
|
const localVue = global.localVue
|
||||||
|
|
||||||
config.stubs['nuxt-child'] = '<span class="nuxt-child"><slot /></span>'
|
const stubs = {
|
||||||
|
'nuxt-child': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('settings.vue', () => {
|
describe('settings.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -20,6 +22,7 @@ describe('settings.vue', () => {
|
|||||||
return mount(settings, {
|
return mount(settings, {
|
||||||
mocks,
|
mocks,
|
||||||
localVue,
|
localVue,
|
||||||
|
stubs,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,7 +31,7 @@ describe('settings.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBe(true)
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { config, mount, createLocalVue } from '@vue/test-utils'
|
import { mount, createLocalVue } from '@vue/test-utils'
|
||||||
import BlockedUsers from './blocked-users.vue'
|
import BlockedUsers from './blocked-users.vue'
|
||||||
import Styleguide from '@human-connection/styleguide'
|
import Styleguide from '@human-connection/styleguide'
|
||||||
import Filters from '~/plugins/vue-filters'
|
import Filters from '~/plugins/vue-filters'
|
||||||
@ -9,7 +9,9 @@ const localVue = createLocalVue()
|
|||||||
localVue.use(Styleguide)
|
localVue.use(Styleguide)
|
||||||
localVue.use(Filters)
|
localVue.use(Filters)
|
||||||
|
|
||||||
config.stubs['nuxt-link'] = '<span><slot /></span>'
|
const stubs = {
|
||||||
|
'nuxt-link': true,
|
||||||
|
}
|
||||||
|
|
||||||
describe('blocked-users.vue', () => {
|
describe('blocked-users.vue', () => {
|
||||||
let wrapper
|
let wrapper
|
||||||
@ -35,7 +37,7 @@ describe('blocked-users.vue', () => {
|
|||||||
|
|
||||||
describe('mount', () => {
|
describe('mount', () => {
|
||||||
const Wrapper = () => {
|
const Wrapper = () => {
|
||||||
return mount(BlockedUsers, { mocks, localVue })
|
return mount(BlockedUsers, { mocks, localVue, stubs })
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@ -43,7 +45,7 @@ describe('blocked-users.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('div')).toBe(true)
|
expect(wrapper.element.tagName).toBe('DIV')
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('given a list of blocked users', () => {
|
describe('given a list of blocked users', () => {
|
||||||
|
|||||||
@ -26,7 +26,7 @@ describe('data-download.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('renders', () => {
|
it('renders', () => {
|
||||||
expect(wrapper.is('.base-card')).toBe(true)
|
expect(wrapper.classes('base-card')).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user