diff --git a/.dockerignore b/.dockerignore index f363d4044..fa06a985d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -6,5 +6,6 @@ npm-debug.log Dockerfile docker-compose*.yml +scripts/ .env diff --git a/.travis.yml b/.travis.yml index bbd211c18..4f357a2c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,35 @@ language: node_js node_js: - "10" -services: - - docker cache: yarn: true directories: - node_modules +services: + - docker + +env: + - DOCKER_COMPOSE_VERSION=1.23.2 + +before_install: + - scripts/run_fullstack_tests.sh # trigger full stack testing in a different repository + - sudo rm /usr/local/bin/docker-compose + - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose + - chmod +x docker-compose + - sudo mv docker-compose /usr/local/bin install: - docker build --build-arg BUILD_COMMIT=$TRAVIS_COMMIT -t humanconnection/nitro-web . + - docker-compose up -d script: - - docker run humanconnection/nitro-web yarn run lint + - docker-compose exec webapp yarn run lint + - docker-compose exec webapp yarn run test after_success: - # - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh - # - chmod +x send.sh - # - ./send.sh success $WEBHOOK_URL + - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh + - chmod +x send.sh + - ./send.sh success $WEBHOOK_URL - if [ $TRAVIS_BRANCH == "master" ] && [ $TRAVIS_EVENT_TYPE == "push" ]; then docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; docker tag humanconnection/nitro-web humanconnection/nitro-web:latest; diff --git a/package.json b/package.json index 9c21aeec4..681d760e0 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "^@/(.*)$": "/src/$1", "^@@/(.*)$": "/styleguide/src/system/$1", "^~/(.*)$": "/$1" - } + }, + "modulePathIgnorePatterns": ["/styleguide"] }, "dependencies": { "@nuxtjs/apollo": "^4.0.0-rc3", @@ -50,7 +51,8 @@ }, "devDependencies": { "@vue/eslint-config-prettier": "^4.0.1", - "@vue/test-utils": "^1.0.0-beta.25", + "@vue/server-test-utils": "^1.0.0-beta.27", + "@vue/test-utils": "^1.0.0-beta.27", "babel-eslint": "^10.0.1", "babel-jest": "^23.6.0", "babel-preset-env": "^1.7.0", diff --git a/pages/admin/categories.spec.js b/pages/admin/categories.spec.js new file mode 100644 index 000000000..a3b44de0d --- /dev/null +++ b/pages/admin/categories.spec.js @@ -0,0 +1,67 @@ +import { shallowMount, mount } from '@vue/test-utils' +import Categories from './categories.vue' + +const someCategories = [ + { + id: 'cat1', + name: 'Just For Fun', + slug: 'justforfun', + icon: 'smile', + postCount: 5 + }, + { + id: 'cat2', + name: 'Happyness & Values', + slug: 'happyness-values', + icon: 'heart-o', + postCount: 2 + }, + { + id: 'cat3', + name: 'Health & Wellbeing', + slug: 'health-wellbeing', + icon: 'medkit', + postCount: 1 + }, + { + id: 'cat4', + name: 'Environment & Nature', + slug: 'environment-nature', + icon: 'tree', + postCount: 1 + }, + { + id: 'cat5', + name: 'Animal Protection', + slug: 'animalprotection', + icon: 'paw', + postCount: 1 + } +] + +describe('Categories.vue', () => { + let wrapper + + beforeEach(() => { + wrapper = mount(Categories, {}) + }) + + it('renders', () => { + expect(wrapper.is('div')).toBe(true) + }) + + describe('given some categories', () => { + beforeEach(() => { + wrapper = mount(Categories, { + propsData: { + Categories: someCategories + } + }) + }) + + it('renders a row for each category', () => { + console.log(wrapper.html()) + expect(wrapper.findAll('tr')).toHaveLength(5) + }) + }) +}) diff --git a/pages/admin/categories.vue b/pages/admin/categories.vue index e09db79c0..ddd5f72f8 100644 --- a/pages/admin/categories.vue +++ b/pages/admin/categories.vue @@ -20,8 +20,16 @@