From 413a03fa6db1cd9cec5db5a589f7d14e44ba9fa6 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Tue, 19 Jan 2021 02:32:09 +0000 Subject: [PATCH 001/181] Bump stack-utils from 2.0.1 to 2.0.3 in /webapp Bumps [stack-utils](https://github.com/tapjs/stack-utils) from 2.0.1 to 2.0.3. - [Release notes](https://github.com/tapjs/stack-utils/releases) - [Commits](https://github.com/tapjs/stack-utils/compare/v2.0.1...v2.0.3) Signed-off-by: dependabot-preview[bot] --- webapp/package.json | 2 +- webapp/yarn.lock | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/webapp/package.json b/webapp/package.json index 58d855809..23134c19a 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -78,7 +78,7 @@ "nuxt-dropzone": "^1.0.4", "nuxt-env": "~0.1.0", "sass": "^1.30.0", - "stack-utils": "^2.0.1", + "stack-utils": "^2.0.3", "tippy.js": "^4.3.5", "tiptap": "~1.26.6", "tiptap-extensions": "~1.28.8", diff --git a/webapp/yarn.lock b/webapp/yarn.lock index dce6b5f25..967acf453 100644 --- a/webapp/yarn.lock +++ b/webapp/yarn.lock @@ -16099,14 +16099,7 @@ stack-trace@0.0.10: resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" integrity sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA= -stack-utils@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.1.tgz#3df48345a3b92adc06038f0e95782df61beff742" - integrity sha512-BvBTnHGm8boe+HiJFqP19ywEsGlfQAKqW78pbfvUuzCbUuxPPUyLrH5dYFY+Xn9IpLY3b5ZmMcl8jAqXB4wddg== - dependencies: - escape-string-regexp "^2.0.0" - -stack-utils@^2.0.2: +stack-utils@^2.0.2, stack-utils@^2.0.3: version "2.0.3" resolved "https://registry.yarnpkg.com/stack-utils/-/stack-utils-2.0.3.tgz#cd5f030126ff116b78ccb3c027fe302713b61277" integrity sha512-gL//fkxfWUsIlFL2Tl42Cl6+HFALEaB1FU76I/Fy+oZjRreP7OPMXFlGbxM7NQsI0ZpUfw76sHnv0WNYuTb7Iw== From d9810202326b4636d222c8ca43c04aa8c29c9ee1 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 21 Jan 2021 20:35:15 +0000 Subject: [PATCH 002/181] Bump merge-graphql-schemas from 1.7.7 to 1.7.8 in /backend Bumps [merge-graphql-schemas](https://github.com/Urigo/merge-graphql-schemas) from 1.7.7 to 1.7.8. - [Release notes](https://github.com/Urigo/merge-graphql-schemas/releases) - [Commits](https://github.com/Urigo/merge-graphql-schemas/compare/1.7.7...v1.7.8) Signed-off-by: dependabot-preview[bot] --- backend/package.json | 2 +- backend/yarn.lock | 99 ++++++++++++++++++++++++++------------------ 2 files changed, 59 insertions(+), 42 deletions(-) diff --git a/backend/package.json b/backend/package.json index 786fe6641..7d9e12ace 100644 --- a/backend/package.json +++ b/backend/package.json @@ -72,7 +72,7 @@ "languagedetect": "^2.0.0", "linkifyjs": "~2.1.8", "lodash": "~4.17.14", - "merge-graphql-schemas": "^1.7.7", + "merge-graphql-schemas": "^1.7.8", "metascraper": "^5.11.8", "metascraper-audio": "^5.14.26", "metascraper-author": "^5.14.22", diff --git a/backend/yarn.lock b/backend/yarn.lock index 7d6558da0..44f4d2dcc 100644 --- a/backend/yarn.lock +++ b/backend/yarn.lock @@ -910,6 +910,13 @@ dependencies: regenerator-runtime "^0.13.4" +"@babel/runtime@^7.9.2": + version "7.12.5" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.12.5.tgz#410e7e487441e1b360c29be715d870d9b985882e" + integrity sha512-plcc+hbExy3McchJCEQG3knOsuh3HH+Prx1P6cLIkET/0dLuQDEnrT+s27Axgc9bqfsmNUNHfscgMUdBpC9xfg== + dependencies: + regenerator-runtime "^0.13.4" + "@babel/template@^7.7.4", "@babel/template@^7.8.3", "@babel/template@^7.8.6": version "7.8.6" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.6.tgz#86b22af15f828dfb086474f964dcc3e39c43ce2b" @@ -956,32 +963,32 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@graphql-toolkit/common@0.9.12": - version "0.9.12" - resolved "https://registry.yarnpkg.com/@graphql-toolkit/common/-/common-0.9.12.tgz#a3bf91d00130100cfa0a72be718b16cc1011ab45" - integrity sha512-NjBVxeM1GB0bldiBm4UQoxKtbu/hjRfcqDEt1JPia+uXgFde3qTxtF5IZkworRFNCp+8KPSVrwcreQHSfFW63w== +"@graphql-toolkit/common@0.10.4": + version "0.10.4" + resolved "https://registry.yarnpkg.com/@graphql-toolkit/common/-/common-0.10.4.tgz#7785f2a3f14559d0778859c49f4442078c196695" + integrity sha512-HQ3HaxCqX+UE8y/0h7LMDBBGSIKJxY/gaQesaksvE2Y+N4NpSWdiW6HpOcgXfC2HGf9yM0hEdsERzzL8z3mbHQ== dependencies: aggregate-error "3.0.1" camel-case "4.1.1" - graphql-tools-fork "9.0.1" + graphql-tools "5.0.0" lodash "4.17.15" -"@graphql-toolkit/file-loading@0.9.12": - version "0.9.12" - resolved "https://registry.yarnpkg.com/@graphql-toolkit/file-loading/-/file-loading-0.9.12.tgz#f7d5d7e042df59c4e6c8fe3417c67dd1cddf9043" - integrity sha512-xEmKkbWI5FXQARTN3dbPzshwcmduOJUvx1QGsfcuryVDdQJZynUEaPF7IxYaFpvQF7vwxGIRdff/jC/a5ypDrA== +"@graphql-toolkit/file-loading@0.10.4": + version "0.10.4" + resolved "https://registry.yarnpkg.com/@graphql-toolkit/file-loading/-/file-loading-0.10.4.tgz#50e8933e44b17853544c1fe63350df93f33a5e80" + integrity sha512-oUmy/sO3BJfax85pVKI7FZ6TWrViNuWXoJkRM293YV9bKGuYU9TgqZoHyM+oEqWO5ruXCL/nCdw3cIBau+rSNA== dependencies: globby "11.0.0" unixify "1.0.0" -"@graphql-toolkit/schema-merging@0.9.12": - version "0.9.12" - resolved "https://registry.yarnpkg.com/@graphql-toolkit/schema-merging/-/schema-merging-0.9.12.tgz#f058a7d256a4ed0e61e9874f90ae03326b81668e" - integrity sha512-ciqxLeMw7KPbJcq/xgnPbGyJGRO6bO1zQcdWCUSssyw8VDRHj5PFqEOAzT88eZQkEtg3qLN/wQEypeyFyNTHzw== +"@graphql-toolkit/schema-merging@0.10.4": + version "0.10.4" + resolved "https://registry.yarnpkg.com/@graphql-toolkit/schema-merging/-/schema-merging-0.10.4.tgz#2428590a531a33e9fe03be27cce9030f1c4c044b" + integrity sha512-naL6reYBuILLMrkMfKz0lOLL0kl6gGYnaaywnO/Dgp9F4NeAxDdAs5CV6Fy9NO5OzePFP58Dnc4sh2RyYrrFJg== dependencies: - "@graphql-toolkit/common" "0.9.12" + "@graphql-toolkit/common" "0.10.4" deepmerge "4.2.2" - graphql-tools-fork "9.0.1" + graphql-tools "5.0.0" tslib "1.11.1" "@hapi/address@2.x.x": @@ -2036,7 +2043,7 @@ apollo-link-context@~1.0.20: apollo-link "^1.2.14" tslib "^1.9.3" -apollo-link-http-common@^0.2.15, apollo-link-http-common@^0.2.16: +apollo-link-http-common@^0.2.14, apollo-link-http-common@^0.2.16: version "0.2.16" resolved "https://registry.yarnpkg.com/apollo-link-http-common/-/apollo-link-http-common-0.2.16.tgz#756749dafc732792c8ca0923f9a40564b7c59ecc" integrity sha512-2tIhOIrnaF4UbQHf7kjeQA/EmSorB7+HyJIIrUjJOKBgnXwuexi8aMecRlqTIDWcyVXCeqLhUnztMa6bOH/jTg== @@ -2054,7 +2061,7 @@ apollo-link-http@~1.5.17: apollo-link-http-common "^0.2.16" tslib "^1.9.3" -apollo-link@^1.0.0, apollo-link@^1.2.13, apollo-link@^1.2.14: +apollo-link@^1.0.0, apollo-link@^1.2.12, apollo-link@^1.2.14: version "1.2.14" resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.14.tgz#3feda4b47f9ebba7f4160bef8b977ba725b684d9" integrity sha512-p67CMEFP7kOG1JZ0ZkYZwRDa369w5PIjtMjvrQd/HnIV8FRsHRqLqK+oAZQnFa1DDdZtOtHTi+aMIW6EatC2jg== @@ -2211,6 +2218,16 @@ apollo-tracing@^0.12.0: apollo-server-env "^2.4.5" apollo-server-plugin-base "^0.10.2" +apollo-upload-client@^13.0.0: + version "13.0.0" + resolved "https://registry.yarnpkg.com/apollo-upload-client/-/apollo-upload-client-13.0.0.tgz#146d1ddd85d711fcac8ca97a72d3ca6787f2b71b" + integrity sha512-lJ9/bk1BH1lD15WhWRha2J3+LrXrPIX5LP5EwiOUHv8PCORp4EUrcujrA3rI5hZeZygrTX8bshcuMdpqpSrvtA== + dependencies: + "@babel/runtime" "^7.9.2" + apollo-link "^1.2.12" + apollo-link-http-common "^0.2.14" + extract-files "^8.0.0" + apollo-utilities@1.3.3, apollo-utilities@^1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.3.3.tgz#f1854715a7be80cd810bc3ac95df085815c0787c" @@ -4299,10 +4316,10 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" -extract-files@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-7.0.0.tgz#3dc7853320ff7876ec62d6e98f2f4e6f3e6282f6" - integrity sha512-3AUlT7TD+DbQXNe3t70QrgJU6Wgcp7rk1Zm0vqWz8OYnw4vxihgG0TgZ2SIGrVqScc4WfOu7B4a0BezGJ0YqvQ== +extract-files@^8.0.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-8.1.0.tgz#46a0690d0fe77411a2e3804852adeaa65cd59288" + integrity sha512-PTGtfthZK79WUMk+avLmwx3NGdU8+iVFXC2NMGxKsn0MnihOG2lvumj+AZo8CTwTrwjXDgZ5tztbRlEdRjBonQ== extsprintf@1.3.0: version "1.3.0" @@ -4849,19 +4866,19 @@ graphql-tag@^2.9.2, graphql-tag@~2.10.3: resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.10.3.tgz#ea1baba5eb8fc6339e4c4cf049dabe522b0edf03" integrity sha512-4FOv3ZKfA4WdOKJeHdz6B3F/vxBLSgmBcGeAFPf4n1F64ltJUvOOerNj0rsJxONQGdhUMynQIvd6LzB+1J5oKA== -graphql-tools-fork@9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/graphql-tools-fork/-/graphql-tools-fork-9.0.1.tgz#fc8df40c108bdba3268999dea355cc614c765038" - integrity sha512-kM6mUNVekgnWKtVqLGQ9HvQqQ3zZVPZRg1esltBoohsbUMaChl+9QkjBjoMxnZPnbTGOOGGagopNBQALIBysNg== +graphql-tools@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/graphql-tools/-/graphql-tools-5.0.0.tgz#67281c834a0e29f458adba8018f424816fa627e9" + integrity sha512-5zn3vtn//382b7G3Wzz3d5q/sh+f7tVrnxeuhTMTJ7pWJijNqLxH7VEzv8VwXCq19zAzHYEosFHfXiK7qzvk7w== dependencies: - apollo-link "^1.2.13" - apollo-link-http-common "^0.2.15" + apollo-link "^1.2.14" + apollo-upload-client "^13.0.0" deprecated-decorator "^0.1.6" - extract-files "^7.0.0" form-data "^3.0.0" iterall "^1.3.0" node-fetch "^2.6.0" - uuid "^7.0.2" + tslib "^1.11.1" + uuid "^7.0.3" graphql-tools@^4.0.0, graphql-tools@^4.0.4, graphql-tools@^4.0.5: version "4.0.8" @@ -6606,13 +6623,13 @@ merge-descriptors@1.0.1: resolved "https://registry.yarnpkg.com/merge-descriptors/-/merge-descriptors-1.0.1.tgz#b00aaa556dd8b44568150ec9d1b953f3f90cbb61" integrity sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E= -merge-graphql-schemas@^1.7.7: - version "1.7.7" - resolved "https://registry.yarnpkg.com/merge-graphql-schemas/-/merge-graphql-schemas-1.7.7.tgz#673898f97c384d88fd66e49359b2f604e5864441" - integrity sha512-3mjFHXpsF+bnsnSy/FlZiWCcNo7AULuG8kEBE+YVX8qbzNrEPJVhSg7ANr5LjQZbGtSlTz7fa3Wqw0bfbQ5R5Q== +merge-graphql-schemas@^1.7.8: + version "1.7.8" + resolved "https://registry.yarnpkg.com/merge-graphql-schemas/-/merge-graphql-schemas-1.7.8.tgz#11a0a672a38a61d988c09ffdebe1bd4f8418de48" + integrity sha512-C3EJ1i86OjmbcCT524wVPRl17M5VZzgyh9kIGYAlYnAILX+7xfh8cCbMKfehh9n4opZg6CtcPogCiVZ6PB2NyQ== dependencies: - "@graphql-toolkit/file-loading" "0.9.12" - "@graphql-toolkit/schema-merging" "0.9.12" + "@graphql-toolkit/file-loading" "0.10.4" + "@graphql-toolkit/schema-merging" "0.10.4" tslib "1.11.1" merge-stream@^2.0.0: @@ -9406,15 +9423,15 @@ ts-invariant@^0.4.0: dependencies: tslib "^1.9.3" -tslib@1.11.1, tslib@^1.9.0: +tslib@1.11.1: version "1.11.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35" integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA== -tslib@^1.10.0, tslib@^1.9.3: - version "1.13.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.13.0.tgz#c881e13cc7015894ed914862d276436fa9a47043" - integrity sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q== +tslib@^1.10.0, tslib@^1.11.1, tslib@^1.9.0, tslib@^1.9.3: + version "1.14.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" + integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== tunnel-agent@^0.6.0: version "0.6.0" @@ -9689,7 +9706,7 @@ uuid@^3.1.0, uuid@^3.3.2: resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee" integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A== -uuid@^7.0.2: +uuid@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/uuid/-/uuid-7.0.3.tgz#c5c9f2c8cf25dc0a372c4df1441c41f5bd0c680b" integrity sha512-DPSke0pXhTZgoF/d+WSt2QaKMCFSfx7QegxEWT+JOuHF5aWrKEn0G+ztjuJg/gG8/ItK+rbPCD/yNv8yyih6Cg== From afbc30feefc22890907d09e819a36f2d359da78a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 15 Apr 2021 13:28:07 +0000 Subject: [PATCH 003/181] Bump cross-env from 7.0.2 to 7.0.3 Bumps [cross-env](https://github.com/kentcdodds/cross-env) from 7.0.2 to 7.0.3. - [Release notes](https://github.com/kentcdodds/cross-env/releases) - [Changelog](https://github.com/kentcdodds/cross-env/blob/master/CHANGELOG.md) - [Commits](https://github.com/kentcdodds/cross-env/compare/v7.0.2...v7.0.3) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 19 +++++-------------- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 937b0a6bc..7c9ffbbfe 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "auto-changelog": "^2.2.1", "bcryptjs": "^2.4.3", "codecov": "^3.7.1", - "cross-env": "^7.0.2", + "cross-env": "^7.0.3", "cucumber": "^6.0.5", "cypress": "^7.0.1", "cypress-cucumber-preprocessor": "^2.2.1", diff --git a/yarn.lock b/yarn.lock index 15394a334..24edfebad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2374,10 +2374,10 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" -cross-env@^7.0.2: - version "7.0.2" - resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.2.tgz#bd5ed31339a93a3418ac4f3ca9ca3403082ae5f9" - integrity sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw== +cross-env@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf" + integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw== dependencies: cross-spawn "^7.0.1" @@ -2400,7 +2400,7 @@ cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.0: +cross-spawn@^7.0.0, cross-spawn@^7.0.1: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -2409,15 +2409,6 @@ cross-spawn@^7.0.0: shebang-command "^2.0.0" which "^2.0.1" -cross-spawn@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14" - integrity sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg== - dependencies: - path-key "^3.1.0" - shebang-command "^2.0.0" - which "^2.0.1" - crypto-browserify@^3.0.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" From e6bc612d4f8cb565491e013d54cba66474d0d221 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 15 Apr 2021 13:28:09 +0000 Subject: [PATCH 004/181] Bump graphql-request from 1.8.2 to 2.0.0 Bumps [graphql-request](https://github.com/prisma/graphql-request) from 1.8.2 to 2.0.0. - [Release notes](https://github.com/prisma/graphql-request/releases) - [Commits](https://github.com/prisma/graphql-request/compare/v1.8.2...v2.0.0) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 28 ++++------------------------ 2 files changed, 5 insertions(+), 25 deletions(-) diff --git a/package.json b/package.json index 937b0a6bc..b837da025 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "dotenv": "^8.2.0", "expect": "^25.3.0", "faker": "Marak/faker.js#master", - "graphql-request": "^1.8.2", + "graphql-request": "^2.0.0", "import": "^0.0.6", "jsonwebtoken": "^8.5.1", "mock-socket": "^9.0.3", diff --git a/yarn.lock b/yarn.lock index 15394a334..30b1ac088 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2381,14 +2381,6 @@ cross-env@^7.0.2: dependencies: cross-spawn "^7.0.1" -cross-fetch@2.2.2: - version "2.2.2" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-2.2.2.tgz#a47ff4f7fc712daba8f6a695a11c948440d45723" - integrity sha1-pH/09/xxLauo9qaVoRyUhEDUVyM= - dependencies: - node-fetch "2.1.2" - whatwg-fetch "2.0.4" - cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -3330,12 +3322,10 @@ graceful-fs@^4.2.0: resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== -graphql-request@^1.8.2: - version "1.8.2" - resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-1.8.2.tgz#398d10ae15c585676741bde3fc01d5ca948f8fbe" - integrity sha512-dDX2M+VMsxXFCmUX0Vo0TopIZIX4ggzOtiCsThgtrKR4niiaagsGTDIHj3fsOMFETpa064vzovI+4YV4QnMbcg== - dependencies: - cross-fetch "2.2.2" +graphql-request@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-2.0.0.tgz#8dd12cf1eb2ce0c80f4114fd851741e091134862" + integrity sha512-Ww3Ax+G3l2d+mPT8w7HC9LfrKjutnCKtnDq7ZZp2ghVk5IQDjwAk3/arRF1ix17Ky15rm0hrSKVKxRhIVlSuoQ== handlebars@^4.7.3: version "4.7.3" @@ -4529,11 +4519,6 @@ no-case@^2.2.0: dependencies: lower-case "^1.1.1" -node-fetch@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.1.2.tgz#ab884e8e7e57e38a944753cec706f788d1768bb5" - integrity sha1-q4hOjn5X44qUR1POxwb3iNF2i7U= - node-fetch@^2.2.0, node-fetch@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" @@ -6177,11 +6162,6 @@ watchify@3.11.1: through2 "^2.0.0" xtend "^4.0.0" -whatwg-fetch@2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" - integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng== - which@^1.2.9: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" From d354f9630a7f4dc7b14c0a1bd66f802f48d94182 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 12:44:01 +0200 Subject: [PATCH 005/181] Use build args instead of envs for the version, date & commit --- .github/workflows/publish.yml | 302 +++++++++++++++++++--------------- backend/Dockerfile | 7 +- neo4j/Dockerfile | 6 +- webapp/Dockerfile | 6 +- 4 files changed, 176 insertions(+), 145 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 24350a81a..701c12aa1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,8 +2,8 @@ name: ocelot.social publish CI on: push: - branches: - - master +# branches: +# - master jobs: ############################################################################## @@ -56,7 +56,16 @@ jobs: ########################################################################## - name: Neo4J | Build `community` image run: | - docker build --target community -t "ocelotsocialnetwork/neo4j:latest" -t "ocelotsocialnetwork/neo4j:community" -t "ocelotsocialnetwork/neo4j:${VERSION}" -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" neo4j/ + docker build \ + --target community \ + -t "ocelotsocialnetwork/neo4j:latest" \ + -t "ocelotsocialnetwork/neo4j:community" \ + -t "ocelotsocialnetwork/neo4j:${VERSION}" \ + -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" \ + --build-arg BUILD_DATE=$BUILD_ DATE \ + --build-arg BUILD_VERSION=$BUILD_VERSION \ + --build-arg BUILD_COMMIT=$BUILD_COMMIT \ + neo4j/ docker save "ocelotsocialnetwork/neo4j" > /tmp/neo4j.tar - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -93,7 +102,15 @@ jobs: ########################################################################## - name: backend | Build `production` image run: | - docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" backend/ + docker build \ + --target production \ + -t "ocelotsocialnetwork/backend:latest" \ + -t "ocelotsocialnetwork/backend:${VERSION}" \ + -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" + --build-arg BUILD_DATE=$BUILD_ DATE \ + --build-arg BUILD_VERSION=$BUILD_VERSION \ + --build-arg BUILD_COMMIT=$BUILD_COMMIT \ + backend/ docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -130,7 +147,15 @@ jobs: ########################################################################## - name: webapp | Build `production` image run: | - docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" webapp/ + docker build \ + --target production \ + -t "ocelotsocialnetwork/webapp:latest" \ + -t "ocelotsocialnetwork/webapp:${VERSION}" \ + -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" \ + --build-arg BUILD_DATE=$BUILD_ DATE \ + --build-arg BUILD_VERSION=$BUILD_VERSION \ + --build-arg BUILD_COMMIT=$BUILD_COMMIT \ + webapp/ docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -168,7 +193,14 @@ jobs: - name: maintenance | Build `production` image # TODO: --target production run: | - docker build -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" webapp/ -f webapp/Dockerfile.maintenance + docker build \ + -t "ocelotsocialnetwork/maintenance:latest" \ + -t "ocelotsocialnetwork/maintenance:${VERSION}" \ + -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" \ + --build-arg BUILD_DATE=$BUILD_ DATE \ + --build-arg BUILD_VERSION=$BUILD_VERSION \ + --build-arg BUILD_COMMIT=$BUILD_COMMIT \ + webapp/ -f webapp/Dockerfile.maintenance docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -176,132 +208,132 @@ jobs: name: docker-maintenance-production path: /tmp/maintenance.tar - ############################################################################## - # JOB: UPLOAD TO DOCKERHUB ################################################### - ############################################################################## - upload_to_dockerhub: - name: Upload to Dockerhub - runs-on: ubuntu-latest - needs: [build_production_neo4j,build_production_backend,build_production_webapp,build_production_maintenance] - env: - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v2 - ########################################################################## - # DOWNLOAD DOCKER IMAGES ################################################# - ########################################################################## - - name: Download Docker Image (Neo4J) - uses: actions/download-artifact@v2 - with: - name: docker-neo4j-community - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/neo4j.tar - - name: Download Docker Image (Backend) - uses: actions/download-artifact@v2 - with: - name: docker-backend-production - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/backend.tar - - name: Download Docker Image (WebApp) - uses: actions/download-artifact@v2 - with: - name: docker-webapp-production - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/webapp.tar - - name: Download Docker Image (Maintenance) - uses: actions/download-artifact@v2 - with: - name: docker-maintenance-production - path: /tmp - - name: Load Docker Image - run: docker load < /tmp/maintenance.tar - ########################################################################## - # Upload ################################################################# - ########################################################################## - - name: login to dockerhub - run: echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin - - name: Push neo4j - run: docker push --all-tags ocelotsocialnetwork/neo4j - - name: Push backend - run: docker push --all-tags ocelotsocialnetwork/backend - - name: Push webapp - run: docker push --all-tags ocelotsocialnetwork/webapp - - name: Push maintenance - run: docker push --all-tags ocelotsocialnetwork/maintenance - - ############################################################################## - # JOB: GITHUB TAG LATEST VERSION ############################################# - ############################################################################## - github_tag: - name: Tag latest version on Github - runs-on: ubuntu-latest - needs: [upload_to_dockerhub] - steps: - ########################################################################## - # CHECKOUT CODE ########################################################## - ########################################################################## - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 # Fetch full History for changelog - ########################################################################## - # SET ENVS ############################################################### - ########################################################################## - - name: ENV - VERSION - run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV - - name: ENV - BUILD_DATE - run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV - - name: ENV - BUILD_VERSION - run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV - - name: ENV - BUILD_COMMIT - run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV - ########################################################################## - # Push version tag to GitHub ############################################# - ########################################################################## - # TODO: this will error on duplicate - #- name: package-version-to-git-tag - # uses: pkgdeps/git-tag-action@v2 - # with: - # github_token: ${{ secrets.GITHUB_TOKEN }} - # github_repo: ${{ github.repository }} - # version: ${{ env.VERSION }} - # git_commit_sha: ${{ github.sha }} - # git_tag_prefix: "v" - ########################################################################## - # Push build tag to GitHub ############################################### - ########################################################################## - - name: package-version-to-git-tag + build number - uses: pkgdeps/git-tag-action@v2 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - github_repo: ${{ github.repository }} - version: ${{ env.BUILD_VERSION }} - git_commit_sha: ${{ github.sha }} - git_tag_prefix: "b" - ########################################################################## - # Push release tag to GitHub ############################################# - ########################################################################## - - name: yarn install - run: yarn install - - name: generate changelog - run: yarn auto-changelog --latest-version ${{ env.VERSION }} --unreleased-only - - name: package-version-to-git-release - continue-on-error: true # Will fail if tag exists - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token - with: - tag_name: ${{ env.VERSION }} - release_name: ${{ env.VERSION }} - body_path: ./CHANGELOG.md - draft: false - prerelease: false \ No newline at end of file +# ############################################################################## +# # JOB: UPLOAD TO DOCKERHUB ################################################### +# ############################################################################## +# upload_to_dockerhub: +# name: Upload to Dockerhub +# runs-on: ubuntu-latest +# needs: [build_production_neo4j,build_production_backend,build_production_webapp,build_production_maintenance] +# env: +# DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} +# DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} +# steps: +# ########################################################################## +# # CHECKOUT CODE ########################################################## +# ########################################################################## +# - name: Checkout code +# uses: actions/checkout@v2 +# ########################################################################## +# # DOWNLOAD DOCKER IMAGES ################################################# +# ########################################################################## +# - name: Download Docker Image (Neo4J) +# uses: actions/download-artifact@v2 +# with: +# name: docker-neo4j-community +# path: /tmp +# - name: Load Docker Image +# run: docker load < /tmp/neo4j.tar +# - name: Download Docker Image (Backend) +# uses: actions/download-artifact@v2 +# with: +# name: docker-backend-production +# path: /tmp +# - name: Load Docker Image +# run: docker load < /tmp/backend.tar +# - name: Download Docker Image (WebApp) +# uses: actions/download-artifact@v2 +# with: +# name: docker-webapp-production +# path: /tmp +# - name: Load Docker Image +# run: docker load < /tmp/webapp.tar +# - name: Download Docker Image (Maintenance) +# uses: actions/download-artifact@v2 +# with: +# name: docker-maintenance-production +# path: /tmp +# - name: Load Docker Image +# run: docker load < /tmp/maintenance.tar +# ########################################################################## +# # Upload ################################################################# +# ########################################################################## +# - name: login to dockerhub +# run: echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin +# - name: Push neo4j +# run: docker push --all-tags ocelotsocialnetwork/neo4j +# - name: Push backend +# run: docker push --all-tags ocelotsocialnetwork/backend +# - name: Push webapp +# run: docker push --all-tags ocelotsocialnetwork/webapp +# - name: Push maintenance +# run: docker push --all-tags ocelotsocialnetwork/maintenance +# +# ############################################################################## +# # JOB: GITHUB TAG LATEST VERSION ############################################# +# ############################################################################## +# github_tag: +# name: Tag latest version on Github +# runs-on: ubuntu-latest +# needs: [upload_to_dockerhub] +# steps: +# ########################################################################## +# # CHECKOUT CODE ########################################################## +# ########################################################################## +# - name: Checkout code +# uses: actions/checkout@v2 +# with: +# fetch-depth: 0 # Fetch full History for changelog +# ########################################################################## +# # SET ENVS ############################################################### +# ########################################################################## +# - name: ENV - VERSION +# run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV +# - name: ENV - BUILD_DATE +# run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV +# - name: ENV - BUILD_VERSION +# run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV +# - name: ENV - BUILD_COMMIT +# run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV +# ########################################################################## +# # Push version tag to GitHub ############################################# +# ########################################################################## +# # TODO: this will error on duplicate +# #- name: package-version-to-git-tag +# # uses: pkgdeps/git-tag-action@v2 +# # with: +# # github_token: ${{ secrets.GITHUB_TOKEN }} +# # github_repo: ${{ github.repository }} +# # version: ${{ env.VERSION }} +# # git_commit_sha: ${{ github.sha }} +# # git_tag_prefix: "v" +# ########################################################################## +# # Push build tag to GitHub ############################################### +# ########################################################################## +# - name: package-version-to-git-tag + build number +# uses: pkgdeps/git-tag-action@v2 +# with: +# github_token: ${{ secrets.GITHUB_TOKEN }} +# github_repo: ${{ github.repository }} +# version: ${{ env.BUILD_VERSION }} +# git_commit_sha: ${{ github.sha }} +# git_tag_prefix: "b" +# ########################################################################## +# # Push release tag to GitHub ############################################# +# ########################################################################## +# - name: yarn install +# run: yarn install +# - name: generate changelog +# run: yarn auto-changelog --latest-version ${{ env.VERSION }} --unreleased-only +# - name: package-version-to-git-release +# continue-on-error: true # Will fail if tag exists +# id: create_release +# uses: actions/create-release@v1 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token +# with: +# tag_name: ${{ env.VERSION }} +# release_name: ${{ env.VERSION }} +# body_path: ./CHANGELOG.md +# draft: false +# prerelease: false \ No newline at end of file diff --git a/backend/Dockerfile b/backend/Dockerfile index 2f2b70f04..146e1151a 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -3,15 +3,14 @@ ################################################################################## FROM node:12.19.0-alpine3.10 as base -# ENVs (available in production aswell, can be overwritten by commandline or env file) ## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame ENV DOCKER_WORKDIR="/app" ## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 -ENV BUILD_DATE="1970-01-01T00:00:00.00Z" +ARG BUILD_DATE="1970-01-01T00:00:00.00Z" ## We cannot do $(yarn run version)-${BUILD_NUMBER} here so we default to 0.0.0-0 -ENV BUILD_VERSION="0.0.0-0" +ARG BUILD_VERSION="0.0.0-0" ## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 -ENV BUILD_COMMIT="0000000" +ARG BUILD_COMMIT="0000000" ## SET NODE_ENV ENV NODE_ENV="production" ## App relevant Envs diff --git a/neo4j/Dockerfile b/neo4j/Dockerfile index e7931378a..79c4fb303 100644 --- a/neo4j/Dockerfile +++ b/neo4j/Dockerfile @@ -5,11 +5,11 @@ FROM neo4j:3.5.14 as community # ENVs (available in production aswell, can be overwritten by commandline or env file) ## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 -ENV BUILD_DATE="1970-01-01T00:00:00.00Z" +ARG BUILD_DATE="1970-01-01T00:00:00.00Z" ## We cannot do $(yarn run version)-${BUILD_NUMBER} here so we default to 0.0.0-0 -ENV BUILD_VERSION="0.0.0-0" +ARG BUILD_VERSION="0.0.0-0" ## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 -ENV BUILD_COMMIT="0000000" +ARG BUILD_COMMIT="0000000" # Labels LABEL org.label-schema.build-date="${BUILD_DATE}" diff --git a/webapp/Dockerfile b/webapp/Dockerfile index eda437920..f4e96e202 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -7,11 +7,11 @@ FROM node:12.19.0-alpine3.10 as base ## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame ENV DOCKER_WORKDIR="/app" ## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 -ENV BUILD_DATE="1970-01-01T00:00:00.00Z" +ARG BUILD_DATE="1970-01-01T00:00:00.00Z" ## We cannot do $(yarn run version)-${BUILD_NUMBER} here so we default to 0.0.0-0 -ENV BUILD_VERSION="0.0.0-0" +ARG BUILD_VERSION="0.0.0-0" ## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 -ENV BUILD_COMMIT="0000000" +ARG BUILD_COMMIT="0000000" ## SET NODE_ENV ENV NODE_ENV="production" ## App relevant Envs From 31aff904f8655141b1fdcd980c3aa90f8c8ee9da Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 12:51:44 +0200 Subject: [PATCH 006/181] multiline not properly working --- .github/workflows/publish.yml | 40 ++++------------------------------- 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 701c12aa1..e0b9d0852 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -56,16 +56,7 @@ jobs: ########################################################################## - name: Neo4J | Build `community` image run: | - docker build \ - --target community \ - -t "ocelotsocialnetwork/neo4j:latest" \ - -t "ocelotsocialnetwork/neo4j:community" \ - -t "ocelotsocialnetwork/neo4j:${VERSION}" \ - -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" \ - --build-arg BUILD_DATE=$BUILD_ DATE \ - --build-arg BUILD_VERSION=$BUILD_VERSION \ - --build-arg BUILD_COMMIT=$BUILD_COMMIT \ - neo4j/ + docker build --target community -t "ocelotsocialnetwork/neo4j:latest" -t "ocelotsocialnetwork/neo4j:community" -t "ocelotsocialnetwork/neo4j:${VERSION}" -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_ DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT neo4j/ docker save "ocelotsocialnetwork/neo4j" > /tmp/neo4j.tar - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -102,15 +93,7 @@ jobs: ########################################################################## - name: backend | Build `production` image run: | - docker build \ - --target production \ - -t "ocelotsocialnetwork/backend:latest" \ - -t "ocelotsocialnetwork/backend:${VERSION}" \ - -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" - --build-arg BUILD_DATE=$BUILD_ DATE \ - --build-arg BUILD_VERSION=$BUILD_VERSION \ - --build-arg BUILD_COMMIT=$BUILD_COMMIT \ - backend/ + docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_ DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT backend/ docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -147,15 +130,7 @@ jobs: ########################################################################## - name: webapp | Build `production` image run: | - docker build \ - --target production \ - -t "ocelotsocialnetwork/webapp:latest" \ - -t "ocelotsocialnetwork/webapp:${VERSION}" \ - -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" \ - --build-arg BUILD_DATE=$BUILD_ DATE \ - --build-arg BUILD_VERSION=$BUILD_VERSION \ - --build-arg BUILD_COMMIT=$BUILD_COMMIT \ - webapp/ + docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_ DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT webapp/ docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -193,14 +168,7 @@ jobs: - name: maintenance | Build `production` image # TODO: --target production run: | - docker build \ - -t "ocelotsocialnetwork/maintenance:latest" \ - -t "ocelotsocialnetwork/maintenance:${VERSION}" \ - -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" \ - --build-arg BUILD_DATE=$BUILD_ DATE \ - --build-arg BUILD_VERSION=$BUILD_VERSION \ - --build-arg BUILD_COMMIT=$BUILD_COMMIT \ - webapp/ -f webapp/Dockerfile.maintenance + docker build -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_ DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar - name: Upload Artifact uses: actions/upload-artifact@v2 From 6d890e28ae554d43bc849356ded83d7d5d8c9d1b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 12:59:14 +0200 Subject: [PATCH 007/181] fixed build command --- .github/workflows/publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e0b9d0852..666266e39 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -56,7 +56,7 @@ jobs: ########################################################################## - name: Neo4J | Build `community` image run: | - docker build --target community -t "ocelotsocialnetwork/neo4j:latest" -t "ocelotsocialnetwork/neo4j:community" -t "ocelotsocialnetwork/neo4j:${VERSION}" -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_ DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT neo4j/ + docker build --target community -t "ocelotsocialnetwork/neo4j:latest" -t "ocelotsocialnetwork/neo4j:community" -t "ocelotsocialnetwork/neo4j:${VERSION}" -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT neo4j/ docker save "ocelotsocialnetwork/neo4j" > /tmp/neo4j.tar - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -93,7 +93,7 @@ jobs: ########################################################################## - name: backend | Build `production` image run: | - docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_ DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT backend/ + docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT backend/ docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -130,7 +130,7 @@ jobs: ########################################################################## - name: webapp | Build `production` image run: | - docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_ DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT webapp/ + docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT webapp/ docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -168,7 +168,7 @@ jobs: - name: maintenance | Build `production` image # TODO: --target production run: | - docker build -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_ DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance + docker build -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar - name: Upload Artifact uses: actions/upload-artifact@v2 From 79beb840c5bbcd989603b219b45e218a96fd7b4d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 13:15:45 +0200 Subject: [PATCH 008/181] -separate commands in two, docker build & save to allow multi-line commands -have arg and env variables --- .github/workflows/publish.yml | 66 +++++++++++++++++++++++++++-------- backend/Dockerfile | 10 ++++-- neo4j/Dockerfile | 11 +++--- webapp/Dockerfile | 11 +++--- 4 files changed, 72 insertions(+), 26 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 666266e39..a38c05561 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -55,9 +55,19 @@ jobs: # NEO4J ################################################################## ########################################################################## - name: Neo4J | Build `community` image - run: | - docker build --target community -t "ocelotsocialnetwork/neo4j:latest" -t "ocelotsocialnetwork/neo4j:community" -t "ocelotsocialnetwork/neo4j:${VERSION}" -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT neo4j/ - docker save "ocelotsocialnetwork/neo4j" > /tmp/neo4j.tar + run: > + docker build + --target community + -t "ocelotsocialnetwork/neo4j:latest" + -t "ocelotsocialnetwork/neo4j:community" + -t "ocelotsocialnetwork/neo4j:${VERSION}" + -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" + --build-arg BBUILD_DATE=$BUILD_DATE + --build-arg BBUILD_VERSION=$BUILD_VERSION + --build-arg BBUILD_COMMIT=$BUILD_COMMIT + neo4j/ + - name: Neo4J | Save docker image + run: docker save "ocelotsocialnetwork/neo4j" > /tmp/neo4j.tar - name: Upload Artifact uses: actions/upload-artifact@v2 with: @@ -91,10 +101,19 @@ jobs: ########################################################################## # BUILD BACKEND DOCKER IMAGE (production) ################################ ########################################################################## - - name: backend | Build `production` image - run: | - docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT backend/ - docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar + - name: Backend | Build `production` image + run: > + docker build + --target production + -t "ocelotsocialnetwork/backend:latest" + -t "ocelotsocialnetwork/backend:${VERSION}" + -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" + --build-arg BBUILD_DATE=$BUILD_DATE + --build-arg BBUILD_VERSION=$BUILD_VERSION + --build-arg BBUILD_COMMIT=$BUILD_COMMIT + backend/ + - name: Backend | Save docker image + run: docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar - name: Upload Artifact uses: actions/upload-artifact@v2 with: @@ -128,10 +147,19 @@ jobs: ########################################################################## # BUILD WEBAPP DOCKER IMAGE (build) ###################################### ########################################################################## - - name: webapp | Build `production` image - run: | - docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT webapp/ - docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar + - name: Webapp | Build `production` image + run: > + docker build + --target production + -t "ocelotsocialnetwork/webapp:latest" + -t "ocelotsocialnetwork/webapp:${VERSION}" + -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" + --build-arg BBUILD_DATE=$BUILD_DATE + --build-arg BBUILD_VERSION=$BUILD_VERSION + --build-arg BBUILD_COMMIT=$BUILD_COMMIT + webapp/ + - name: Webapp | Save docker image + run: docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar - name: Upload Artifact uses: actions/upload-artifact@v2 with: @@ -165,11 +193,19 @@ jobs: ########################################################################## # BUILD MAINTENANCE DOCKER IMAGE (build) ################################# ########################################################################## - - name: maintenance | Build `production` image + - name: Maintenance | Build `production` image # TODO: --target production - run: | - docker build -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BUILD_DATE=$BUILD_DATE --build-arg BUILD_VERSION=$BUILD_VERSION --build-arg BUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance - docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar + run: > + docker build + -t "ocelotsocialnetwork/maintenance:latest" + -t "ocelotsocialnetwork/maintenance:${VERSION}" + -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" + --build-arg BBUILD_DATE=$BUILD_DATE + --build-arg BBUILD_VERSION=$BUILD_VERSION + --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ + -f webapp/Dockerfile.maintenance + - name: Maintenance | Save docker image + run: docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar - name: Upload Artifact uses: actions/upload-artifact@v2 with: diff --git a/backend/Dockerfile b/backend/Dockerfile index 146e1151a..c632f8803 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -3,14 +3,18 @@ ################################################################################## FROM node:12.19.0-alpine3.10 as base +# ENVs ## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame ENV DOCKER_WORKDIR="/app" ## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 -ARG BUILD_DATE="1970-01-01T00:00:00.00Z" +ARG BBUILD_DATE="1970-01-01T00:00:00.00Z" +ENV BUILD_DATE=$BBUILD_DATE ## We cannot do $(yarn run version)-${BUILD_NUMBER} here so we default to 0.0.0-0 -ARG BUILD_VERSION="0.0.0-0" +ARG BBUILD_VERSION="0.0.0-0" +ENV BUILD_VERSION=$BBUILD_VERSION ## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 -ARG BUILD_COMMIT="0000000" +ARG BBUILD_COMMIT="0000000" +ENV BUILD_COMMIT=$BBUILD_COMMIT ## SET NODE_ENV ENV NODE_ENV="production" ## App relevant Envs diff --git a/neo4j/Dockerfile b/neo4j/Dockerfile index 79c4fb303..4bdc4ef1f 100644 --- a/neo4j/Dockerfile +++ b/neo4j/Dockerfile @@ -3,13 +3,16 @@ ################################################################################## FROM neo4j:3.5.14 as community -# ENVs (available in production aswell, can be overwritten by commandline or env file) +# ENVs ## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 -ARG BUILD_DATE="1970-01-01T00:00:00.00Z" +ARG BBUILD_DATE="1970-01-01T00:00:00.00Z" +ENV BUILD_DATE=$BBUILD_DATE ## We cannot do $(yarn run version)-${BUILD_NUMBER} here so we default to 0.0.0-0 -ARG BUILD_VERSION="0.0.0-0" +ARG BBUILD_VERSION="0.0.0-0" +ENV BUILD_VERSION=$BBUILD_VERSION ## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 -ARG BUILD_COMMIT="0000000" +ARG BBUILD_COMMIT="0000000" +ENV BUILD_COMMIT=$BBUILD_COMMIT # Labels LABEL org.label-schema.build-date="${BUILD_DATE}" diff --git a/webapp/Dockerfile b/webapp/Dockerfile index f4e96e202..75d43bf59 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -3,15 +3,18 @@ ################################################################################## FROM node:12.19.0-alpine3.10 as base -# ENVs (available in production aswell, can be overwritten by commandline or env file) +# ENVs ## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame ENV DOCKER_WORKDIR="/app" ## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 -ARG BUILD_DATE="1970-01-01T00:00:00.00Z" +ARG BBUILD_DATE="1970-01-01T00:00:00.00Z" +ENV BUILD_DATE=$BBUILD_DATE ## We cannot do $(yarn run version)-${BUILD_NUMBER} here so we default to 0.0.0-0 -ARG BUILD_VERSION="0.0.0-0" +ARG BBUILD_VERSION="0.0.0-0" +ENV BUILD_VERSION=$BBUILD_VERSION ## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 -ARG BUILD_COMMIT="0000000" +ARG BBUILD_COMMIT="0000000" +ENV BUILD_COMMIT=$BBUILD_COMMIT ## SET NODE_ENV ENV NODE_ENV="production" ## App relevant Envs From 5dc844b431d3911d7ddbf3d22df170d56d1e2c7e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 13:21:24 +0200 Subject: [PATCH 009/181] multi line simply doesnt work --- .github/workflows/publish.yml | 44 ++++------------------------------- 1 file changed, 4 insertions(+), 40 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index a38c05561..426517e8e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -55,17 +55,7 @@ jobs: # NEO4J ################################################################## ########################################################################## - name: Neo4J | Build `community` image - run: > - docker build - --target community - -t "ocelotsocialnetwork/neo4j:latest" - -t "ocelotsocialnetwork/neo4j:community" - -t "ocelotsocialnetwork/neo4j:${VERSION}" - -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" - --build-arg BBUILD_DATE=$BUILD_DATE - --build-arg BBUILD_VERSION=$BUILD_VERSION - --build-arg BBUILD_COMMIT=$BUILD_COMMIT - neo4j/ + run: docker build --target community -t "ocelotsocialnetwork/neo4j:latest" -t "ocelotsocialnetwork/neo4j:community" -t "ocelotsocialnetwork/neo4j:${VERSION}" -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT neo4j/ - name: Neo4J | Save docker image run: docker save "ocelotsocialnetwork/neo4j" > /tmp/neo4j.tar - name: Upload Artifact @@ -102,16 +92,7 @@ jobs: # BUILD BACKEND DOCKER IMAGE (production) ################################ ########################################################################## - name: Backend | Build `production` image - run: > - docker build - --target production - -t "ocelotsocialnetwork/backend:latest" - -t "ocelotsocialnetwork/backend:${VERSION}" - -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" - --build-arg BBUILD_DATE=$BUILD_DATE - --build-arg BBUILD_VERSION=$BUILD_VERSION - --build-arg BBUILD_COMMIT=$BUILD_COMMIT - backend/ + run: docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ - name: Backend | Save docker image run: docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar - name: Upload Artifact @@ -148,16 +129,7 @@ jobs: # BUILD WEBAPP DOCKER IMAGE (build) ###################################### ########################################################################## - name: Webapp | Build `production` image - run: > - docker build - --target production - -t "ocelotsocialnetwork/webapp:latest" - -t "ocelotsocialnetwork/webapp:${VERSION}" - -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" - --build-arg BBUILD_DATE=$BUILD_DATE - --build-arg BBUILD_VERSION=$BUILD_VERSION - --build-arg BBUILD_COMMIT=$BUILD_COMMIT - webapp/ + run: docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ - name: Webapp | Save docker image run: docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar - name: Upload Artifact @@ -195,15 +167,7 @@ jobs: ########################################################################## - name: Maintenance | Build `production` image # TODO: --target production - run: > - docker build - -t "ocelotsocialnetwork/maintenance:latest" - -t "ocelotsocialnetwork/maintenance:${VERSION}" - -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" - --build-arg BBUILD_DATE=$BUILD_DATE - --build-arg BBUILD_VERSION=$BUILD_VERSION - --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ - -f webapp/Dockerfile.maintenance + run: docker build -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance - name: Maintenance | Save docker image run: docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar - name: Upload Artifact From cb464832d6a90546950f1de95ea15f11c248a737 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 13:35:24 +0200 Subject: [PATCH 010/181] did some improvements on the maintenance docker image --- webapp/Dockerfile.maintenance | 59 ++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/webapp/Dockerfile.maintenance b/webapp/Dockerfile.maintenance index b02fe352b..19d316ced 100644 --- a/webapp/Dockerfile.maintenance +++ b/webapp/Dockerfile.maintenance @@ -1,19 +1,56 @@ +################################################################################## +# BASE ########################################################################### +################################################################################## FROM node:12.19.0-alpine3.10 as build -LABEL Description="Maintenance page of the Social Network ocelot.social" Vendor="ocelot.social Community" Version="0.0.1" Maintainer="ocelot.social Community (devops@ocelot.social)" -EXPOSE 3000 -CMD ["yarn", "run", "start"] +# ENVs +## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame +ENV DOCKER_WORKDIR="/app" +## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 +ARG BBUILD_DATE="1970-01-01T00:00:00.00Z" +ENV BUILD_DATE=$BBUILD_DATE +## We cannot do $(yarn run version)-${BUILD_NUMBER} here so we default to 0.0.0-0 +ARG BBUILD_VERSION="0.0.0-0" +ENV BUILD_VERSION=$BBUILD_VERSION +## We cannot do `$(git rev-parse --short HEAD)` here so we default to 0000000 +ARG BBUILD_COMMIT="0000000" +ENV BUILD_COMMIT=$BBUILD_COMMIT +## SET NODE_ENV +ENV NODE_ENV="production" +## App relevant Envs +ENV PORT="3000" -# Expose the app port -ARG BUILD_COMMIT -ENV BUILD_COMMIT=$BUILD_COMMIT -ARG WORKDIR=/develop-webapp -RUN mkdir -p $WORKDIR -WORKDIR $WORKDIR +# Labels +LABEL org.label-schema.build-date="${BUILD_DATE}" +LABEL org.label-schema.name="ocelot.social:backend" +LABEL org.label-schema.description="Maintenance page of the Social Network Software ocelot.social" +LABEL org.label-schema.usage="https://github.com/Ocelot-Social-Community/Ocelot-Social/blob/master/README.md" +LABEL org.label-schema.url="https://ocelot.social" +LABEL org.label-schema.vcs-url="https://github.com/Ocelot-Social-Community/Ocelot-Social/tree/master/backend" +LABEL org.label-schema.vcs-ref="${BUILD_COMMIT}" +LABEL org.label-schema.vendor="ocelot.social Community" +LABEL org.label-schema.version="${BUILD_VERSION}" +LABEL org.label-schema.schema-version="1.0" +LABEL maintainer="devops@ocelot.social" -# See: https://github.com/nodejs/docker-node/pull/367#issuecomment-430807898 +# Install Additional Software +## install: git RUN apk --no-cache add git +# Settings +## Expose Container Port +EXPOSE ${PORT} + +## Workdir +RUN mkdir -p ${DOCKER_WORKDIR} +WORKDIR ${DOCKER_WORKDIR} + +################################################################################## +# PRODUCTION ### TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO #### +################################################################################## + +CMD ["yarn", "run", "start"] + COPY package.json yarn.lock ./ RUN yarn install --production=false --frozen-lockfile --non-interactive @@ -37,6 +74,6 @@ RUN yarn run generate FROM nginx:alpine -COPY --from=build ./develop-webapp/dist/ /usr/share/nginx/html/ +COPY --from=build ./app/dedist/ /usr/share/nginx/html/ RUN rm /etc/nginx/conf.d/default.conf COPY maintenance/nginx/custom.conf /etc/nginx/conf.d/ From 1bf3f295c7a2fbb59d5fffe2e41b231dba5ecbbc Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 13:38:51 +0200 Subject: [PATCH 011/181] added production target removed todo --- .github/workflows/publish.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 426517e8e..3612fd3e0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -166,8 +166,7 @@ jobs: # BUILD MAINTENANCE DOCKER IMAGE (build) ################################# ########################################################################## - name: Maintenance | Build `production` image - # TODO: --target production - run: docker build -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance + run: docker build --target production -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance - name: Maintenance | Save docker image run: docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar - name: Upload Artifact From 99364856bcfa644019806b7d1f26bbbf82f9139e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 13:40:12 +0200 Subject: [PATCH 012/181] remove more todos --- .github/workflows/test.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9b8025ea3..9c67126e2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -253,7 +253,6 @@ jobs: ########################################################################## # COVERAGE REPORT FRONTEND ################################################ ########################################################################## - # TODO: Maybe remove this later on to avoid spam? #- name: frontend | Coverage report # uses: romeovs/lcov-reporter-action@v0.2.21 # with: From 6f1f5f360d54461bab42bced9aa792eafb9e10ab Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 13:45:32 +0200 Subject: [PATCH 013/181] actually define production stage in maintenance file --- webapp/Dockerfile.maintenance | 1 + 1 file changed, 1 insertion(+) diff --git a/webapp/Dockerfile.maintenance b/webapp/Dockerfile.maintenance index 19d316ced..4b8585754 100644 --- a/webapp/Dockerfile.maintenance +++ b/webapp/Dockerfile.maintenance @@ -48,6 +48,7 @@ WORKDIR ${DOCKER_WORKDIR} ################################################################################## # PRODUCTION ### TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO #### ################################################################################## +FROM base as production CMD ["yarn", "run", "start"] From b51fe45b076b22181954c529517d408e37332569 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 14:08:46 +0200 Subject: [PATCH 014/181] more fixes for the mainteace docker file --- webapp/Dockerfile.maintenance | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/webapp/Dockerfile.maintenance b/webapp/Dockerfile.maintenance index 4b8585754..ece01cdb4 100644 --- a/webapp/Dockerfile.maintenance +++ b/webapp/Dockerfile.maintenance @@ -45,13 +45,13 @@ EXPOSE ${PORT} RUN mkdir -p ${DOCKER_WORKDIR} WORKDIR ${DOCKER_WORKDIR} -################################################################################## -# PRODUCTION ### TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO #### -################################################################################## -FROM base as production - CMD ["yarn", "run", "start"] +################################################################################## +# BUILD ### TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO ## +################################################################################## +FROM base as build + COPY package.json yarn.lock ./ RUN yarn install --production=false --frozen-lockfile --non-interactive @@ -73,8 +73,11 @@ COPY maintenance/source ./ RUN yarn run generate +################################################################################## +# PRODUCTION ### TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO #### +################################################################################## +FROM nginx:alpine as production -FROM nginx:alpine COPY --from=build ./app/dedist/ /usr/share/nginx/html/ RUN rm /etc/nginx/conf.d/default.conf COPY maintenance/nginx/custom.conf /etc/nginx/conf.d/ From 94a6bdb137d22421cbf31b438b7ce49c8b534404 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 14:13:20 +0200 Subject: [PATCH 015/181] more maintenance fixes --- webapp/Dockerfile.maintenance | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/Dockerfile.maintenance b/webapp/Dockerfile.maintenance index ece01cdb4..66c8516dd 100644 --- a/webapp/Dockerfile.maintenance +++ b/webapp/Dockerfile.maintenance @@ -1,7 +1,7 @@ ################################################################################## # BASE ########################################################################### ################################################################################## -FROM node:12.19.0-alpine3.10 as build +FROM node:12.19.0-alpine3.10 as base # ENVs ## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame From 87a5daa7a33c4e7fe6893e51d1f9e5815611aff3 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 14:23:45 +0200 Subject: [PATCH 016/181] old workig directory in the hope it fixes stuff --- webapp/Dockerfile.maintenance | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/Dockerfile.maintenance b/webapp/Dockerfile.maintenance index 66c8516dd..ee1cb8293 100644 --- a/webapp/Dockerfile.maintenance +++ b/webapp/Dockerfile.maintenance @@ -5,7 +5,7 @@ FROM node:12.19.0-alpine3.10 as base # ENVs ## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame -ENV DOCKER_WORKDIR="/app" +ENV DOCKER_WORKDIR="/develop-webapp" ## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 ARG BBUILD_DATE="1970-01-01T00:00:00.00Z" ENV BUILD_DATE=$BBUILD_DATE @@ -78,6 +78,6 @@ RUN yarn run generate ################################################################################## FROM nginx:alpine as production -COPY --from=build ./app/dedist/ /usr/share/nginx/html/ +COPY --from=build ./develop-webapp/dedist/ /usr/share/nginx/html/ RUN rm /etc/nginx/conf.d/default.conf COPY maintenance/nginx/custom.conf /etc/nginx/conf.d/ From a2e93bb17b4617b0d18a5c4d9820b052f23f1eed Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 14:45:07 +0200 Subject: [PATCH 017/181] fix maintenance --- webapp/Dockerfile.maintenance | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/Dockerfile.maintenance b/webapp/Dockerfile.maintenance index ee1cb8293..51b30e405 100644 --- a/webapp/Dockerfile.maintenance +++ b/webapp/Dockerfile.maintenance @@ -5,7 +5,7 @@ FROM node:12.19.0-alpine3.10 as base # ENVs ## DOCKER_WORKDIR would be a classical ARG, but that is not multi layer persistent - shame -ENV DOCKER_WORKDIR="/develop-webapp" +ENV DOCKER_WORKDIR="/app" ## We Cannot do `$(date -u +'%Y-%m-%dT%H:%M:%SZ')` here so we use unix timestamp=0 ARG BBUILD_DATE="1970-01-01T00:00:00.00Z" ENV BUILD_DATE=$BBUILD_DATE @@ -78,6 +78,6 @@ RUN yarn run generate ################################################################################## FROM nginx:alpine as production -COPY --from=build ./develop-webapp/dedist/ /usr/share/nginx/html/ +COPY --from=base ./app/dedist/ /usr/share/nginx/html/ RUN rm /etc/nginx/conf.d/default.conf COPY maintenance/nginx/custom.conf /etc/nginx/conf.d/ From 0f18fb2b47ab79809509853d527bac074675d4f0 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 14:54:16 +0200 Subject: [PATCH 018/181] more fixes --- webapp/Dockerfile.maintenance | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/Dockerfile.maintenance b/webapp/Dockerfile.maintenance index 51b30e405..0a7616240 100644 --- a/webapp/Dockerfile.maintenance +++ b/webapp/Dockerfile.maintenance @@ -78,6 +78,6 @@ RUN yarn run generate ################################################################################## FROM nginx:alpine as production -COPY --from=base ./app/dedist/ /usr/share/nginx/html/ +COPY --from=build ./app/dist/ /usr/share/nginx/html/ RUN rm /etc/nginx/conf.d/default.conf COPY maintenance/nginx/custom.conf /etc/nginx/conf.d/ From 3a645dd0780880757c7168cab45f3e4fe5f45051 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 17 Apr 2021 15:21:50 +0200 Subject: [PATCH 019/181] publish only on master --- .github/workflows/publish.yml | 262 +++++++++++++++++----------------- 1 file changed, 131 insertions(+), 131 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 3612fd3e0..de956e17b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,8 +2,8 @@ name: ocelot.social publish CI on: push: -# branches: -# - master + branches: + - master jobs: ############################################################################## @@ -175,132 +175,132 @@ jobs: name: docker-maintenance-production path: /tmp/maintenance.tar -# ############################################################################## -# # JOB: UPLOAD TO DOCKERHUB ################################################### -# ############################################################################## -# upload_to_dockerhub: -# name: Upload to Dockerhub -# runs-on: ubuntu-latest -# needs: [build_production_neo4j,build_production_backend,build_production_webapp,build_production_maintenance] -# env: -# DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} -# DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} -# steps: -# ########################################################################## -# # CHECKOUT CODE ########################################################## -# ########################################################################## -# - name: Checkout code -# uses: actions/checkout@v2 -# ########################################################################## -# # DOWNLOAD DOCKER IMAGES ################################################# -# ########################################################################## -# - name: Download Docker Image (Neo4J) -# uses: actions/download-artifact@v2 -# with: -# name: docker-neo4j-community -# path: /tmp -# - name: Load Docker Image -# run: docker load < /tmp/neo4j.tar -# - name: Download Docker Image (Backend) -# uses: actions/download-artifact@v2 -# with: -# name: docker-backend-production -# path: /tmp -# - name: Load Docker Image -# run: docker load < /tmp/backend.tar -# - name: Download Docker Image (WebApp) -# uses: actions/download-artifact@v2 -# with: -# name: docker-webapp-production -# path: /tmp -# - name: Load Docker Image -# run: docker load < /tmp/webapp.tar -# - name: Download Docker Image (Maintenance) -# uses: actions/download-artifact@v2 -# with: -# name: docker-maintenance-production -# path: /tmp -# - name: Load Docker Image -# run: docker load < /tmp/maintenance.tar -# ########################################################################## -# # Upload ################################################################# -# ########################################################################## -# - name: login to dockerhub -# run: echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin -# - name: Push neo4j -# run: docker push --all-tags ocelotsocialnetwork/neo4j -# - name: Push backend -# run: docker push --all-tags ocelotsocialnetwork/backend -# - name: Push webapp -# run: docker push --all-tags ocelotsocialnetwork/webapp -# - name: Push maintenance -# run: docker push --all-tags ocelotsocialnetwork/maintenance -# -# ############################################################################## -# # JOB: GITHUB TAG LATEST VERSION ############################################# -# ############################################################################## -# github_tag: -# name: Tag latest version on Github -# runs-on: ubuntu-latest -# needs: [upload_to_dockerhub] -# steps: -# ########################################################################## -# # CHECKOUT CODE ########################################################## -# ########################################################################## -# - name: Checkout code -# uses: actions/checkout@v2 -# with: -# fetch-depth: 0 # Fetch full History for changelog -# ########################################################################## -# # SET ENVS ############################################################### -# ########################################################################## -# - name: ENV - VERSION -# run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV -# - name: ENV - BUILD_DATE -# run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV -# - name: ENV - BUILD_VERSION -# run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV -# - name: ENV - BUILD_COMMIT -# run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV -# ########################################################################## -# # Push version tag to GitHub ############################################# -# ########################################################################## -# # TODO: this will error on duplicate -# #- name: package-version-to-git-tag -# # uses: pkgdeps/git-tag-action@v2 -# # with: -# # github_token: ${{ secrets.GITHUB_TOKEN }} -# # github_repo: ${{ github.repository }} -# # version: ${{ env.VERSION }} -# # git_commit_sha: ${{ github.sha }} -# # git_tag_prefix: "v" -# ########################################################################## -# # Push build tag to GitHub ############################################### -# ########################################################################## -# - name: package-version-to-git-tag + build number -# uses: pkgdeps/git-tag-action@v2 -# with: -# github_token: ${{ secrets.GITHUB_TOKEN }} -# github_repo: ${{ github.repository }} -# version: ${{ env.BUILD_VERSION }} -# git_commit_sha: ${{ github.sha }} -# git_tag_prefix: "b" -# ########################################################################## -# # Push release tag to GitHub ############################################# -# ########################################################################## -# - name: yarn install -# run: yarn install -# - name: generate changelog -# run: yarn auto-changelog --latest-version ${{ env.VERSION }} --unreleased-only -# - name: package-version-to-git-release -# continue-on-error: true # Will fail if tag exists -# id: create_release -# uses: actions/create-release@v1 -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token -# with: -# tag_name: ${{ env.VERSION }} -# release_name: ${{ env.VERSION }} -# body_path: ./CHANGELOG.md -# draft: false -# prerelease: false \ No newline at end of file + ############################################################################## + # JOB: UPLOAD TO DOCKERHUB ################################################### + ############################################################################## + upload_to_dockerhub: + name: Upload to Dockerhub + runs-on: ubuntu-latest + needs: [build_production_neo4j,build_production_backend,build_production_webapp,build_production_maintenance] + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v2 + ########################################################################## + # DOWNLOAD DOCKER IMAGES ################################################# + ########################################################################## + - name: Download Docker Image (Neo4J) + uses: actions/download-artifact@v2 + with: + name: docker-neo4j-community + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/neo4j.tar + - name: Download Docker Image (Backend) + uses: actions/download-artifact@v2 + with: + name: docker-backend-production + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/backend.tar + - name: Download Docker Image (WebApp) + uses: actions/download-artifact@v2 + with: + name: docker-webapp-production + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/webapp.tar + - name: Download Docker Image (Maintenance) + uses: actions/download-artifact@v2 + with: + name: docker-maintenance-production + path: /tmp + - name: Load Docker Image + run: docker load < /tmp/maintenance.tar + ########################################################################## + # Upload ################################################################# + ########################################################################## + - name: login to dockerhub + run: echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin + - name: Push neo4j + run: docker push --all-tags ocelotsocialnetwork/neo4j + - name: Push backend + run: docker push --all-tags ocelotsocialnetwork/backend + - name: Push webapp + run: docker push --all-tags ocelotsocialnetwork/webapp + - name: Push maintenance + run: docker push --all-tags ocelotsocialnetwork/maintenance + + ############################################################################## + # JOB: GITHUB TAG LATEST VERSION ############################################# + ############################################################################## + github_tag: + name: Tag latest version on Github + runs-on: ubuntu-latest + needs: [upload_to_dockerhub] + steps: + ########################################################################## + # CHECKOUT CODE ########################################################## + ########################################################################## + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 # Fetch full History for changelog + ########################################################################## + # SET ENVS ############################################################### + ########################################################################## + - name: ENV - VERSION + run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + - name: ENV - BUILD_DATE + run: echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV + - name: ENV - BUILD_VERSION + run: echo "BUILD_VERSION=${VERSION}-${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV + - name: ENV - BUILD_COMMIT + run: echo "BUILD_COMMIT=${GITHUB_SHA}" >> $GITHUB_ENV + ########################################################################## + # Push version tag to GitHub ############################################# + ########################################################################## + # TODO: this will error on duplicate + #- name: package-version-to-git-tag + # uses: pkgdeps/git-tag-action@v2 + # with: + # github_token: ${{ secrets.GITHUB_TOKEN }} + # github_repo: ${{ github.repository }} + # version: ${{ env.VERSION }} + # git_commit_sha: ${{ github.sha }} + # git_tag_prefix: "v" + ########################################################################## + # Push build tag to GitHub ############################################### + ########################################################################## + - name: package-version-to-git-tag + build number + uses: pkgdeps/git-tag-action@v2 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + github_repo: ${{ github.repository }} + version: ${{ env.BUILD_VERSION }} + git_commit_sha: ${{ github.sha }} + git_tag_prefix: "b" + ########################################################################## + # Push release tag to GitHub ############################################# + ########################################################################## + - name: yarn install + run: yarn install + - name: generate changelog + run: yarn auto-changelog --latest-version ${{ env.VERSION }} --unreleased-only + - name: package-version-to-git-release + continue-on-error: true # Will fail if tag exists + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ env.VERSION }} + release_name: ${{ env.VERSION }} + body_path: ./CHANGELOG.md + draft: false + prerelease: false \ No newline at end of file From 7365aa09c1fccdf923478c52d7aafd20baadf4df Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 02:08:19 +0200 Subject: [PATCH 020/181] coverage Change.spec.js --- webapp/components/Password/Change.spec.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/webapp/components/Password/Change.spec.js b/webapp/components/Password/Change.spec.js index 8416a0fce..1cc561e3c 100644 --- a/webapp/components/Password/Change.spec.js +++ b/webapp/components/Password/Change.spec.js @@ -126,21 +126,18 @@ describe('ChangePassword.vue', () => { }) }) - // TODO This is not a valid testcase - we have to decide if we catch the same password on clientside - /* describe('mutation rejects', () => { + describe('mutation rejects', () => { beforeEach(async () => { await wrapper.find('input#oldPassword').setValue('supersecret') await wrapper.find('input#password').setValue('supersecret') await wrapper.find('input#passwordConfirmation').setValue('supersecret') + await wrapper.find('form').trigger('submit') }) - it('displays error message', async () => { - await wrapper.find('form').trigger('submit') - await mocks.$apollo.mutate - + it('displays error message', async () => { expect(mocks.$toast.error).toHaveBeenCalledWith('Ouch!') }) - }) */ + }) }) }) }) From 9445627480961e4baaaabb44ee161a52c6b983d7 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 02:08:32 +0200 Subject: [PATCH 021/181] coverage ChangePassword.spec.js --- .../PasswordReset/ChangePassword.spec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/webapp/components/PasswordReset/ChangePassword.spec.js b/webapp/components/PasswordReset/ChangePassword.spec.js index b1b55cb06..d6f451604 100644 --- a/webapp/components/PasswordReset/ChangePassword.spec.js +++ b/webapp/components/PasswordReset/ChangePassword.spec.js @@ -76,6 +76,22 @@ describe('ChangePassword ', () => { }) }) }) + + describe('password reset not successful', () => { + beforeEach(() => { + mocks.$apollo.mutate = jest.fn().mockRejectedValue({ + message: 'Ouch!', + }) + wrapper = Wrapper() + wrapper.find('input#password').setValue('supersecret') + wrapper.find('input#passwordConfirmation').setValue('supersecret') + wrapper.find('form').trigger('submit') + }) + + it('display a toast error', () => { + expect(mocks.$toast.error).toHaveBeenCalled() + }) + }) }) }) }) From fc176e28a4398bd322d50a6bdfbf617f9f5db179 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 02:08:50 +0200 Subject: [PATCH 022/181] coverage my-email-address/index.spec.js --- .../pages/settings/my-email-address/index.spec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/webapp/pages/settings/my-email-address/index.spec.js b/webapp/pages/settings/my-email-address/index.spec.js index 22654afd0..808aee3be 100644 --- a/webapp/pages/settings/my-email-address/index.spec.js +++ b/webapp/pages/settings/my-email-address/index.spec.js @@ -111,6 +111,21 @@ describe('EmailSettingsIndexPage', () => { expect(wrapper.text()).toContain('registration.signup.form.errors.email-exists') }) }) + + describe('if backend sends any other error', () => { + beforeEach(() => { + mocks.$apollo.mutate = jest.fn().mockRejectedValue({ + message: 'Ouch!', + }) + wrapper = Wrapper() + wrapper.find('#email').setValue('already-taken@example.org') + wrapper.find('form').trigger('submit') + }) + + it('display a toast error', () => { + expect(mocks.$toast.error).toHaveBeenCalled() + }) + }) }) }) }) From 0e6893eeb3305f0ef916e123406bcab6fb4665b0 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 02:09:10 +0200 Subject: [PATCH 023/181] coverage PasswordReset/Request.spec.js --- webapp/components/PasswordReset/Request.spec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/webapp/components/PasswordReset/Request.spec.js b/webapp/components/PasswordReset/Request.spec.js index 83459814e..e601030c6 100644 --- a/webapp/components/PasswordReset/Request.spec.js +++ b/webapp/components/PasswordReset/Request.spec.js @@ -95,5 +95,20 @@ describe('Request', () => { expect(mocks.$apollo.mutate).toHaveBeenCalledWith(expected) }) }) + + describe('backend throws an error', () => { + beforeEach(() => { + mocks.$apollo.mutate = jest.fn().mockRejectedValue({ + message: 'Ouch!', + }) + wrapper = Wrapper() + wrapper.find('input#email').setValue('mail@gmail.com') + wrapper.find('form').trigger('submit') + }) + + it('display a toast error', () => { + expect(mocks.$toast.error).toHaveBeenCalled() + }) + }) }) }) From c7e721b44ff2ab982d6b2a1aaeb963dbfab2b2f3 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 02:10:23 +0200 Subject: [PATCH 024/181] ignore stuff not to be tested --- webapp/package.json | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/webapp/package.json b/webapp/package.json index 84cdcbc7c..d1a2fe82f 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -24,9 +24,17 @@ "verbose": true, "collectCoverageFrom": [ "**/*.{js,vue}", + "!**/?(*.)+(spec|test|story).js?(x)", "!**/node_modules/**", "!**/.nuxt/**", - "!**/?(*.)+(spec|test).js?(x)" + "!**/storybook/**", + "!**/coverage/**", + "!**/config/**", + "!**/maintenance/**", + "!**/plugins/**" + "!**/.eslintrc.js", + "!**/.prettierrc.js", + "!**/nuxt.config.js", ], "coverageReporters": [ "lcov" From e99313034d921d6c6187a7e58538376f651211c2 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 02:17:35 +0200 Subject: [PATCH 025/181] package.json syntax typo --- webapp/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/package.json b/webapp/package.json index d1a2fe82f..b34c6d818 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -31,10 +31,10 @@ "!**/coverage/**", "!**/config/**", "!**/maintenance/**", - "!**/plugins/**" + "!**/plugins/**", "!**/.eslintrc.js", "!**/.prettierrc.js", - "!**/nuxt.config.js", + "!**/nuxt.config.js" ], "coverageReporters": [ "lcov" From 1b8c22bd7dcfe43419825c94eec76984b1d0a9fa Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 02:26:42 +0200 Subject: [PATCH 026/181] lint fix --- webapp/components/Password/Change.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/components/Password/Change.spec.js b/webapp/components/Password/Change.spec.js index 1cc561e3c..95b7c1a3a 100644 --- a/webapp/components/Password/Change.spec.js +++ b/webapp/components/Password/Change.spec.js @@ -134,7 +134,7 @@ describe('ChangePassword.vue', () => { await wrapper.find('form').trigger('submit') }) - it('displays error message', async () => { + it('displays error message', async () => { expect(mocks.$toast.error).toHaveBeenCalledWith('Ouch!') }) }) From 26387a172fffa39fcdb742d0d6037e6d8485a921 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 02:28:25 +0200 Subject: [PATCH 027/181] require 60% coverage --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9b8025ea3..240c54ddf 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -268,7 +268,7 @@ jobs: report_name: Coverage Webapp type: lcov result_path: ./coverage/lcov.info - min_coverage: 52 + min_coverage: 60 token: ${{ github.token }} ############################################################################## From 7e165a9b2b4fb3c3cd25157a92feb31c9196cc6a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 12:38:46 +0200 Subject: [PATCH 028/181] NotificationList.vue make default not a function --- webapp/components/NotificationList/NotificationList.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/components/NotificationList/NotificationList.vue b/webapp/components/NotificationList/NotificationList.vue index fd2d6366c..877133f39 100644 --- a/webapp/components/NotificationList/NotificationList.vue +++ b/webapp/components/NotificationList/NotificationList.vue @@ -20,7 +20,7 @@ export default { props: { notifications: { type: Array, - default: () => [], + default: [], }, }, methods: { From 38a6fbbed28d75804036a92e24bcd0770c50bfa3 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 12:54:09 +0200 Subject: [PATCH 029/181] coverage PageFooter.spec.js --- .../components/PageFooter/PageFooter.spec.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 webapp/components/PageFooter/PageFooter.spec.js diff --git a/webapp/components/PageFooter/PageFooter.spec.js b/webapp/components/PageFooter/PageFooter.spec.js new file mode 100644 index 000000000..9cb2a77cf --- /dev/null +++ b/webapp/components/PageFooter/PageFooter.spec.js @@ -0,0 +1,40 @@ +import { config, mount } from '@vue/test-utils' +import PageFooter from './PageFooter.vue' +import links from '~/constants/links.js' + +const localVue = global.localVue + +config.stubs['nuxt-link'] = '' + +describe('PageFooter.vue', () => { + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + $env: { + VERSION: 'v1.0.0' + }, + links + } + }) + + describe('mount', () => { + let wrapper + const Wrapper = () => { + return mount(PageFooter, { mocks, localVue }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders three links', () => { + expect(wrapper.findAll('a')).toHaveLength(3) + }) + + it('renders four nuxt-links', () => { + expect(wrapper.findAll('.nuxt-link')).toHaveLength(4) + }) + }) +}) From 862d8ecb82f3eaf406833128245e8d9400bc9ff9 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 13:11:47 +0200 Subject: [PATCH 030/181] ReportsTable.vue make default not a function --- webapp/components/features/ReportsTable/ReportsTable.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/components/features/ReportsTable/ReportsTable.vue b/webapp/components/features/ReportsTable/ReportsTable.vue index 3892c0b12..787a912f7 100644 --- a/webapp/components/features/ReportsTable/ReportsTable.vue +++ b/webapp/components/features/ReportsTable/ReportsTable.vue @@ -41,7 +41,7 @@ export default { ReportRow, }, props: { - reports: { type: Array, default: () => [] }, + reports: { type: Array, default: [] }, }, } From f93367bc9ff5e272803f16e6464b662eb36f6b63 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 13:12:10 +0200 Subject: [PATCH 031/181] coverage Signup.spec.js --- webapp/components/Registration/Signup.spec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/webapp/components/Registration/Signup.spec.js b/webapp/components/Registration/Signup.spec.js index 36b16903c..659dd8a58 100644 --- a/webapp/components/Registration/Signup.spec.js +++ b/webapp/components/Registration/Signup.spec.js @@ -76,6 +76,21 @@ describe('Signup', () => { expect(mocks.$t).toHaveBeenCalledWith(...expected) }) + describe('mutation is rejected', () => { + beforeEach(async () => { + mocks.$apollo.mutate = jest.fn().mockRejectedValue({ + message: 'Ouch!', + }) + wrapper = Wrapper() + wrapper.find('input#email').setValue('mail@example.org') + await wrapper.find('form').trigger('submit') + }) + + it('displays error message', async () => { + expect(mocks.$toast.error).toHaveBeenCalledWith('Ouch!') + }) + }) + describe('after animation', () => { beforeEach(jest.runAllTimers) @@ -83,6 +98,7 @@ describe('Signup', () => { expect(wrapper.emitted('submit')).toEqual([[{ email: 'mail@example.org' }]]) }) }) + }) }) }) From ca654914f71b256d69ba20b2e46df8da1f771ea7 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 13:19:54 +0200 Subject: [PATCH 032/181] default must be a function --- webapp/components/features/ReportsTable/ReportsTable.spec.js | 2 +- webapp/components/features/ReportsTable/ReportsTable.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/components/features/ReportsTable/ReportsTable.spec.js b/webapp/components/features/ReportsTable/ReportsTable.spec.js index a9baeea4f..c80e4fea5 100644 --- a/webapp/components/features/ReportsTable/ReportsTable.spec.js +++ b/webapp/components/features/ReportsTable/ReportsTable.spec.js @@ -34,7 +34,7 @@ describe('ReportsTable', () => { describe('given no reports', () => { beforeEach(() => { - propsData = { ...propsData, reports: [] } + propsData = { ...propsData } wrapper = Wrapper() }) diff --git a/webapp/components/features/ReportsTable/ReportsTable.vue b/webapp/components/features/ReportsTable/ReportsTable.vue index 787a912f7..3892c0b12 100644 --- a/webapp/components/features/ReportsTable/ReportsTable.vue +++ b/webapp/components/features/ReportsTable/ReportsTable.vue @@ -41,7 +41,7 @@ export default { ReportRow, }, props: { - reports: { type: Array, default: [] }, + reports: { type: Array, default: () => [] }, }, } From 84caad1bff289c564f72470dcc6b738be2b33484 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 13:20:18 +0200 Subject: [PATCH 033/181] lint fix --- webapp/components/Registration/Signup.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/webapp/components/Registration/Signup.spec.js b/webapp/components/Registration/Signup.spec.js index 659dd8a58..dda0cbb9d 100644 --- a/webapp/components/Registration/Signup.spec.js +++ b/webapp/components/Registration/Signup.spec.js @@ -98,7 +98,6 @@ describe('Signup', () => { expect(wrapper.emitted('submit')).toEqual([[{ email: 'mail@example.org' }]]) }) }) - }) }) }) From 72addd13364d7ec859d8650d21b37ad796be0379 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 13:20:40 +0200 Subject: [PATCH 034/181] lint error --- webapp/components/PageFooter/PageFooter.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/components/PageFooter/PageFooter.spec.js b/webapp/components/PageFooter/PageFooter.spec.js index 9cb2a77cf..6a051b020 100644 --- a/webapp/components/PageFooter/PageFooter.spec.js +++ b/webapp/components/PageFooter/PageFooter.spec.js @@ -13,9 +13,9 @@ describe('PageFooter.vue', () => { mocks = { $t: jest.fn(), $env: { - VERSION: 'v1.0.0' + VERSION: 'v1.0.0', }, - links + links, } }) From 6e5e15097e794a3eea9093bb86b13f69fdc8cc4a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 13:25:03 +0200 Subject: [PATCH 035/181] NotificationList.vue with default as afunction tested --- .../NotificationList/NotificationList.spec.js | 19 +++++++++++++++++++ .../NotificationList/NotificationList.vue | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/webapp/components/NotificationList/NotificationList.spec.js b/webapp/components/NotificationList/NotificationList.spec.js index ce20a2765..219c1fdbb 100644 --- a/webapp/components/NotificationList/NotificationList.spec.js +++ b/webapp/components/NotificationList/NotificationList.spec.js @@ -81,4 +81,23 @@ describe('NotificationList.vue', () => { }) }) }) + + describe('shallowMount with no notifications', () => { + const Wrapper = () => { + return shallowMount(NotificationList, { + propsData: {}, + mocks, + store, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders Notification.vue zero times', () => { + expect(wrapper.findAll(Notification)).toHaveLength(0) + }) + }) }) diff --git a/webapp/components/NotificationList/NotificationList.vue b/webapp/components/NotificationList/NotificationList.vue index 877133f39..fd2d6366c 100644 --- a/webapp/components/NotificationList/NotificationList.vue +++ b/webapp/components/NotificationList/NotificationList.vue @@ -20,7 +20,7 @@ export default { props: { notifications: { type: Array, - default: [], + default: () => [], }, }, methods: { From 52306aeed4e9085c75ee48356af13e90e095d95b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 13:51:32 +0200 Subject: [PATCH 036/181] SearchableInput.spec.js whitespace replacement --- .../generic/SearchableInput/SearchableInput.spec.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/webapp/components/generic/SearchableInput/SearchableInput.spec.js b/webapp/components/generic/SearchableInput/SearchableInput.spec.js index 53c361997..e5ce06fb5 100644 --- a/webapp/components/generic/SearchableInput/SearchableInput.spec.js +++ b/webapp/components/generic/SearchableInput/SearchableInput.spec.js @@ -120,5 +120,17 @@ describe('SearchableInput.vue', () => { query: { search: 'ab' }, }) }) + + it('replaces irregular whitespace with a single space', async () => { + select.element.value = 'peter \ + lustig' + select.trigger('input') + select.trigger('keyup.enter') + expect(mocks.$router.push).toHaveBeenCalledWith({ + path: '/search/search-results', + query: { search: 'peter lustig' }, + }) + }) + }) }) From 0e393c16d434e130a97ba1dca818441ea1f41710 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 15:05:00 +0200 Subject: [PATCH 037/181] fixed lint error --- .../components/generic/SearchableInput/SearchableInput.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/webapp/components/generic/SearchableInput/SearchableInput.spec.js b/webapp/components/generic/SearchableInput/SearchableInput.spec.js index e5ce06fb5..ba8341efe 100644 --- a/webapp/components/generic/SearchableInput/SearchableInput.spec.js +++ b/webapp/components/generic/SearchableInput/SearchableInput.spec.js @@ -131,6 +131,5 @@ describe('SearchableInput.vue', () => { query: { search: 'peter lustig' }, }) }) - }) }) From b2bc5b9447100e07bd2d7a55a9c6c8fb0d34be9f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sat, 24 Apr 2021 15:51:53 +0200 Subject: [PATCH 038/181] cannot use newline (lint) --- .../components/generic/SearchableInput/SearchableInput.spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/webapp/components/generic/SearchableInput/SearchableInput.spec.js b/webapp/components/generic/SearchableInput/SearchableInput.spec.js index ba8341efe..e0e9f9831 100644 --- a/webapp/components/generic/SearchableInput/SearchableInput.spec.js +++ b/webapp/components/generic/SearchableInput/SearchableInput.spec.js @@ -122,8 +122,7 @@ describe('SearchableInput.vue', () => { }) it('replaces irregular whitespace with a single space', async () => { - select.element.value = 'peter \ - lustig' + select.element.value = 'peter lustig' select.trigger('input') select.trigger('keyup.enter') expect(mocks.$router.push).toHaveBeenCalledWith({ From eb4ec2499eb84147bd4b7b8f5d8ace4461f63286 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 11:19:45 +0200 Subject: [PATCH 039/181] Modal coverage --- webapp/components/Modal.spec.js | 36 +++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/webapp/components/Modal.spec.js b/webapp/components/Modal.spec.js index 3ebff8771..c08c90f51 100644 --- a/webapp/components/Modal.spec.js +++ b/webapp/components/Modal.spec.js @@ -131,6 +131,42 @@ describe('Modal.vue', () => { }) }) }) + + describe('store/modal data contains an user', () => { + it('passes user name to report modal', () => { + state.data = { + type: 'user', + resource: { + id: 'u456', + name: 'Username', + }, + } + wrapper = Wrapper() + expect(wrapper.find(DisableModal).props()).toEqual({ + type: 'user', + name: 'Username', + id: 'u456', + }) + }) + }) + + describe('store/modal data contains no valid datatype', () => { + it('passes something as datatype to modal', () => { + state.data = { + type: 'something', + resource: { + id: 's456', + name: 'Username', + }, + } + wrapper = Wrapper() + expect(wrapper.find(DisableModal).props()).toEqual({ + type: 'something', + name: null, + id: 's456', + }) + }) + }) }) }) }) From a7eaf13ae1adb00b9b2bccdc589ed7c16c6db45c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 12:17:46 +0200 Subject: [PATCH 040/181] coverage ShoutButton.spec.js --- webapp/components/ShoutButton.spec.js | 73 +++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 webapp/components/ShoutButton.spec.js diff --git a/webapp/components/ShoutButton.spec.js b/webapp/components/ShoutButton.spec.js new file mode 100644 index 000000000..2b8f5040b --- /dev/null +++ b/webapp/components/ShoutButton.spec.js @@ -0,0 +1,73 @@ +import { shallowMount } from '@vue/test-utils' +import { mount } from '@vue/test-utils' +import ShoutButton from './ShoutButton.vue' +import Vuex from 'vuex' +import Vue from 'vue' + +const localVue = global.localVue + +describe('ShoutButton.vue', () => { + let wrapper + let state + let mocks + + beforeEach(() => { + mocks = { + $filters: { + truncate: (a) => a, + }, + $toast: { + success: () => {}, + error: () => {}, + }, + $t: jest.fn(), + $apollo: { + mutate: jest.fn() + }, + } + state = { + open: null, + data: {}, + } + }) + + describe('mount', () => { + let wrapper + const Wrapper = () => { + return mount(ShoutButton, { mocks, localVue }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders button and text', () => { + expect(mocks.$t).toHaveBeenCalledWith('shoutButton.shouted') + expect(wrapper.findAll(".base-button")).toHaveLength(1) + expect(wrapper.findAll(".shout-button-text")).toHaveLength(1) + expect(wrapper.vm.shouted).toBe(false) + expect(wrapper.vm.shoutedCount).toBe(0) + }) + + it('toggle the button', async () => { + mocks.$apollo.mutate = jest.fn().mockResolvedValue({ data: { shout: 'WeDoShout' } }); + wrapper.find(".base-button").trigger('click') + expect(wrapper.vm.shouted).toBe(true) + expect(wrapper.vm.shoutedCount).toBe(1) + await Vue.nextTick() + expect(wrapper.vm.shouted).toBe(true) + expect(wrapper.vm.shoutedCount).toBe(1) + }) + + it('toggle the button, but backend fails', async () => { + mocks.$apollo.mutate = jest.fn().mockRejectedValue({ message: 'Ouch!' }); + await wrapper.find(".base-button").trigger('click') + expect(wrapper.vm.shouted).toBe(true) + expect(wrapper.vm.shoutedCount).toBe(1) + await Vue.nextTick() + expect(wrapper.vm.shouted).toBe(false) + expect(wrapper.vm.shoutedCount).toBe(0) + }) + + }) +}) From 61d0f18f24c417bd6dd431a4d2be74826c9f46fa Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 12:22:56 +0200 Subject: [PATCH 041/181] lint fixes --- webapp/components/ShoutButton.spec.js | 30 +++++++-------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/webapp/components/ShoutButton.spec.js b/webapp/components/ShoutButton.spec.js index 2b8f5040b..c3af134c1 100644 --- a/webapp/components/ShoutButton.spec.js +++ b/webapp/components/ShoutButton.spec.js @@ -1,34 +1,19 @@ -import { shallowMount } from '@vue/test-utils' import { mount } from '@vue/test-utils' import ShoutButton from './ShoutButton.vue' -import Vuex from 'vuex' import Vue from 'vue' const localVue = global.localVue describe('ShoutButton.vue', () => { - let wrapper - let state let mocks beforeEach(() => { mocks = { - $filters: { - truncate: (a) => a, - }, - $toast: { - success: () => {}, - error: () => {}, - }, $t: jest.fn(), $apollo: { - mutate: jest.fn() + mutate: jest.fn(), }, } - state = { - open: null, - data: {}, - } }) describe('mount', () => { @@ -43,15 +28,15 @@ describe('ShoutButton.vue', () => { it('renders button and text', () => { expect(mocks.$t).toHaveBeenCalledWith('shoutButton.shouted') - expect(wrapper.findAll(".base-button")).toHaveLength(1) - expect(wrapper.findAll(".shout-button-text")).toHaveLength(1) + expect(wrapper.findAll('.base-button')).toHaveLength(1) + expect(wrapper.findAll('.shout-button-text')).toHaveLength(1) expect(wrapper.vm.shouted).toBe(false) expect(wrapper.vm.shoutedCount).toBe(0) }) it('toggle the button', async () => { - mocks.$apollo.mutate = jest.fn().mockResolvedValue({ data: { shout: 'WeDoShout' } }); - wrapper.find(".base-button").trigger('click') + mocks.$apollo.mutate = jest.fn().mockResolvedValue({ data: { shout: 'WeDoShout' } }) + wrapper.find('.base-button').trigger('click') expect(wrapper.vm.shouted).toBe(true) expect(wrapper.vm.shoutedCount).toBe(1) await Vue.nextTick() @@ -60,14 +45,13 @@ describe('ShoutButton.vue', () => { }) it('toggle the button, but backend fails', async () => { - mocks.$apollo.mutate = jest.fn().mockRejectedValue({ message: 'Ouch!' }); - await wrapper.find(".base-button").trigger('click') + mocks.$apollo.mutate = jest.fn().mockRejectedValue({ message: 'Ouch!' }) + await wrapper.find('.base-button').trigger('click') expect(wrapper.vm.shouted).toBe(true) expect(wrapper.vm.shoutedCount).toBe(1) await Vue.nextTick() expect(wrapper.vm.shouted).toBe(false) expect(wrapper.vm.shoutedCount).toBe(0) }) - }) }) From 4c67348171a6a4e81c9c40d6ef0b33ab510d2824 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 13:38:24 +0200 Subject: [PATCH 042/181] FollowButton.spec.js coverage --- webapp/components/FollowButton.spec.js | 47 ++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 webapp/components/FollowButton.spec.js diff --git a/webapp/components/FollowButton.spec.js b/webapp/components/FollowButton.spec.js new file mode 100644 index 000000000..000745081 --- /dev/null +++ b/webapp/components/FollowButton.spec.js @@ -0,0 +1,47 @@ +import { mount } from '@vue/test-utils' +import FollowButton from './FollowButton.vue' + +const localVue = global.localVue + +describe('FollowButton.vue', () => { + let mocks + let propsData + + beforeEach(() => { + mocks = { + $t: jest.fn(), + $apollo: { + mutate: jest.fn(), + }, + } + propsData = {} + }) + + describe('mount', () => { + let wrapper + const Wrapper = () => { + return mount(FollowButton, { mocks, propsData, localVue }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders button and text', () => { + expect(mocks.$t).toHaveBeenCalledWith('followButton.follow') + expect(wrapper.findAll('.base-button')).toHaveLength(1) + }) + + it('renders button and text when followed', () => { + propsData.isFollowed = true + wrapper = Wrapper() + expect(mocks.$t).toHaveBeenCalledWith('followButton.following') + expect(wrapper.findAll('.base-button')).toHaveLength(1) + }) + + it.skip('toggle the button', async () => { + wrapper.find('.base-button').trigger('click') // This does not work since @click.prevent is used + expect(wrapper.vm.isFollowed).toBe(true) + }) + }) +}) From 1a42bbcf2a9f240aa2b4dc272c69ea03fd1a4bf3 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 14:43:33 +0200 Subject: [PATCH 043/181] coverage moderation/index.spec.js --- webapp/pages/moderation/index.spec.js | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 webapp/pages/moderation/index.spec.js diff --git a/webapp/pages/moderation/index.spec.js b/webapp/pages/moderation/index.spec.js new file mode 100644 index 000000000..4d6c55272 --- /dev/null +++ b/webapp/pages/moderation/index.spec.js @@ -0,0 +1,31 @@ +import { config, mount } from '@vue/test-utils' +import Moderation from './index.vue' + +const localVue = global.localVue +config.stubs['client-only'] = '' + +describe('moderation/index.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn() + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Moderation, { mocks, localVue }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + + }) +}) From 920094e85a05663c52aa44bbdd4de0e908fb768b Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 15:22:18 +0200 Subject: [PATCH 044/181] fixed fileMock renderer & include --- webapp/package.json | 6 +++--- webapp/test/fileMock.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/webapp/package.json b/webapp/package.json index b34c6d818..7abe34e4a 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -49,10 +49,10 @@ "vue" ], "moduleNameMapper": { - "^@/(.*)$": "/src/$1", - "^~/(.*)$": "/$1", + "\\.(svg)$": "/test/fileMock.js", "\\.(css|less)$": "identity-obj-proxy", - "\\.(svg)$": "/test/fileMock.js" + "^@/(.*)$": "/src/$1", + "^~/(.*)$": "/$1" }, "setupFiles": [ "/test/registerContext.js", diff --git a/webapp/test/fileMock.js b/webapp/test/fileMock.js index 0e56c5b5f..02e28a211 100644 --- a/webapp/test/fileMock.js +++ b/webapp/test/fileMock.js @@ -1 +1,3 @@ -module.exports = 'test-file-stub' +module.exports = { + render: () => 'test-file-stub' +}; From e1b218311b1a5a2a2a1741a24139c0aa6baa2aa5 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 15:22:31 +0200 Subject: [PATCH 045/181] coverage Logo.spec.js --- webapp/components/Logo/Logo.spec.js | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 webapp/components/Logo/Logo.spec.js diff --git a/webapp/components/Logo/Logo.spec.js b/webapp/components/Logo/Logo.spec.js new file mode 100644 index 000000000..c7c62f97c --- /dev/null +++ b/webapp/components/Logo/Logo.spec.js @@ -0,0 +1,31 @@ +import { config, mount } from '@vue/test-utils' +import Logo from './Logo.vue' + +const localVue = global.localVue +// config.stubs['client-only'] = '' + +describe('Logo.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn() + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Logo, { mocks, localVue }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.findAll('.ds-logo')).toHaveLength(1) + }) + + }) +}) From fe0977a56b5dec0c5c31320c589c01ab3b78dd02 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 15:27:52 +0200 Subject: [PATCH 046/181] lint fixes --- webapp/components/Logo/Logo.spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/webapp/components/Logo/Logo.spec.js b/webapp/components/Logo/Logo.spec.js index c7c62f97c..ceeb50bc9 100644 --- a/webapp/components/Logo/Logo.spec.js +++ b/webapp/components/Logo/Logo.spec.js @@ -1,8 +1,7 @@ -import { config, mount } from '@vue/test-utils' +import { mount } from '@vue/test-utils' import Logo from './Logo.vue' const localVue = global.localVue -// config.stubs['client-only'] = '' describe('Logo.vue', () => { let wrapper From 63d962a69ecc11a744f127e5e6b828ce5bdb0eb8 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 15:28:08 +0200 Subject: [PATCH 047/181] coverage profile/_id.spec.js --- webapp/pages/profile/_id.spec.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 webapp/pages/profile/_id.spec.js diff --git a/webapp/pages/profile/_id.spec.js b/webapp/pages/profile/_id.spec.js new file mode 100644 index 000000000..d1df3ac3b --- /dev/null +++ b/webapp/pages/profile/_id.spec.js @@ -0,0 +1,31 @@ +import { config, mount } from '@vue/test-utils' +import _id from './_id.vue' + +const localVue = global.localVue +config.stubs['nuxt-child'] = '' + +describe('profile/_id.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn() + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(_id, { mocks, localVue }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.findAll('.nuxt-child')).toHaveLength(1) + }) + + }) +}) From d2347ba2d8104cd862d0fdfce6078414f62df5fa Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 16:24:59 +0200 Subject: [PATCH 048/181] coverage search-results.spec.js --- webapp/pages/search/search-results.spec.js | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 webapp/pages/search/search-results.spec.js diff --git a/webapp/pages/search/search-results.spec.js b/webapp/pages/search/search-results.spec.js new file mode 100644 index 000000000..7cd91fe54 --- /dev/null +++ b/webapp/pages/search/search-results.spec.js @@ -0,0 +1,31 @@ +import { config, mount } from '@vue/test-utils' +import searchResults from './search-results.vue' + +const localVue = global.localVue +config.stubs['client-only'] = '' + +describe('search-results.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(searchResults, { mocks, localVue }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.findAll('.search-results')).toHaveLength(1) + }) + + }) +}) From 609836d48cc005e8715e50f03aae2c162fb1bdfe Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 16:25:26 +0200 Subject: [PATCH 049/181] coverage post/_id.spec.js coverage post/create.spec.js --- webapp/pages/post/_id.spec.js | 37 ++++++++++++++++++++++++++++++++ webapp/pages/post/create.spec.js | 30 ++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 webapp/pages/post/_id.spec.js create mode 100644 webapp/pages/post/create.spec.js diff --git a/webapp/pages/post/_id.spec.js b/webapp/pages/post/_id.spec.js new file mode 100644 index 000000000..5b431b445 --- /dev/null +++ b/webapp/pages/post/_id.spec.js @@ -0,0 +1,37 @@ +import { config, mount } from '@vue/test-utils' +import _id from './_id.vue' + +const localVue = global.localVue +config.stubs['nuxt-child'] = '' + +describe('post/_id.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + $route: { + params: { + id: '1234', + slug: 'my-post', + }, + }, + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(_id, { mocks, localVue }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.findAll('.post-side-navigation')).toHaveLength(1) + }) + + }) +}) diff --git a/webapp/pages/post/create.spec.js b/webapp/pages/post/create.spec.js new file mode 100644 index 000000000..ad87eba63 --- /dev/null +++ b/webapp/pages/post/create.spec.js @@ -0,0 +1,30 @@ +import { mount } from '@vue/test-utils' +import create from './create.vue' + +const localVue = global.localVue + +describe('create.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(create, { mocks, localVue }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.findAll('.contribution-form')).toHaveLength(1) + }) + + }) +}) From d16886c1fd5958076ce708631112d675ef790799 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 16:28:29 +0200 Subject: [PATCH 050/181] lint fixes --- webapp/components/Logo/Logo.spec.js | 3 +-- webapp/pages/moderation/index.spec.js | 3 +-- webapp/pages/post/create.spec.js | 1 - webapp/pages/profile/_id.spec.js | 3 +-- webapp/pages/search/search-results.spec.js | 1 - webapp/test/fileMock.js | 4 ++-- 6 files changed, 5 insertions(+), 10 deletions(-) diff --git a/webapp/components/Logo/Logo.spec.js b/webapp/components/Logo/Logo.spec.js index ceeb50bc9..a712a529b 100644 --- a/webapp/components/Logo/Logo.spec.js +++ b/webapp/components/Logo/Logo.spec.js @@ -9,7 +9,7 @@ describe('Logo.vue', () => { beforeEach(() => { mocks = { - $t: jest.fn() + $t: jest.fn(), } }) @@ -25,6 +25,5 @@ describe('Logo.vue', () => { it('renders', () => { expect(wrapper.findAll('.ds-logo')).toHaveLength(1) }) - }) }) diff --git a/webapp/pages/moderation/index.spec.js b/webapp/pages/moderation/index.spec.js index 4d6c55272..249752aa3 100644 --- a/webapp/pages/moderation/index.spec.js +++ b/webapp/pages/moderation/index.spec.js @@ -10,7 +10,7 @@ describe('moderation/index.vue', () => { beforeEach(() => { mocks = { - $t: jest.fn() + $t: jest.fn(), } }) @@ -26,6 +26,5 @@ describe('moderation/index.vue', () => { it('renders', () => { expect(wrapper.is('.base-card')).toBe(true) }) - }) }) diff --git a/webapp/pages/post/create.spec.js b/webapp/pages/post/create.spec.js index ad87eba63..951edba03 100644 --- a/webapp/pages/post/create.spec.js +++ b/webapp/pages/post/create.spec.js @@ -25,6 +25,5 @@ describe('create.vue', () => { it('renders', () => { expect(wrapper.findAll('.contribution-form')).toHaveLength(1) }) - }) }) diff --git a/webapp/pages/profile/_id.spec.js b/webapp/pages/profile/_id.spec.js index d1df3ac3b..a51b38041 100644 --- a/webapp/pages/profile/_id.spec.js +++ b/webapp/pages/profile/_id.spec.js @@ -10,7 +10,7 @@ describe('profile/_id.vue', () => { beforeEach(() => { mocks = { - $t: jest.fn() + $t: jest.fn(), } }) @@ -26,6 +26,5 @@ describe('profile/_id.vue', () => { it('renders', () => { expect(wrapper.findAll('.nuxt-child')).toHaveLength(1) }) - }) }) diff --git a/webapp/pages/search/search-results.spec.js b/webapp/pages/search/search-results.spec.js index 7cd91fe54..d1fbb33e2 100644 --- a/webapp/pages/search/search-results.spec.js +++ b/webapp/pages/search/search-results.spec.js @@ -26,6 +26,5 @@ describe('search-results.vue', () => { it('renders', () => { expect(wrapper.findAll('.search-results')).toHaveLength(1) }) - }) }) diff --git a/webapp/test/fileMock.js b/webapp/test/fileMock.js index 02e28a211..c77f5e0de 100644 --- a/webapp/test/fileMock.js +++ b/webapp/test/fileMock.js @@ -1,3 +1,3 @@ module.exports = { - render: () => 'test-file-stub' -}; + render: () => 'test-file-stub', +} From 196fbe086481703c0b0951f400718786bca95193 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 16:29:35 +0200 Subject: [PATCH 051/181] lint fixes --- webapp/pages/post/_id.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/webapp/pages/post/_id.spec.js b/webapp/pages/post/_id.spec.js index 5b431b445..662f85406 100644 --- a/webapp/pages/post/_id.spec.js +++ b/webapp/pages/post/_id.spec.js @@ -32,6 +32,5 @@ describe('post/_id.vue', () => { it('renders', () => { expect(wrapper.findAll('.post-side-navigation')).toHaveLength(1) }) - }) }) From 43c1c268ca6cf022b349b90056426d3a2c7e31d3 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 16:33:35 +0200 Subject: [PATCH 052/181] coverage post/edit/_id.spec.js --- webapp/pages/post/edit/_id.spec.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 webapp/pages/post/edit/_id.spec.js diff --git a/webapp/pages/post/edit/_id.spec.js b/webapp/pages/post/edit/_id.spec.js new file mode 100644 index 000000000..a89acdce2 --- /dev/null +++ b/webapp/pages/post/edit/_id.spec.js @@ -0,0 +1,30 @@ +import { config, mount } from '@vue/test-utils' +import _id from './_id.vue' + +const localVue = global.localVue +// config.stubs['nuxt-child'] = '' + +describe('post/_id.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(_id, { mocks, localVue }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.findAll('.contribution-form')).toHaveLength(1) + }) + }) +}) From 194178854f0c9b04bf93c66388646db6da5bf6ee Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 16:34:14 +0200 Subject: [PATCH 053/181] lint fixes --- webapp/pages/post/edit/_id.spec.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/webapp/pages/post/edit/_id.spec.js b/webapp/pages/post/edit/_id.spec.js index a89acdce2..44cdf9a11 100644 --- a/webapp/pages/post/edit/_id.spec.js +++ b/webapp/pages/post/edit/_id.spec.js @@ -1,8 +1,7 @@ -import { config, mount } from '@vue/test-utils' +import { mount } from '@vue/test-utils' import _id from './_id.vue' const localVue = global.localVue -// config.stubs['nuxt-child'] = '' describe('post/_id.vue', () => { let wrapper From 26bbf175a483fbf3da4280acf84cf661e738acc1 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 17:29:26 +0200 Subject: [PATCH 054/181] coverage InviteButton.spec.js --- .../InviteButton/InviteButton.spec.js | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 webapp/components/InviteButton/InviteButton.spec.js diff --git a/webapp/components/InviteButton/InviteButton.spec.js b/webapp/components/InviteButton/InviteButton.spec.js new file mode 100644 index 000000000..e10d98290 --- /dev/null +++ b/webapp/components/InviteButton/InviteButton.spec.js @@ -0,0 +1,56 @@ +import Vue from 'vue' +import { config, mount } from '@vue/test-utils' +import InviteButton from './InviteButton.vue' + +const localVue = global.localVue + +config.stubs['v-popover'] = '' + +describe('InviteButton.vue', () => { + let wrapper + let mocks + let propsData + + beforeEach(() => { + mocks = { + $t: jest.fn(), + navigator: { + clipboard: { + writeText: jest.fn(), + }, + }, + } + propsData = {} + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(InviteButton, { mocks, propsData }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.contains('.invite-button')).toBe(true) + }) + + it('open popup', () => { + wrapper.find('.base-button').trigger('click') + expect(wrapper.contains('.invite-button')).toBe(true) + }) + + it('invite codes not available', async () => { + wrapper.find('.base-button').trigger('click') //open popup + wrapper.find('.invite-button').trigger('click') //click copy button + expect(mocks.$t).toHaveBeenCalledWith('invite-codes.not-available') + }) + + it.skip('invite codes copied to clipboard', async () => { + wrapper.find('.base-button').trigger('click') //open popup + wrapper.find('.invite-button').trigger('click') //click copy button + expect(mocks.$t).toHaveBeenCalledWith('invite-codes.not-available') + }) + }) +}) From 7e16b8e72c7366be289e3940c52efc432cd0bf0c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:02:52 +0200 Subject: [PATCH 055/181] lint fixes --- .../components/InviteButton/InviteButton.spec.js | 11 ++++------- webapp/pages/profile/_id.spec.js | 15 +++++++++------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/webapp/components/InviteButton/InviteButton.spec.js b/webapp/components/InviteButton/InviteButton.spec.js index e10d98290..f28045612 100644 --- a/webapp/components/InviteButton/InviteButton.spec.js +++ b/webapp/components/InviteButton/InviteButton.spec.js @@ -1,9 +1,6 @@ -import Vue from 'vue' import { config, mount } from '@vue/test-utils' import InviteButton from './InviteButton.vue' -const localVue = global.localVue - config.stubs['v-popover'] = '' describe('InviteButton.vue', () => { @@ -42,14 +39,14 @@ describe('InviteButton.vue', () => { }) it('invite codes not available', async () => { - wrapper.find('.base-button').trigger('click') //open popup - wrapper.find('.invite-button').trigger('click') //click copy button + wrapper.find('.base-button').trigger('click') // open popup + wrapper.find('.invite-button').trigger('click') // click copy button expect(mocks.$t).toHaveBeenCalledWith('invite-codes.not-available') }) it.skip('invite codes copied to clipboard', async () => { - wrapper.find('.base-button').trigger('click') //open popup - wrapper.find('.invite-button').trigger('click') //click copy button + wrapper.find('.base-button').trigger('click') // open popup + wrapper.find('.invite-button').trigger('click') // click copy button expect(mocks.$t).toHaveBeenCalledWith('invite-codes.not-available') }) }) diff --git a/webapp/pages/profile/_id.spec.js b/webapp/pages/profile/_id.spec.js index a51b38041..aab216569 100644 --- a/webapp/pages/profile/_id.spec.js +++ b/webapp/pages/profile/_id.spec.js @@ -2,21 +2,24 @@ import { config, mount } from '@vue/test-utils' import _id from './_id.vue' const localVue = global.localVue + config.stubs['nuxt-child'] = '' -describe('profile/_id.vue', () => { +describe('Profile _id.vue', () => { let wrapper + let Wrapper let mocks beforeEach(() => { - mocks = { - $t: jest.fn(), - } + mocks = {} }) describe('mount', () => { - const Wrapper = () => { - return mount(_id, { mocks, localVue }) + Wrapper = () => { + return mount(_id, { + mocks, + localVue, + }) } beforeEach(() => { From d295ba3f65a527860ca2e55acd2f8f57493e8ad7 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:03:06 +0200 Subject: [PATCH 056/181] coverage admin.spec.js --- webapp/pages/admin.spec.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 webapp/pages/admin.spec.js diff --git a/webapp/pages/admin.spec.js b/webapp/pages/admin.spec.js new file mode 100644 index 000000000..20b19a7b9 --- /dev/null +++ b/webapp/pages/admin.spec.js @@ -0,0 +1,32 @@ +import { mount } from '@vue/test-utils' +import moderation from './moderation.vue' + +const localVue = global.localVue + +describe('moderation.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(moderation, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('div')).toBe(true) + }) + }) +}) From c76b549607c2babcc98ae9a13e4e3cb2c44c31c7 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:03:21 +0200 Subject: [PATCH 057/181] coverage change-password.spec.js --- .../password-reset/change-password.spec.js | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 webapp/pages/password-reset/change-password.spec.js diff --git a/webapp/pages/password-reset/change-password.spec.js b/webapp/pages/password-reset/change-password.spec.js new file mode 100644 index 000000000..cad031c95 --- /dev/null +++ b/webapp/pages/password-reset/change-password.spec.js @@ -0,0 +1,35 @@ +import { mount } from '@vue/test-utils' +import changePassword from './change-password.vue' + +const localVue = global.localVue + +describe('enter-nonce.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + $route: { + query: jest.fn().mockResolvedValue({ email: 'peter@lustig.de', nonce: '12345' }), + }, + $apollo: { + loading: false, + }, + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(changePassword, { mocks, localVue }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.findAll('.ds-form')).toHaveLength(1) + }) + }) +}) From ee7c4dc7156cd69aa44a379ef91768fa89d7706c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:03:31 +0200 Subject: [PATCH 058/181] coverage enter-nonce.spec.js --- .../pages/password-reset/enter-nonce.spec.js | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 webapp/pages/password-reset/enter-nonce.spec.js diff --git a/webapp/pages/password-reset/enter-nonce.spec.js b/webapp/pages/password-reset/enter-nonce.spec.js new file mode 100644 index 000000000..42fbaa5a5 --- /dev/null +++ b/webapp/pages/password-reset/enter-nonce.spec.js @@ -0,0 +1,33 @@ +import { config, mount } from '@vue/test-utils' +import enterNonce from './enter-nonce.vue' + +const localVue = global.localVue +config.stubs['nuxt-link'] = '' + +describe('enter-nonce.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + $route: { + query: jest.fn().mockResolvedValue({ email: 'peter@lustig.de' }), + }, + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(enterNonce, { mocks, localVue }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.findAll('.ds-form')).toHaveLength(1) + }) + }) +}) From f9d5ecec5b1496e05294a50dd4e475b6999c426f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:03:41 +0200 Subject: [PATCH 059/181] coverage login.spec.js --- webapp/pages/login.spec.js | 71 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 webapp/pages/login.spec.js diff --git a/webapp/pages/login.spec.js b/webapp/pages/login.spec.js new file mode 100644 index 000000000..5a64b1280 --- /dev/null +++ b/webapp/pages/login.spec.js @@ -0,0 +1,71 @@ +import { config, mount } from '@vue/test-utils' +import Vuex from 'vuex' +import login from './login.vue' + +const localVue = global.localVue + +config.stubs['client-only'] = '' +config.stubs['nuxt-link'] = '' + +describe('Login.vue', () => { + let mutations + let store + let mocks + let wrapper + + beforeEach(() => { + mutations = { + // 'posts/SELECT_ORDER': jest.fn(), + } + store = new Vuex.Store({ + getters: { + /* 'posts/filter': () => ({}), + 'posts/orderOptions': () => () => [ + { + key: 'store.posts.orderBy.oldest.label', + label: 'store.posts.orderBy.oldest.label', + icon: 'sort-amount-asc', + value: 'createdAt_asc', + }, + { + key: 'store.posts.orderBy.newest.label', + label: 'store.posts.orderBy.newest.label', + icon: 'sort-amount-desc', + value: 'createdAt_desc', + }, + ], + 'posts/selectedOrder': () => () => 'createdAt_desc', + 'posts/orderIcon': () => 'sort-amount-desc', + 'posts/orderBy': () => 'createdAt_desc', + 'auth/user': () => { + return { id: 'u23' } + }, */ + }, + mutations, + }) + mocks = { + $t: jest.fn(), + $i18n: { + locale: () => 'en', + }, + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(login, { + store, + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.findAll('.login-form')).toHaveLength(1) + }) + }) +}) From 47813b91762fdb489ab4d64278c2bdc61daed436 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:03:50 +0200 Subject: [PATCH 060/181] coverage request.spec.js --- webapp/pages/password-reset/request.spec.js | 54 +++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 webapp/pages/password-reset/request.spec.js diff --git a/webapp/pages/password-reset/request.spec.js b/webapp/pages/password-reset/request.spec.js new file mode 100644 index 000000000..53183a3be --- /dev/null +++ b/webapp/pages/password-reset/request.spec.js @@ -0,0 +1,54 @@ +import { config, mount } from '@vue/test-utils' +import request from './request.vue' + +const localVue = global.localVue +// config.stubs['sweetalert-icon'] = '' +config.stubs['nuxt-link'] = '' + +describe('request.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + /* $toast: { + success: jest.fn(), + error: jest.fn(), + }, */ + $t: jest.fn(), + $apollo: { + loading: false, + // mutate: jest.fn().mockResolvedValue({ data: { reqestPasswordReset: true } }), + }, + /* $router: { + push: jest.fn() + } */ + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(request, { mocks, localVue }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.findAll('.ds-form')).toHaveLength(1) + }) + + it.skip('calls "handlePasswordResetRequested" on submit', async () => { + await jest.useFakeTimers() + await wrapper.find('input#email').setValue('mail@example.org') + await wrapper.findAll('.ds-form').trigger('submit') + await jest.runAllTimers() + expect(wrapper.emitted('handleSubmitted')).toEqual([[{ email: 'mail@example.org' }]]) + expect(mocks.$router.push).toHaveBeenCalledWith({ + path: 'enter-nonce', + query: { email: 'mail@example.org' }, + }) + }) + }) +}) From 51dc5375a0881f9dfe47564683a43046a2775b33 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:04:03 +0200 Subject: [PATCH 061/181] coverage terms-and-conditions-confirm.spec.js --- .../terms-and-conditions-confirm.spec.js | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 webapp/pages/terms-and-conditions-confirm.spec.js diff --git a/webapp/pages/terms-and-conditions-confirm.spec.js b/webapp/pages/terms-and-conditions-confirm.spec.js new file mode 100644 index 000000000..7b3ddac3a --- /dev/null +++ b/webapp/pages/terms-and-conditions-confirm.spec.js @@ -0,0 +1,34 @@ +import { config, mount } from '@vue/test-utils' +import TermsAndConditionsConfirm from './terms-and-conditions-confirm.vue' + +const localVue = global.localVue + +config.stubs['nuxt-link'] = '' + +describe('terms-and-conditions-confirm.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(TermsAndConditionsConfirm, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('div')).toBe(true) + }) + }) +}) From 72ce38ddae2cf92e6c34c17c39e7480058363383 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:10:31 +0200 Subject: [PATCH 062/181] fixed test swap --- webapp/pages/admin.spec.js | 6 +++--- webapp/pages/moderation.spec.js | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 webapp/pages/moderation.spec.js diff --git a/webapp/pages/admin.spec.js b/webapp/pages/admin.spec.js index 20b19a7b9..7f5c44d48 100644 --- a/webapp/pages/admin.spec.js +++ b/webapp/pages/admin.spec.js @@ -1,9 +1,9 @@ import { mount } from '@vue/test-utils' -import moderation from './moderation.vue' +import admin from './admin.vue' const localVue = global.localVue -describe('moderation.vue', () => { +describe('admin.vue', () => { let wrapper let mocks @@ -15,7 +15,7 @@ describe('moderation.vue', () => { describe('mount', () => { const Wrapper = () => { - return mount(moderation, { + return mount(admin, { mocks, localVue, }) diff --git a/webapp/pages/moderation.spec.js b/webapp/pages/moderation.spec.js new file mode 100644 index 000000000..20b19a7b9 --- /dev/null +++ b/webapp/pages/moderation.spec.js @@ -0,0 +1,32 @@ +import { mount } from '@vue/test-utils' +import moderation from './moderation.vue' + +const localVue = global.localVue + +describe('moderation.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(moderation, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('div')).toBe(true) + }) + }) +}) From 609dc921106b7633ffe283f505420d3065f1cdc1 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:52:18 +0200 Subject: [PATCH 063/181] coverage code-of-conduct.spec.js --- webapp/pages/code-of-conduct.spec.js | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 webapp/pages/code-of-conduct.spec.js diff --git a/webapp/pages/code-of-conduct.spec.js b/webapp/pages/code-of-conduct.spec.js new file mode 100644 index 000000000..75e244c79 --- /dev/null +++ b/webapp/pages/code-of-conduct.spec.js @@ -0,0 +1,38 @@ +import { mount } from '@vue/test-utils' +import CodeOfConduct from './code-of-conduct.vue' +import VueMeta from 'vue-meta' + +const localVue = global.localVue +localVue.use(VueMeta, { keyName: 'head' }) + +describe('code-of-conduct.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: (t) => t, + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(CodeOfConduct, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('div')).toBe(true) + }) + + it('has correct content', () => { + expect(wrapper.vm.$metaInfo.title).toBe('site.code-of-conduct') + }) + }) +}) From e397f131f7d5bbff5b5d8cb86314ecbbc514d6ee Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:52:26 +0200 Subject: [PATCH 064/181] coverage data-privacy.spec.js --- webapp/pages/data-privacy.spec.js | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 webapp/pages/data-privacy.spec.js diff --git a/webapp/pages/data-privacy.spec.js b/webapp/pages/data-privacy.spec.js new file mode 100644 index 000000000..a919bb742 --- /dev/null +++ b/webapp/pages/data-privacy.spec.js @@ -0,0 +1,38 @@ +import { mount } from '@vue/test-utils' +import DataPrivacy from './data-privacy.vue' +import VueMeta from 'vue-meta' + +const localVue = global.localVue +localVue.use(VueMeta, { keyName: 'head' }) + +describe('data-privacy.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: (t) => t, + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(DataPrivacy, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('div')).toBe(true) + }) + + it('has correct content', () => { + expect(wrapper.vm.$metaInfo.title).toBe('site.data-privacy') + }) + }) +}) From 45f7ece24876ffed532d72ae9a1c2c97bff47a82 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:52:36 +0200 Subject: [PATCH 065/181] coverage imprint.spec.js --- webapp/pages/imprint.spec.js | 38 ++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 webapp/pages/imprint.spec.js diff --git a/webapp/pages/imprint.spec.js b/webapp/pages/imprint.spec.js new file mode 100644 index 000000000..1a84b5794 --- /dev/null +++ b/webapp/pages/imprint.spec.js @@ -0,0 +1,38 @@ +import { mount } from '@vue/test-utils' +import Imprint from './imprint.vue' +import VueMeta from 'vue-meta' + +const localVue = global.localVue +localVue.use(VueMeta, { keyName: 'head' }) + +describe('imprint.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: (t) => t, + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Imprint, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('div')).toBe(true) + }) + + it('has correct content', () => { + expect(wrapper.vm.$metaInfo.title).toBe('site.imprint') + }) + }) +}) From fb8b94803777af869007f0e449f6e7da2456ea43 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:52:45 +0200 Subject: [PATCH 066/181] coverage logout.spec.js --- webapp/pages/logout.spec.js | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 webapp/pages/logout.spec.js diff --git a/webapp/pages/logout.spec.js b/webapp/pages/logout.spec.js new file mode 100644 index 000000000..4ec777bf6 --- /dev/null +++ b/webapp/pages/logout.spec.js @@ -0,0 +1,43 @@ +import { mount } from '@vue/test-utils' +import Logout from './logout.vue' + +const localVue = global.localVue + +describe('logout.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + $store: { + dispatch: jest.fn(), + }, + $router: { + replace: jest.fn(), + }, + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Logout, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('div')).toBe(true) + }) + + it('logs out and redirects to login', () => { + expect(mocks.$store.dispatch).toBeCalledWith('auth/logout') + expect(mocks.$router.replace).toBeCalledWith('/login') + }) + }) +}) From 57f074dacdf1e96114a2d9a856a6bc49b6299ed8 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:52:54 +0200 Subject: [PATCH 067/181] coverage password-reset.spec.js --- webapp/pages/password-reset.spec.js | 38 +++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 webapp/pages/password-reset.spec.js diff --git a/webapp/pages/password-reset.spec.js b/webapp/pages/password-reset.spec.js new file mode 100644 index 000000000..416495910 --- /dev/null +++ b/webapp/pages/password-reset.spec.js @@ -0,0 +1,38 @@ +import { config, mount } from '@vue/test-utils' +import PasswordReset from './password-reset.vue' + +const localVue = global.localVue + +config.stubs['client-only'] = '' +config.stubs['nuxt-child'] = '' + +describe('password-reset.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: (t) => t, + $i18n: { + locale: () => 'en', + }, + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(PasswordReset, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('div')).toBe(true) + }) + }) +}) From 02c3e0a763efa924b4939e97f16f808b833529d2 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:53:03 +0200 Subject: [PATCH 068/181] coverage settings.spec.js --- webapp/pages/settings.spec.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 webapp/pages/settings.spec.js diff --git a/webapp/pages/settings.spec.js b/webapp/pages/settings.spec.js new file mode 100644 index 000000000..353f1e6b8 --- /dev/null +++ b/webapp/pages/settings.spec.js @@ -0,0 +1,34 @@ +import { config, mount } from '@vue/test-utils' +import settings from './settings.vue' + +const localVue = global.localVue + +config.stubs['nuxt-child'] = '' + +describe('settings.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(settings, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('div')).toBe(true) + }) + }) +}) From 427c6f04889b048ab7a9974d755bbe5ca4ddd7d1 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:53:29 +0200 Subject: [PATCH 069/181] title test terms-and-conditions-confirm.spec.js --- webapp/pages/terms-and-conditions-confirm.spec.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webapp/pages/terms-and-conditions-confirm.spec.js b/webapp/pages/terms-and-conditions-confirm.spec.js index 7b3ddac3a..380b6dbf0 100644 --- a/webapp/pages/terms-and-conditions-confirm.spec.js +++ b/webapp/pages/terms-and-conditions-confirm.spec.js @@ -1,7 +1,9 @@ import { config, mount } from '@vue/test-utils' import TermsAndConditionsConfirm from './terms-and-conditions-confirm.vue' +import VueMeta from 'vue-meta' const localVue = global.localVue +localVue.use(VueMeta, { keyName: 'head' }) config.stubs['nuxt-link'] = '' @@ -11,7 +13,7 @@ describe('terms-and-conditions-confirm.vue', () => { beforeEach(() => { mocks = { - $t: jest.fn(), + $t: (t) => t, } }) @@ -30,5 +32,9 @@ describe('terms-and-conditions-confirm.vue', () => { it('renders', () => { expect(wrapper.is('div')).toBe(true) }) + + it('has correct content', () => { + expect(wrapper.vm.$metaInfo.title).toBe('termsAndConditions.newTermsAndConditions') + }) }) }) From 96f84e33f7c1872b40cf28ff7482533caa8b3ece Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 19:53:41 +0200 Subject: [PATCH 070/181] coverage terms-and-conditions.spec.js --- webapp/pages/terms-and-conditions.spec.js | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 webapp/pages/terms-and-conditions.spec.js diff --git a/webapp/pages/terms-and-conditions.spec.js b/webapp/pages/terms-and-conditions.spec.js new file mode 100644 index 000000000..d6ae6dce7 --- /dev/null +++ b/webapp/pages/terms-and-conditions.spec.js @@ -0,0 +1,38 @@ +import { mount } from '@vue/test-utils' +import TermsAndConditions from './terms-and-conditions.vue' +import VueMeta from 'vue-meta' + +const localVue = global.localVue +localVue.use(VueMeta, { keyName: 'head' }) + +describe('terms-and-conditions.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: (t) => t, + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(TermsAndConditions, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('div')).toBe(true) + }) + + it('has correct content', () => { + expect(wrapper.vm.$metaInfo.title).toBe('site.termsAndConditions') + }) + }) +}) From 3fda4f67704e4149de0a80b3b7a2ac146a4fff2f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 20:35:37 +0200 Subject: [PATCH 071/181] fixed vue warning --- webapp/components/Hashtag/Hashtag.spec.js | 1 + webapp/pages/admin.spec.js | 4 +++- webapp/pages/moderation.spec.js | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/webapp/components/Hashtag/Hashtag.spec.js b/webapp/components/Hashtag/Hashtag.spec.js index 4a420d7d8..442f268d5 100644 --- a/webapp/components/Hashtag/Hashtag.spec.js +++ b/webapp/components/Hashtag/Hashtag.spec.js @@ -5,6 +5,7 @@ import Hashtag from './Hashtag' const localVue = global.localVue config.stubs['nuxt-link'] = '' +config.stubs['nuxt-child'] = '' describe('Hashtag', () => { let id diff --git a/webapp/pages/admin.spec.js b/webapp/pages/admin.spec.js index 7f5c44d48..fc3849fc4 100644 --- a/webapp/pages/admin.spec.js +++ b/webapp/pages/admin.spec.js @@ -1,6 +1,8 @@ -import { mount } from '@vue/test-utils' +import { config, mount } from '@vue/test-utils' import admin from './admin.vue' +config.stubs['nuxt-child'] = '' + const localVue = global.localVue describe('admin.vue', () => { diff --git a/webapp/pages/moderation.spec.js b/webapp/pages/moderation.spec.js index 20b19a7b9..2eeae9f7c 100644 --- a/webapp/pages/moderation.spec.js +++ b/webapp/pages/moderation.spec.js @@ -1,6 +1,8 @@ -import { mount } from '@vue/test-utils' +import { config, mount } from '@vue/test-utils' import moderation from './moderation.vue' +config.stubs['nuxt-child'] = '' + const localVue = global.localVue describe('moderation.vue', () => { From 782f5dcce8bbb456dedac9347f25288a25b7395c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 20:35:45 +0200 Subject: [PATCH 072/181] coverage data-download.spec.js --- webapp/pages/settings/data-download.spec.js | 32 +++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 webapp/pages/settings/data-download.spec.js diff --git a/webapp/pages/settings/data-download.spec.js b/webapp/pages/settings/data-download.spec.js new file mode 100644 index 000000000..b50c8d046 --- /dev/null +++ b/webapp/pages/settings/data-download.spec.js @@ -0,0 +1,32 @@ +import { mount } from '@vue/test-utils' +import DataDownload from './data-download.vue' + +const localVue = global.localVue + +describe('data-download.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(DataDownload, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From af6bc6ea2f4d2c68ab3a11139de228ee1c861bab Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 20:35:54 +0200 Subject: [PATCH 073/181] coverage delete-account.spec.js --- webapp/pages/settings/delete-account.spec.js | 42 ++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 webapp/pages/settings/delete-account.spec.js diff --git a/webapp/pages/settings/delete-account.spec.js b/webapp/pages/settings/delete-account.spec.js new file mode 100644 index 000000000..6564adfb8 --- /dev/null +++ b/webapp/pages/settings/delete-account.spec.js @@ -0,0 +1,42 @@ +import Vuex from 'vuex' +import { mount } from '@vue/test-utils' +import DeleteAccount from './delete-account.vue' + +const localVue = global.localVue + +describe('delete-account.vue', () => { + let wrapper + let mocks + let store + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + store = new Vuex.Store({ + getters: { + 'auth/user': () => { + return { id: 'u343', name: 'Delete MyAccount' } + }, + } + }) + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(DeleteAccount, { + store, + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.delete-data')).toBe(true) + }) + }) +}) From 89713c50e35270df58933809620a8fdfcb8a83e9 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 20:36:02 +0200 Subject: [PATCH 074/181] coverage embeds.spec.js --- webapp/pages/settings/embeds.spec.js | 42 ++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 webapp/pages/settings/embeds.spec.js diff --git a/webapp/pages/settings/embeds.spec.js b/webapp/pages/settings/embeds.spec.js new file mode 100644 index 000000000..f9ca8df56 --- /dev/null +++ b/webapp/pages/settings/embeds.spec.js @@ -0,0 +1,42 @@ +import Vuex from 'vuex' +import { mount } from '@vue/test-utils' +import Embeds from './embeds.vue' + +const localVue = global.localVue + +describe('embeds.vue', () => { + let wrapper + let mocks + let store + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + store = new Vuex.Store({ + getters: { + 'auth/user': () => { + return { id: 'u343', name: 'Delete MyAccount', allowEmbedIframes: true } + }, + } + }) + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Embeds, { + store, + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From 9ce0cb91f41650b5644bd7a1cc7c74db2f12d6f4 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 20:36:10 +0200 Subject: [PATCH 075/181] coverage invites.spec.js --- webapp/pages/settings/invites.spec.js | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 webapp/pages/settings/invites.spec.js diff --git a/webapp/pages/settings/invites.spec.js b/webapp/pages/settings/invites.spec.js new file mode 100644 index 000000000..cbc8d1765 --- /dev/null +++ b/webapp/pages/settings/invites.spec.js @@ -0,0 +1,32 @@ +import { mount } from '@vue/test-utils' +import Invites from './invites.vue' + +const localVue = global.localVue + +describe('invites.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Invites, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From aa32e70c45b0c64efd5614f412a578ad195dd125 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 20:36:16 +0200 Subject: [PATCH 076/181] coverage languages.spec.js --- webapp/pages/settings/languages.spec.js | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 webapp/pages/settings/languages.spec.js diff --git a/webapp/pages/settings/languages.spec.js b/webapp/pages/settings/languages.spec.js new file mode 100644 index 000000000..0e3665739 --- /dev/null +++ b/webapp/pages/settings/languages.spec.js @@ -0,0 +1,32 @@ +import { mount } from '@vue/test-utils' +import Languages from './languages.vue' + +const localVue = global.localVue + +describe('languages.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Languages, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From e5ff917d8dc50887467d07d4c71d205deea038d0 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 20:36:23 +0200 Subject: [PATCH 077/181] coverage my-organizations.spec.js --- .../pages/settings/my-organizations.spec.js | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 webapp/pages/settings/my-organizations.spec.js diff --git a/webapp/pages/settings/my-organizations.spec.js b/webapp/pages/settings/my-organizations.spec.js new file mode 100644 index 000000000..7f11b9871 --- /dev/null +++ b/webapp/pages/settings/my-organizations.spec.js @@ -0,0 +1,32 @@ +import { mount } from '@vue/test-utils' +import MyOrganizations from './my-organizations.vue' + +const localVue = global.localVue + +describe('my-organizations.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(MyOrganizations, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From e6de7b1de8195aecd226cc6658ca3b9b1c35d88a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 20:36:34 +0200 Subject: [PATCH 078/181] coverage privacy.spec.js --- webapp/pages/settings/privacy.spec.js | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 webapp/pages/settings/privacy.spec.js diff --git a/webapp/pages/settings/privacy.spec.js b/webapp/pages/settings/privacy.spec.js new file mode 100644 index 000000000..805677e34 --- /dev/null +++ b/webapp/pages/settings/privacy.spec.js @@ -0,0 +1,42 @@ +import Vuex from 'vuex' +import { mount } from '@vue/test-utils' +import Privacy from './privacy.vue' + +const localVue = global.localVue + +describe('privacy.vue', () => { + let wrapper + let mocks + let store + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + store = new Vuex.Store({ + getters: { + 'auth/user': () => { + return { id: 'u343', name: 'Delete MyAccount', showShoutsPublicly: true } + }, + }, + }) + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Privacy, { + store, + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From f3a7604ab9675339cebdc05502e5449979d430b0 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 20:36:46 +0200 Subject: [PATCH 079/181] coverage security.spec.js --- webapp/pages/settings/security.spec.js | 32 ++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 webapp/pages/settings/security.spec.js diff --git a/webapp/pages/settings/security.spec.js b/webapp/pages/settings/security.spec.js new file mode 100644 index 000000000..dee9e640a --- /dev/null +++ b/webapp/pages/settings/security.spec.js @@ -0,0 +1,32 @@ +import { mount } from '@vue/test-utils' +import Security from './security.vue' + +const localVue = global.localVue + +describe('security.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Security, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From b43785499cced69149f6fb7dc52b43cc5dac5f65 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 20:48:18 +0200 Subject: [PATCH 080/181] lint fixes --- webapp/pages/settings/delete-account.spec.js | 2 +- webapp/pages/settings/embeds.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/pages/settings/delete-account.spec.js b/webapp/pages/settings/delete-account.spec.js index 6564adfb8..aa8ffd954 100644 --- a/webapp/pages/settings/delete-account.spec.js +++ b/webapp/pages/settings/delete-account.spec.js @@ -18,7 +18,7 @@ describe('delete-account.vue', () => { 'auth/user': () => { return { id: 'u343', name: 'Delete MyAccount' } }, - } + }, }) }) diff --git a/webapp/pages/settings/embeds.spec.js b/webapp/pages/settings/embeds.spec.js index f9ca8df56..75247ddf0 100644 --- a/webapp/pages/settings/embeds.spec.js +++ b/webapp/pages/settings/embeds.spec.js @@ -18,7 +18,7 @@ describe('embeds.vue', () => { 'auth/user': () => { return { id: 'u343', name: 'Delete MyAccount', allowEmbedIframes: true } }, - } + }, }) }) From d151251c951916e859ad1406456ffec4967ec3ab Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 25 Apr 2021 20:48:32 +0200 Subject: [PATCH 081/181] require 65% frontend coverage --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 240c54ddf..e6fbd018e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -268,7 +268,7 @@ jobs: report_name: Coverage Webapp type: lcov result_path: ./coverage/lcov.info - min_coverage: 60 + min_coverage: 65 token: ${{ github.token }} ############################################################################## From 44038a46ab72187518f6d252894787e89b249771 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 00:34:17 +0200 Subject: [PATCH 082/181] test head post/_id/_slug/index.spec.js --- webapp/pages/post/_id/_slug/index.spec.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/webapp/pages/post/_id/_slug/index.spec.js b/webapp/pages/post/_id/_slug/index.spec.js index bc54edf53..4289bb53d 100644 --- a/webapp/pages/post/_id/_slug/index.spec.js +++ b/webapp/pages/post/_id/_slug/index.spec.js @@ -4,6 +4,7 @@ import Vue from 'vue' import PostSlug from './index.vue' import CommentList from '~/components/CommentList/CommentList' import HcHashtag from '~/components/Hashtag/Hashtag' +import VueMeta from 'vue-meta' config.stubs['client-only'] = '' config.stubs['nuxt-link'] = '' @@ -11,6 +12,7 @@ config.stubs['router-link'] = '' const localVue = global.localVue localVue.directive('scrollTo', jest.fn()) +localVue.use(VueMeta, { keyName: 'head' }) describe('PostSlug', () => { let wrapper, Wrapper, backendData, mocks, stubs @@ -91,6 +93,11 @@ describe('PostSlug', () => { return wrapper } + it('has correct content', async () => { + wrapper = await Wrapper() + expect(wrapper.vm.$metaInfo.title).toBe('loading') + }) + describe('given author is `null`', () => { it('does not crash', async () => { backendData = { From 256a4ed03e04960c59beff343e9730cfedb82e36 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 00:34:32 +0200 Subject: [PATCH 083/181] coverage basic.spec.js --- webapp/layouts/basic.spec.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 webapp/layouts/basic.spec.js diff --git a/webapp/layouts/basic.spec.js b/webapp/layouts/basic.spec.js new file mode 100644 index 000000000..471facddd --- /dev/null +++ b/webapp/layouts/basic.spec.js @@ -0,0 +1,34 @@ +import { config, shallowMount } from '@vue/test-utils' +import Basic from './basic.vue' + +const localVue = global.localVue + +config.stubs['nuxt'] = '' + +describe('basic.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('shallow mount', () => { + const Wrapper = () => { + return shallowMount(Basic, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.layout-blank')).toBe(true) + }) + }) +}) From 3484541a9138925fa5f50ce82436b3fb9729776c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 00:34:44 +0200 Subject: [PATCH 084/181] coverage blank.spec.js --- webapp/layouts/blank.spec.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 webapp/layouts/blank.spec.js diff --git a/webapp/layouts/blank.spec.js b/webapp/layouts/blank.spec.js new file mode 100644 index 000000000..dca11486a --- /dev/null +++ b/webapp/layouts/blank.spec.js @@ -0,0 +1,34 @@ +import { config, shallowMount } from '@vue/test-utils' +import Blank from './blank.vue' + +const localVue = global.localVue + +config.stubs['nuxt'] = '' + +describe('blank.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('shallow mount', () => { + const Wrapper = () => { + return shallowMount(Blank, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.layout-blank')).toBe(true) + }) + }) +}) From f97e91162621804fabe70ccdad58cc54bae489e1 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 00:34:58 +0200 Subject: [PATCH 085/181] coverage categories.spec.js --- webapp/pages/admin/categories.spec.js | 32 +++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 webapp/pages/admin/categories.spec.js diff --git a/webapp/pages/admin/categories.spec.js b/webapp/pages/admin/categories.spec.js new file mode 100644 index 000000000..55715e74b --- /dev/null +++ b/webapp/pages/admin/categories.spec.js @@ -0,0 +1,32 @@ +import { mount } from '@vue/test-utils' +import Categories from './categories.vue' + +const localVue = global.localVue + +describe('categories.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Categories, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From 37c04849dd8a981c230bda268dafa4f448d595f0 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 00:35:09 +0200 Subject: [PATCH 086/181] coverage default.spec.js --- webapp/layouts/default.spec.js | 45 ++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 webapp/layouts/default.spec.js diff --git a/webapp/layouts/default.spec.js b/webapp/layouts/default.spec.js new file mode 100644 index 000000000..13933d821 --- /dev/null +++ b/webapp/layouts/default.spec.js @@ -0,0 +1,45 @@ +import Vuex from 'vuex' +import { config, shallowMount } from '@vue/test-utils' +import Default from './default.vue' + +const localVue = global.localVue + +config.stubs['nuxt'] = '' +config.stubs['client-only'] = '' +config.stubs['nuxt-link'] = '' + +describe('default.vue', () => { + let wrapper + let mocks + let store + + beforeEach(() => { + mocks = { + $t: jest.fn(), + $env: { + INVITE_REGISTRATION: true + }, + } + store = new Vuex.Store({ + getters: {}, + }) + }) + + describe('shallow mount', () => { + const Wrapper = () => { + return shallowMount(Default, { + store, + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.layout-default')).toBe(true) + }) + }) +}) From bf4846faadf9919c3cfc63ad1a1f3994d4ceae9f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 00:35:17 +0200 Subject: [PATCH 087/181] coverage donations.spec.js --- webapp/pages/admin/donations.spec.js | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 webapp/pages/admin/donations.spec.js diff --git a/webapp/pages/admin/donations.spec.js b/webapp/pages/admin/donations.spec.js new file mode 100644 index 000000000..2bc219dce --- /dev/null +++ b/webapp/pages/admin/donations.spec.js @@ -0,0 +1,32 @@ +import { mount } from '@vue/test-utils' +import Donations from './donations.vue' + +const localVue = global.localVue + +describe('donations.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Donations, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From 07c9110693af2a7873e4361367a3e336c300dd18 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 00:35:26 +0200 Subject: [PATCH 088/181] coverage hashtags.spec.js --- webapp/pages/admin/hashtags.spec.js | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 webapp/pages/admin/hashtags.spec.js diff --git a/webapp/pages/admin/hashtags.spec.js b/webapp/pages/admin/hashtags.spec.js new file mode 100644 index 000000000..cd2d308d1 --- /dev/null +++ b/webapp/pages/admin/hashtags.spec.js @@ -0,0 +1,32 @@ +import { mount } from '@vue/test-utils' +import Hashtags from './hashtags.vue' + +const localVue = global.localVue + +describe('hashtags.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Hashtags, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From b99fbebd820ba853947d3b4b7b1d33774f5e3c6d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 00:35:45 +0200 Subject: [PATCH 089/181] coverage invite.spec.js --- webapp/pages/admin/invite.spec.js | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 webapp/pages/admin/invite.spec.js diff --git a/webapp/pages/admin/invite.spec.js b/webapp/pages/admin/invite.spec.js new file mode 100644 index 000000000..196f8fdc4 --- /dev/null +++ b/webapp/pages/admin/invite.spec.js @@ -0,0 +1,35 @@ +import { mount } from '@vue/test-utils' +import Invite from './invite.vue' + +const localVue = global.localVue + +describe('invite.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + $apollo: { + loading: false, + } + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Invite, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.ds-section')).toBe(true) + }) + }) +}) From 662de165ca345153baf89036ffad59b7f0f7dce2 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 00:35:54 +0200 Subject: [PATCH 090/181] coverage notifications.spec.js --- webapp/pages/admin/notifications.spec.js | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 webapp/pages/admin/notifications.spec.js diff --git a/webapp/pages/admin/notifications.spec.js b/webapp/pages/admin/notifications.spec.js new file mode 100644 index 000000000..8c2382ccf --- /dev/null +++ b/webapp/pages/admin/notifications.spec.js @@ -0,0 +1,35 @@ +import { mount } from '@vue/test-utils' +import Notifications from './notifications.vue' + +const localVue = global.localVue + +describe('notifications.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + $apollo: { + loading: false, + } + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Notifications, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From 4fc504ce8ad381fb8a83110cd41b45b90a9d7c98 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 00:36:02 +0200 Subject: [PATCH 091/181] coverage organizations.spec.js --- webapp/pages/admin/organizations.spec.js | 35 ++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 webapp/pages/admin/organizations.spec.js diff --git a/webapp/pages/admin/organizations.spec.js b/webapp/pages/admin/organizations.spec.js new file mode 100644 index 000000000..4798257de --- /dev/null +++ b/webapp/pages/admin/organizations.spec.js @@ -0,0 +1,35 @@ +import { mount } from '@vue/test-utils' +import Organizations from './organizations.vue' + +const localVue = global.localVue + +describe('organizations.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + $apollo: { + loading: false, + } + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Organizations, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From f6075bc261e9effc18acafcde4d50b01fdfb9fec Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 00:36:10 +0200 Subject: [PATCH 092/181] coverage pages.spec.js --- webapp/pages/admin/pages.spec.js | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 webapp/pages/admin/pages.spec.js diff --git a/webapp/pages/admin/pages.spec.js b/webapp/pages/admin/pages.spec.js new file mode 100644 index 000000000..1a0a6d46b --- /dev/null +++ b/webapp/pages/admin/pages.spec.js @@ -0,0 +1,35 @@ +import { mount } from '@vue/test-utils' +import Pages from './pages.vue' + +const localVue = global.localVue + +describe('pages.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + $apollo: { + loading: false, + } + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Pages, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From fc3e404ded2ea723e2d948c91d7b4d2277d38c67 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 00:36:22 +0200 Subject: [PATCH 093/181] coverage settings.spec.js --- webapp/pages/admin/settings.spec.js | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 webapp/pages/admin/settings.spec.js diff --git a/webapp/pages/admin/settings.spec.js b/webapp/pages/admin/settings.spec.js new file mode 100644 index 000000000..417c6678c --- /dev/null +++ b/webapp/pages/admin/settings.spec.js @@ -0,0 +1,35 @@ +import { mount } from '@vue/test-utils' +import Settings from './settings.vue' + +const localVue = global.localVue + +describe('settings.vue', () => { + let wrapper + let mocks + + beforeEach(() => { + mocks = { + $t: jest.fn(), + $apollo: { + loading: false, + } + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(Settings, { + mocks, + localVue, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('.base-card')).toBe(true) + }) + }) +}) From 002c9f57860940649b02deef2b802ec2bae8287d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 00:36:32 +0200 Subject: [PATCH 094/181] head test search-results.spec.js --- webapp/pages/search/search-results.spec.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/webapp/pages/search/search-results.spec.js b/webapp/pages/search/search-results.spec.js index d1fbb33e2..8a7767374 100644 --- a/webapp/pages/search/search-results.spec.js +++ b/webapp/pages/search/search-results.spec.js @@ -1,7 +1,10 @@ import { config, mount } from '@vue/test-utils' import searchResults from './search-results.vue' +import VueMeta from 'vue-meta' const localVue = global.localVue +localVue.use(VueMeta, { keyName: 'head' }) + config.stubs['client-only'] = '' describe('search-results.vue', () => { @@ -10,7 +13,7 @@ describe('search-results.vue', () => { beforeEach(() => { mocks = { - $t: jest.fn(), + $t: (t) => t, } }) @@ -26,5 +29,9 @@ describe('search-results.vue', () => { it('renders', () => { expect(wrapper.findAll('.search-results')).toHaveLength(1) }) + + it('has correct content', () => { + expect(wrapper.vm.$metaInfo.title).toBe('search.title') + }) }) }) From a71e864049afe39513d4dda0f6a96f8b49dc1158 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 01:52:04 +0200 Subject: [PATCH 095/181] asyncData test post/edit/_id.spec.js --- webapp/pages/post/edit/_id.spec.js | 73 ++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 9 deletions(-) diff --git a/webapp/pages/post/edit/_id.spec.js b/webapp/pages/post/edit/_id.spec.js index 44cdf9a11..d5c4f8fa0 100644 --- a/webapp/pages/post/edit/_id.spec.js +++ b/webapp/pages/post/edit/_id.spec.js @@ -1,3 +1,4 @@ +import Vuex from 'vuex' import { mount } from '@vue/test-utils' import _id from './_id.vue' @@ -6,24 +7,78 @@ const localVue = global.localVue describe('post/_id.vue', () => { let wrapper let mocks + let store + let asyncData + let error + let userId + let authorId beforeEach(() => { - mocks = { - $t: jest.fn(), - } + asyncData = false + error = jest.fn() }) describe('mount', () => { - const Wrapper = () => { - return mount(_id, { mocks, localVue }) + const Wrapper = async () => { + mocks = { + $t: jest.fn(), + $i18n: { + locale: () => 'en', + }, + apolloProvider: { + defaultClient: { + query: jest.fn().mockResolvedValue({ + data: { + Post: [ + { author: { id: authorId } } + ] + } + }), + }, + }, + } + store = new Vuex.Store({ + getters: { + 'auth/user': () => { + return { id: userId } + }, + }, + }) + if (asyncData) { + const data = _id.data ? _id.data() : {} + const aData = await _id.asyncData({ + app: mocks, + store, + error, + params: { id: '123' }, + }) + _id.data = function() { + return { ...data, ...aData}; + }; + } + return mount(_id, { store, mocks, localVue }) } - beforeEach(() => { - wrapper = Wrapper() + it('renders', async () => { + asyncData = false + wrapper = await Wrapper() + expect(wrapper.findAll('.contribution-form')).toHaveLength(1) }) - it('renders', () => { - expect(wrapper.findAll('.contribution-form')).toHaveLength(1) + it('renders with asyncData of different users', async () => { + asyncData = true + authorId = 'some-author' + userId = 'some-user' + wrapper = await Wrapper() + expect(error).toBeCalledWith({"message": "error-pages.cannot-edit-post", "statusCode": 403}) + }) + + it('renders with asyncData of same user', async () => { + asyncData = true + authorId = 'some-author' + userId = 'some-author' + wrapper = await Wrapper() + expect(error).not.toHaveBeenCalled() }) }) }) From 5ffad4056bcce0914c7d38f55c31538e9fcf641d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 02:20:39 +0200 Subject: [PATCH 096/181] coverage login.spec.js --- webapp/pages/login.spec.js | 77 ++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 33 deletions(-) diff --git a/webapp/pages/login.spec.js b/webapp/pages/login.spec.js index 5a64b1280..b2946df43 100644 --- a/webapp/pages/login.spec.js +++ b/webapp/pages/login.spec.js @@ -1,5 +1,5 @@ -import { config, mount } from '@vue/test-utils' import Vuex from 'vuex' +import { config, mount } from '@vue/test-utils' import login from './login.vue' const localVue = global.localVue @@ -12,47 +12,46 @@ describe('Login.vue', () => { let store let mocks let wrapper + let asyncData + let tosVersion + let redirect + beforeEach(() => { mutations = { // 'posts/SELECT_ORDER': jest.fn(), } - store = new Vuex.Store({ - getters: { - /* 'posts/filter': () => ({}), - 'posts/orderOptions': () => () => [ - { - key: 'store.posts.orderBy.oldest.label', - label: 'store.posts.orderBy.oldest.label', - icon: 'sort-amount-asc', - value: 'createdAt_asc', - }, - { - key: 'store.posts.orderBy.newest.label', - label: 'store.posts.orderBy.newest.label', - icon: 'sort-amount-desc', - value: 'createdAt_desc', - }, - ], - 'posts/selectedOrder': () => () => 'createdAt_desc', - 'posts/orderIcon': () => 'sort-amount-desc', - 'posts/orderBy': () => 'createdAt_desc', - 'auth/user': () => { - return { id: 'u23' } - }, */ - }, - mutations, - }) mocks = { $t: jest.fn(), $i18n: { locale: () => 'en', }, } + asyncData = false + tosVersion = '0.0.0' + redirect = jest.fn() }) describe('mount', () => { - const Wrapper = () => { + const Wrapper = async () => { + store = new Vuex.Store({ + getters: { + 'auth/user': () => { + return { termsAndConditionsAgreedVersion: tosVersion } + }, + }, + mutations, + }) + if (asyncData) { + const data = login.data ? login.data() : {} + const aData = await login.asyncData({ + store, + redirect + }) + login.data = function() { + return { ...data, ...aData}; + }; + } return mount(login, { store, mocks, @@ -60,12 +59,24 @@ describe('Login.vue', () => { }) } - beforeEach(() => { - wrapper = Wrapper() - }) - - it('renders', () => { + it('renders', async () => { + wrapper = await Wrapper() expect(wrapper.findAll('.login-form')).toHaveLength(1) }) + + it('renders with asyncData and wrong TOS Version', async () => { + asyncData = true + wrapper = await Wrapper() + expect(redirect).not.toHaveBeenCalled() + }) + + it('renders with asyncData and correct TOS Version', async () => { + asyncData = true + tosVersion = '0.0.4' + wrapper = await Wrapper() + expect(redirect).toBeCalledWith('/') + }) + + }) }) From c6fd7057482a843b6245ed0bd4fd1498c4d7717e Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 02:20:50 +0200 Subject: [PATCH 097/181] coverage password-reset.spec.js --- webapp/pages/password-reset.spec.js | 46 +++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/webapp/pages/password-reset.spec.js b/webapp/pages/password-reset.spec.js index 416495910..f96216725 100644 --- a/webapp/pages/password-reset.spec.js +++ b/webapp/pages/password-reset.spec.js @@ -1,3 +1,4 @@ +import Vuex from 'vuex' import { config, mount } from '@vue/test-utils' import PasswordReset from './password-reset.vue' @@ -9,6 +10,11 @@ config.stubs['nuxt-child'] = '' describe('password-reset.vue', () => { let wrapper let mocks + let asyncData + let store + let redirect + let isLoggedIn + beforeEach(() => { mocks = { @@ -17,22 +23,50 @@ describe('password-reset.vue', () => { locale: () => 'en', }, } + asyncData = false + isLoggedIn = false + redirect = jest.fn() }) - describe('mount', () => { - const Wrapper = () => { + describe('mount', () => { + const Wrapper = async () => { + store = new Vuex.Store({ + getters: { + 'auth/isLoggedIn': () => isLoggedIn, + }, + }) + if (asyncData) { + const data = PasswordReset.data ? PasswordReset.data() : {} + const aData = await PasswordReset.asyncData({ + store, + redirect + }) + PasswordReset.data = function() { + return { ...data, ...aData}; + }; + } return mount(PasswordReset, { mocks, localVue, }) } - beforeEach(() => { - wrapper = Wrapper() + it('renders', async () => { + wrapper = await Wrapper() + expect(wrapper.is('div')).toBe(true) }) - it('renders', () => { - expect(wrapper.is('div')).toBe(true) + it('renders with asyncData and not loggedIn', async () => { + asyncData = true + wrapper = await Wrapper() + expect(redirect).not.toHaveBeenCalled() + }) + + it('renders with asyncData and loggedIn', async () => { + asyncData = true + isLoggedIn = true + wrapper = await Wrapper() + expect(redirect).toBeCalledWith('/') }) }) }) From 8a53bda51cf18aa5bc7713128a1f1f1076d33c9f Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 02:21:50 +0200 Subject: [PATCH 098/181] lint fixes --- webapp/layouts/basic.spec.js | 2 +- webapp/layouts/blank.spec.js | 2 +- webapp/layouts/default.spec.js | 4 ++-- webapp/pages/admin/invite.spec.js | 2 +- webapp/pages/admin/notifications.spec.js | 2 +- webapp/pages/admin/organizations.spec.js | 2 +- webapp/pages/admin/pages.spec.js | 2 +- webapp/pages/admin/settings.spec.js | 2 +- webapp/pages/login.spec.js | 11 ++++------- webapp/pages/password-reset.spec.js | 11 +++++------ webapp/pages/post/edit/_id.spec.js | 14 ++++++-------- 11 files changed, 24 insertions(+), 30 deletions(-) diff --git a/webapp/layouts/basic.spec.js b/webapp/layouts/basic.spec.js index 471facddd..5094a970b 100644 --- a/webapp/layouts/basic.spec.js +++ b/webapp/layouts/basic.spec.js @@ -3,7 +3,7 @@ import Basic from './basic.vue' const localVue = global.localVue -config.stubs['nuxt'] = '' +config.stubs.nuxt = '' describe('basic.vue', () => { let wrapper diff --git a/webapp/layouts/blank.spec.js b/webapp/layouts/blank.spec.js index dca11486a..a3ea3120c 100644 --- a/webapp/layouts/blank.spec.js +++ b/webapp/layouts/blank.spec.js @@ -3,7 +3,7 @@ import Blank from './blank.vue' const localVue = global.localVue -config.stubs['nuxt'] = '' +config.stubs.nuxt = '' describe('blank.vue', () => { let wrapper diff --git a/webapp/layouts/default.spec.js b/webapp/layouts/default.spec.js index 13933d821..170a00d97 100644 --- a/webapp/layouts/default.spec.js +++ b/webapp/layouts/default.spec.js @@ -4,7 +4,7 @@ import Default from './default.vue' const localVue = global.localVue -config.stubs['nuxt'] = '' +config.stubs.nuxt = '' config.stubs['client-only'] = '' config.stubs['nuxt-link'] = '' @@ -17,7 +17,7 @@ describe('default.vue', () => { mocks = { $t: jest.fn(), $env: { - INVITE_REGISTRATION: true + INVITE_REGISTRATION: true, }, } store = new Vuex.Store({ diff --git a/webapp/pages/admin/invite.spec.js b/webapp/pages/admin/invite.spec.js index 196f8fdc4..e3e882119 100644 --- a/webapp/pages/admin/invite.spec.js +++ b/webapp/pages/admin/invite.spec.js @@ -12,7 +12,7 @@ describe('invite.vue', () => { $t: jest.fn(), $apollo: { loading: false, - } + }, } }) diff --git a/webapp/pages/admin/notifications.spec.js b/webapp/pages/admin/notifications.spec.js index 8c2382ccf..c9acf81a6 100644 --- a/webapp/pages/admin/notifications.spec.js +++ b/webapp/pages/admin/notifications.spec.js @@ -12,7 +12,7 @@ describe('notifications.vue', () => { $t: jest.fn(), $apollo: { loading: false, - } + }, } }) diff --git a/webapp/pages/admin/organizations.spec.js b/webapp/pages/admin/organizations.spec.js index 4798257de..d019d9485 100644 --- a/webapp/pages/admin/organizations.spec.js +++ b/webapp/pages/admin/organizations.spec.js @@ -12,7 +12,7 @@ describe('organizations.vue', () => { $t: jest.fn(), $apollo: { loading: false, - } + }, } }) diff --git a/webapp/pages/admin/pages.spec.js b/webapp/pages/admin/pages.spec.js index 1a0a6d46b..e0c3c9fb4 100644 --- a/webapp/pages/admin/pages.spec.js +++ b/webapp/pages/admin/pages.spec.js @@ -12,7 +12,7 @@ describe('pages.vue', () => { $t: jest.fn(), $apollo: { loading: false, - } + }, } }) diff --git a/webapp/pages/admin/settings.spec.js b/webapp/pages/admin/settings.spec.js index 417c6678c..78a5beb94 100644 --- a/webapp/pages/admin/settings.spec.js +++ b/webapp/pages/admin/settings.spec.js @@ -12,7 +12,7 @@ describe('settings.vue', () => { $t: jest.fn(), $apollo: { loading: false, - } + }, } }) diff --git a/webapp/pages/login.spec.js b/webapp/pages/login.spec.js index b2946df43..e79aff65d 100644 --- a/webapp/pages/login.spec.js +++ b/webapp/pages/login.spec.js @@ -16,7 +16,6 @@ describe('Login.vue', () => { let tosVersion let redirect - beforeEach(() => { mutations = { // 'posts/SELECT_ORDER': jest.fn(), @@ -46,11 +45,11 @@ describe('Login.vue', () => { const data = login.data ? login.data() : {} const aData = await login.asyncData({ store, - redirect + redirect, }) - login.data = function() { - return { ...data, ...aData}; - }; + login.data = function () { + return { ...data, ...aData } + } } return mount(login, { store, @@ -76,7 +75,5 @@ describe('Login.vue', () => { wrapper = await Wrapper() expect(redirect).toBeCalledWith('/') }) - - }) }) diff --git a/webapp/pages/password-reset.spec.js b/webapp/pages/password-reset.spec.js index f96216725..01052e89c 100644 --- a/webapp/pages/password-reset.spec.js +++ b/webapp/pages/password-reset.spec.js @@ -15,7 +15,6 @@ describe('password-reset.vue', () => { let redirect let isLoggedIn - beforeEach(() => { mocks = { $t: (t) => t, @@ -28,7 +27,7 @@ describe('password-reset.vue', () => { redirect = jest.fn() }) - describe('mount', () => { + describe('mount', () => { const Wrapper = async () => { store = new Vuex.Store({ getters: { @@ -39,11 +38,11 @@ describe('password-reset.vue', () => { const data = PasswordReset.data ? PasswordReset.data() : {} const aData = await PasswordReset.asyncData({ store, - redirect + redirect, }) - PasswordReset.data = function() { - return { ...data, ...aData}; - }; + PasswordReset.data = function () { + return { ...data, ...aData } + } } return mount(PasswordReset, { mocks, diff --git a/webapp/pages/post/edit/_id.spec.js b/webapp/pages/post/edit/_id.spec.js index d5c4f8fa0..ea8ec61d8 100644 --- a/webapp/pages/post/edit/_id.spec.js +++ b/webapp/pages/post/edit/_id.spec.js @@ -29,10 +29,8 @@ describe('post/_id.vue', () => { defaultClient: { query: jest.fn().mockResolvedValue({ data: { - Post: [ - { author: { id: authorId } } - ] - } + Post: [{ author: { id: authorId } }], + }, }), }, }, @@ -52,9 +50,9 @@ describe('post/_id.vue', () => { error, params: { id: '123' }, }) - _id.data = function() { - return { ...data, ...aData}; - }; + _id.data = function () { + return { ...data, ...aData } + } } return mount(_id, { store, mocks, localVue }) } @@ -70,7 +68,7 @@ describe('post/_id.vue', () => { authorId = 'some-author' userId = 'some-user' wrapper = await Wrapper() - expect(error).toBeCalledWith({"message": "error-pages.cannot-edit-post", "statusCode": 403}) + expect(error).toBeCalledWith({ message: 'error-pages.cannot-edit-post', statusCode: 403 }) }) it('renders with asyncData of same user', async () => { From d3d0fd053d24ecfbbe5728ec310040f26eec1e0d Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 03:57:44 +0200 Subject: [PATCH 099/181] asyncData terms-and-conditions-confirm.spec.js --- .../terms-and-conditions-confirm.spec.js | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/webapp/pages/terms-and-conditions-confirm.spec.js b/webapp/pages/terms-and-conditions-confirm.spec.js index 380b6dbf0..098e73a92 100644 --- a/webapp/pages/terms-and-conditions-confirm.spec.js +++ b/webapp/pages/terms-and-conditions-confirm.spec.js @@ -1,3 +1,4 @@ +import Vuex from 'vuex' import { config, mount } from '@vue/test-utils' import TermsAndConditionsConfirm from './terms-and-conditions-confirm.vue' import VueMeta from 'vue-meta' @@ -10,31 +11,64 @@ config.stubs['nuxt-link'] = '' describe('terms-and-conditions-confirm.vue', () => { let wrapper let mocks + let store + let asyncData + let tosAgree + let redirect beforeEach(() => { mocks = { $t: (t) => t, } + asyncData = false + tosAgree = false + redirect = jest.fn() }) describe('mount', () => { - const Wrapper = () => { + const Wrapper = async () => { + store = new Vuex.Store({ + getters: { + 'auth/termsAndConditionsAgreed': () => tosAgree, + }, + }) + if (asyncData) { + const data = TermsAndConditionsConfirm.data ? TermsAndConditionsConfirm.data() : {} + const aData = await TermsAndConditionsConfirm.asyncData({ + store, + redirect, + }) + TermsAndConditionsConfirm.data = function () { + return { ...data, ...aData } + } + } return mount(TermsAndConditionsConfirm, { mocks, localVue, }) } - beforeEach(() => { - wrapper = Wrapper() - }) - - it('renders', () => { + it('renders', async () => { + wrapper = await Wrapper() expect(wrapper.is('div')).toBe(true) }) - it('has correct content', () => { + it('has correct content', async () => { + wrapper = await Wrapper() expect(wrapper.vm.$metaInfo.title).toBe('termsAndConditions.newTermsAndConditions') }) + + it('renders with asyncData and did not agree to TOS', async () => { + asyncData = true + wrapper = await Wrapper() + expect(redirect).not.toHaveBeenCalled() + }) + + it('renders with asyncData and did agree to TOS', async () => { + asyncData = true + tosAgree = true + wrapper = await Wrapper() + expect(redirect).toBeCalledWith('/') + }) }) }) From 8dbb9907429a7fc8acdbe85b718909b0d0c1d94a Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 03:57:53 +0200 Subject: [PATCH 100/181] asyncData search-results.spec.js --- webapp/pages/search/search-results.spec.js | 38 ++++++++++++++++++---- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/webapp/pages/search/search-results.spec.js b/webapp/pages/search/search-results.spec.js index 8a7767374..c594f3e56 100644 --- a/webapp/pages/search/search-results.spec.js +++ b/webapp/pages/search/search-results.spec.js @@ -10,28 +10,52 @@ config.stubs['client-only'] = '' describe('search-results.vue', () => { let wrapper let mocks + let asyncData + let query beforeEach(() => { mocks = { $t: (t) => t, } + asyncData = false + query = {} }) describe('mount', () => { - const Wrapper = () => { + const Wrapper = async () => { + if (asyncData) { + const data = searchResults.data ? searchResults.data() : {} + const aData = await searchResults.asyncData({ + query, + }) + searchResults.data = function () { + return { ...data, ...aData } + } + } return mount(searchResults, { mocks, localVue }) } - beforeEach(() => { - wrapper = Wrapper() - }) - - it('renders', () => { + it('renders', async () => { + wrapper = await Wrapper() expect(wrapper.findAll('.search-results')).toHaveLength(1) }) - it('has correct content', () => { + it('has correct content', async () => { + wrapper = await Wrapper() expect(wrapper.vm.$metaInfo.title).toBe('search.title') }) + + it('renders with asyncData and no query', async () => { + asyncData = true + wrapper = await Wrapper() + expect(wrapper.vm.search).toBe(null) + }) + + it('renders with asyncData and query', async () => { + asyncData = true + query = { search: 'hello' } + wrapper = await Wrapper() + expect(wrapper.vm.search).toBe('hello') + }) }) }) From 0a6d8046e71168e2917169dd26047268dc560c7c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 03:58:01 +0200 Subject: [PATCH 101/181] asyncData registration.spec.js --- webapp/pages/registration.spec.js | 140 +++++++++++++++++++++--------- 1 file changed, 98 insertions(+), 42 deletions(-) diff --git a/webapp/pages/registration.spec.js b/webapp/pages/registration.spec.js index b83cb6ad4..60fa69901 100644 --- a/webapp/pages/registration.spec.js +++ b/webapp/pages/registration.spec.js @@ -1,3 +1,4 @@ +import Vuex from 'vuex' import { config, mount } from '@vue/test-utils' import Registration from './registration.vue' import Vue from 'vue' @@ -13,6 +14,10 @@ describe('Registration', () => { let wrapper let Wrapper let mocks + let asyncData + let store + let redirect + let isLoggedIn beforeEach(() => { mocks = { @@ -25,10 +30,42 @@ describe('Registration', () => { }, $env: {}, } + asyncData = false + isLoggedIn = false + redirect = jest.fn() }) describe('mount', () => { - Wrapper = () => { + Wrapper = async () => { + if (asyncData) { + store = new Vuex.Store({ + getters: { + 'auth/isLoggedIn': () => isLoggedIn, + }, + }) + const data = { + method: mocks, + overwriteSliderData: { + collectedInputData: { + inviteCode: null, + email: null, + emailSend: !!null, + nonce: null, + }, + }, + publicRegistration: false, + inviteRegistration: false, + } + const aData = await Registration.asyncData({ + store, + redirect, + }) + Registration.data = function () { + return { ...data, ...aData } + } + } else { + Registration.data = Registration.backupData ? Registration.backupData : Registration.data + } return mount(Registration, { mocks, localVue, @@ -43,29 +80,29 @@ describe('Registration', () => { } }) - it('no "method" query in URI show "RegistrationSlideNoPublic"', () => { + it('no "method" query in URI show "RegistrationSlideNoPublic"', async () => { mocks.$route.query = {} - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.hc-empty').exists()).toBe(true) expect(wrapper.find('.enter-invite').exists()).toBe(false) expect(wrapper.find('.enter-email').exists()).toBe(false) }) describe('"method=invite-mail" in URI show "RegistrationSlideNonce"', () => { - it('no "email" query in URI', () => { + it('no "email" query in URI', async () => { mocks.$route.query = { method: 'invite-mail' } - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-nonce').exists()).toBe(true) }) describe('"email=user%40example.org" query in URI', () => { - it('have email displayed', () => { + it('have email displayed', async () => { mocks.$route.query = { method: 'invite-mail', email: 'user@example.org' } - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-nonce').text()).toContain('user@example.org') }) - it('"nonce=64835" query in URI have nonce in input', async () => { + it.skip('"nonce=64835" query in URI have nonce in input', async () => { mocks.$route.query = { method: 'invite-mail', email: 'user@example.org', @@ -80,15 +117,15 @@ describe('Registration', () => { }) describe('"method=invite-code" in URI show "RegistrationSlideNoPublic"', () => { - it('no "inviteCode" query in URI', () => { + it('no "inviteCode" query in URI', async () => { mocks.$route.query = { method: 'invite-code' } - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.hc-empty').exists()).toBe(true) }) - it('"inviteCode=AAAAAA" query in URI', () => { + it('"inviteCode=AAAAAA" query in URI', async () => { mocks.$route.query = { method: 'invite-code', inviteCode: 'AAAAAA' } - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.hc-empty').exists()).toBe(true) }) }) @@ -102,28 +139,28 @@ describe('Registration', () => { } }) - it('no "method" query in URI show "RegistrationSlideInvite"', () => { + it('no "method" query in URI show "RegistrationSlideInvite"', async () => { mocks.$route.query = {} - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-invite').exists()).toBe(true) expect(wrapper.find('.enter-email').exists()).toBe(false) }) describe('"method=invite-mail" in URI show "RegistrationSlideNonce"', () => { - it('no "inviteCode" query in URI', () => { + it('no "inviteCode" query in URI', async () => { mocks.$route.query = { method: 'invite-mail' } - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-nonce').exists()).toBe(true) }) describe('"email=user%40example.org" query in URI', () => { - it('have email displayed', () => { + it('have email displayed', async () => { mocks.$route.query = { method: 'invite-mail', email: 'user@example.org' } - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-nonce').text()).toContain('user@example.org') }) - it('"nonce=64835" query in URI have nonce in input', async () => { + it.skip('"nonce=64835" query in URI have nonce in input', async () => { mocks.$route.query = { method: 'invite-mail', email: 'user@example.org', @@ -138,13 +175,13 @@ describe('Registration', () => { }) describe('"method=invite-code" in URI show "RegistrationSlideInvite"', () => { - it('no "inviteCode" query in URI', () => { + it('no "inviteCode" query in URI', async () => { mocks.$route.query = { method: 'invite-code' } - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-invite').exists()).toBe(true) }) - it('"inviteCode=AAAAAA" query in URI have invite code in input', async () => { + it.skip('"inviteCode=AAAAAA" query in URI have invite code in input', async () => { mocks.$route.query = { method: 'invite-code', inviteCode: 'AAAAAA' } wrapper = Wrapper() await Vue.nextTick() @@ -162,28 +199,28 @@ describe('Registration', () => { } }) - it('no "method" query in URI show "RegistrationSlideEmail"', () => { + it('no "method" query in URI show "RegistrationSlideEmail"', async () => { mocks.$route.query = {} - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-email').exists()).toBe(true) expect(wrapper.find('.enter-invite').exists()).toBe(false) }) describe('"method=invite-mail" in URI show "RegistrationSlideNonce"', () => { - it('no "inviteCode" query in URI', () => { + it('no "inviteCode" query in URI', async () => { mocks.$route.query = { method: 'invite-mail' } - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-nonce').exists()).toBe(true) }) describe('"email=user%40example.org" query in URI', () => { - it('have email displayed', () => { + it('have email displayed', async () => { mocks.$route.query = { method: 'invite-mail', email: 'user@example.org' } - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-nonce').text()).toContain('user@example.org') }) - it('"nonce=64835" query in URI have nonce in input', async () => { + it.skip('"nonce=64835" query in URI have nonce in input', async () => { mocks.$route.query = { method: 'invite-mail', email: 'user@example.org', @@ -198,9 +235,9 @@ describe('Registration', () => { }) describe('"method=invite-code" in URI show "RegistrationSlideEmail"', () => { - it('no "inviteCode" query in URI', () => { + it('no "inviteCode" query in URI', async () => { mocks.$route.query = { method: 'invite-code' } - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-email').exists()).toBe(true) expect(wrapper.find('.enter-invite').exists()).toBe(false) }) @@ -215,28 +252,28 @@ describe('Registration', () => { } }) - it('no "method" query in URI show "RegistrationSlideEmail"', () => { + it('no "method" query in URI show "RegistrationSlideEmail"', async () => { mocks.$route.query = {} - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-email').exists()).toBe(true) expect(wrapper.find('.enter-invite').exists()).toBe(false) }) describe('"method=invite-mail" in URI show "RegistrationSlideNonce"', () => { - it('no "inviteCode" query in URI', () => { + it('no "inviteCode" query in URI', async () => { mocks.$route.query = { method: 'invite-mail' } - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-nonce').exists()).toBe(true) }) describe('"email=user%40example.org" query in URI', () => { - it('have email displayed', () => { + it('have email displayed', async () => { mocks.$route.query = { method: 'invite-mail', email: 'user@example.org' } - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-nonce').text()).toContain('user@example.org') }) - it('"nonce=64835" query in URI have nonce in input', async () => { + it.skip('"nonce=64835" query in URI have nonce in input', async () => { mocks.$route.query = { method: 'invite-mail', email: 'user@example.org', @@ -251,15 +288,15 @@ describe('Registration', () => { }) describe('"method=invite-code" in URI show "RegistrationSlideInvite"', () => { - it('no "inviteCode" query in URI', () => { + it('no "inviteCode" query in URI', async () => { mocks.$route.query = { method: 'invite-code' } - wrapper = Wrapper() + wrapper = await Wrapper() expect(wrapper.find('.enter-invite').exists()).toBe(true) }) - it('"inviteCode=AAAAAA" query in URI have invite code in input', async () => { + it.skip('"inviteCode=AAAAAA" query in URI have invite code in input', async () => { mocks.$route.query = { method: 'invite-code', inviteCode: 'AAAAAA' } - wrapper = Wrapper() + wrapper = await Wrapper() await Vue.nextTick() const form = wrapper.find('.enter-invite') expect(form.vm.formData.inviteCode).toEqual('AAAAAA') @@ -267,6 +304,25 @@ describe('Registration', () => { }) }) + it('renders', async () => { + wrapper = await Wrapper() + expect(wrapper.is('.login-form')).toBe(true) + }) + + // The asyncTests must go last + it('renders with asyncData and not loggedIn', async () => { + asyncData = true + wrapper = await Wrapper() + expect(redirect).not.toHaveBeenCalled() + }) + + it('renders with asyncData and loggedIn', async () => { + asyncData = true + isLoggedIn = true + wrapper = await Wrapper() + expect(redirect).toBeCalledWith('/') + }) + // copied from webapp/components/Registration/Signup.spec.js as testing template // describe('with invitation code', () => { // let action From b0739fcc69f10b64daa2859b1866c158245f8d41 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 04:00:15 +0200 Subject: [PATCH 102/181] don't skip nonce & invite code tests for registration.spec.js --- webapp/pages/registration.spec.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/webapp/pages/registration.spec.js b/webapp/pages/registration.spec.js index 60fa69901..7361b6164 100644 --- a/webapp/pages/registration.spec.js +++ b/webapp/pages/registration.spec.js @@ -102,7 +102,7 @@ describe('Registration', () => { expect(wrapper.find('.enter-nonce').text()).toContain('user@example.org') }) - it.skip('"nonce=64835" query in URI have nonce in input', async () => { + it('"nonce=64835" query in URI have nonce in input', async () => { mocks.$route.query = { method: 'invite-mail', email: 'user@example.org', @@ -160,7 +160,7 @@ describe('Registration', () => { expect(wrapper.find('.enter-nonce').text()).toContain('user@example.org') }) - it.skip('"nonce=64835" query in URI have nonce in input', async () => { + it('"nonce=64835" query in URI have nonce in input', async () => { mocks.$route.query = { method: 'invite-mail', email: 'user@example.org', @@ -181,7 +181,7 @@ describe('Registration', () => { expect(wrapper.find('.enter-invite').exists()).toBe(true) }) - it.skip('"inviteCode=AAAAAA" query in URI have invite code in input', async () => { + it('"inviteCode=AAAAAA" query in URI have invite code in input', async () => { mocks.$route.query = { method: 'invite-code', inviteCode: 'AAAAAA' } wrapper = Wrapper() await Vue.nextTick() @@ -220,7 +220,7 @@ describe('Registration', () => { expect(wrapper.find('.enter-nonce').text()).toContain('user@example.org') }) - it.skip('"nonce=64835" query in URI have nonce in input', async () => { + it('"nonce=64835" query in URI have nonce in input', async () => { mocks.$route.query = { method: 'invite-mail', email: 'user@example.org', @@ -273,7 +273,7 @@ describe('Registration', () => { expect(wrapper.find('.enter-nonce').text()).toContain('user@example.org') }) - it.skip('"nonce=64835" query in URI have nonce in input', async () => { + it('"nonce=64835" query in URI have nonce in input', async () => { mocks.$route.query = { method: 'invite-mail', email: 'user@example.org', @@ -294,7 +294,7 @@ describe('Registration', () => { expect(wrapper.find('.enter-invite').exists()).toBe(true) }) - it.skip('"inviteCode=AAAAAA" query in URI have invite code in input', async () => { + it('"inviteCode=AAAAAA" query in URI have invite code in input', async () => { mocks.$route.query = { method: 'invite-code', inviteCode: 'AAAAAA' } wrapper = await Wrapper() await Vue.nextTick() From abecd0b3282c2b3c8311e5c6d6158ca95b6aea50 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 04:47:27 +0200 Subject: [PATCH 103/181] asny fixes registration.spec.js --- webapp/pages/registration.spec.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/webapp/pages/registration.spec.js b/webapp/pages/registration.spec.js index 7361b6164..74fb7d710 100644 --- a/webapp/pages/registration.spec.js +++ b/webapp/pages/registration.spec.js @@ -108,7 +108,7 @@ describe('Registration', () => { email: 'user@example.org', nonce: '64835', } - wrapper = Wrapper() + wrapper = await Wrapper() await Vue.nextTick() const form = wrapper.find('.enter-nonce') expect(form.vm.formData.nonce).toEqual('64835') @@ -166,7 +166,7 @@ describe('Registration', () => { email: 'user@example.org', nonce: '64835', } - wrapper = Wrapper() + wrapper = await Wrapper() await Vue.nextTick() const form = wrapper.find('.enter-nonce') expect(form.vm.formData.nonce).toEqual('64835') @@ -183,7 +183,7 @@ describe('Registration', () => { it('"inviteCode=AAAAAA" query in URI have invite code in input', async () => { mocks.$route.query = { method: 'invite-code', inviteCode: 'AAAAAA' } - wrapper = Wrapper() + wrapper = await Wrapper() await Vue.nextTick() const form = wrapper.find('.enter-invite') expect(form.vm.formData.inviteCode).toEqual('AAAAAA') @@ -226,7 +226,7 @@ describe('Registration', () => { email: 'user@example.org', nonce: '64835', } - wrapper = Wrapper() + wrapper = await Wrapper() await Vue.nextTick() const form = wrapper.find('.enter-nonce') expect(form.vm.formData.nonce).toEqual('64835') @@ -279,7 +279,7 @@ describe('Registration', () => { email: 'user@example.org', nonce: '64835', } - wrapper = Wrapper() + wrapper = await Wrapper() await Vue.nextTick() const form = wrapper.find('.enter-nonce') expect(form.vm.formData.nonce).toEqual('64835') From b689181bf55708444b7677687706c9b719835a91 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 06:12:45 +0200 Subject: [PATCH 104/181] coverage ComponentSlider.spec.js --- .../ComponentSlider/ComponentSlider.spec.js | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 webapp/components/ComponentSlider/ComponentSlider.spec.js diff --git a/webapp/components/ComponentSlider/ComponentSlider.spec.js b/webapp/components/ComponentSlider/ComponentSlider.spec.js new file mode 100644 index 000000000..199531a89 --- /dev/null +++ b/webapp/components/ComponentSlider/ComponentSlider.spec.js @@ -0,0 +1,66 @@ +import { config, mount } from '@vue/test-utils' +import ComponentSlider from './ComponentSlider.vue' + +config.stubs['nuxt-child'] = '' + +const localVue = global.localVue + +describe('ComponentSlider.vue', () => { + let wrapper + let mocks + let propsData + + beforeEach(() => { + mocks = { + $t: jest.fn(), + } + propsData = { + sliderData: { + sliderIndex: 0, + sliderSelectorCallback: jest.fn().mockResolvedValue(true), + sliders: [ + { + validated: true, + button: { + icon: "smile", + callback: jest.fn().mockResolvedValue(true), + sliderCallback: jest.fn().mockResolvedValue(true), + } + }, + { + validated: true, + button: { + icon: "smile", + callback: jest.fn().mockResolvedValue(true), + sliderCallback: jest.fn().mockResolvedValue(true), + } + } + ] + } + } + }) + + describe('mount', () => { + const Wrapper = () => { + return mount(ComponentSlider, { + mocks, + localVue, + propsData, + }) + } + + beforeEach(() => { + wrapper = Wrapper() + }) + + it('renders', () => { + expect(wrapper.is('div')).toBe(true) + }) + + it('click on next Button', async () => { + await wrapper.find('.base-button[data-test="next-button"]').trigger('click') + await wrapper.vm.$nextTick() + expect(propsData.sliderData.sliderSelectorCallback).toHaveBeenCalled() + }) + }) +}) From e3340760f553090ed6e92fce870b46ffcc51b5ba Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 26 Apr 2021 06:28:34 +0200 Subject: [PATCH 105/181] lint fixes --- .../ComponentSlider/ComponentSlider.spec.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/webapp/components/ComponentSlider/ComponentSlider.spec.js b/webapp/components/ComponentSlider/ComponentSlider.spec.js index 199531a89..10ab991b4 100644 --- a/webapp/components/ComponentSlider/ComponentSlider.spec.js +++ b/webapp/components/ComponentSlider/ComponentSlider.spec.js @@ -22,21 +22,21 @@ describe('ComponentSlider.vue', () => { { validated: true, button: { - icon: "smile", + icon: 'smile', callback: jest.fn().mockResolvedValue(true), sliderCallback: jest.fn().mockResolvedValue(true), - } + }, }, { validated: true, button: { - icon: "smile", + icon: 'smile', callback: jest.fn().mockResolvedValue(true), sliderCallback: jest.fn().mockResolvedValue(true), - } - } - ] - } + }, + }, + ], + }, } }) From 52740d8fc34f0fea4004f8cbfbc5c691e613e680 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 27 Apr 2021 00:44:52 +0200 Subject: [PATCH 106/181] fixed rollback on privacy update fail coverage privacy.spec.js --- webapp/pages/settings/privacy.spec.js | 29 ++++++++++++++++++++++++++- webapp/pages/settings/privacy.vue | 1 + 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/webapp/pages/settings/privacy.spec.js b/webapp/pages/settings/privacy.spec.js index 805677e34..5d1686904 100644 --- a/webapp/pages/settings/privacy.spec.js +++ b/webapp/pages/settings/privacy.spec.js @@ -12,11 +12,21 @@ describe('privacy.vue', () => { beforeEach(() => { mocks = { $t: jest.fn(), + $apollo: { + mutate: jest.fn() + }, + $toast: { + success: jest.fn(), + error: jest.fn(), + }, } store = new Vuex.Store({ getters: { 'auth/user': () => { - return { id: 'u343', name: 'Delete MyAccount', showShoutsPublicly: true } + return { + id: 'u343', + name: 'MyAccount', + showShoutsPublicly: true } }, }, }) @@ -38,5 +48,22 @@ describe('privacy.vue', () => { it('renders', () => { expect(wrapper.is('.base-card')).toBe(true) }) + + it('clicking on submit changes shoutsAllowed to false', async () => { + wrapper.find('#allow-shouts').trigger('click') + await wrapper.vm.$nextTick() + wrapper.find('.base-button').trigger('click') + expect(wrapper.vm.shoutsAllowed).toBe(false) + }) + + it('clicking on submit with a server error shows a toast and shoutsAllowed is still true', async () => { + mocks.$apollo.mutate = jest.fn().mockRejectedValue({ message: 'Ouch!' }) + wrapper.find('#allow-shouts').trigger('click') + await wrapper.vm.$nextTick() + await wrapper.find('.base-button').trigger('click') + await wrapper.vm.$nextTick() + expect(mocks.$toast.error).toHaveBeenCalledWith('Ouch!') + expect(wrapper.vm.shoutsAllowed).toBe(true) + }) }) }) diff --git a/webapp/pages/settings/privacy.vue b/webapp/pages/settings/privacy.vue index 14f27bf8f..71fd31946 100644 --- a/webapp/pages/settings/privacy.vue +++ b/webapp/pages/settings/privacy.vue @@ -52,6 +52,7 @@ export default { }, }) } catch (error) { + this.shoutsAllowed = !this.shoutsAllowed this.$toast.error(error.message) } }, From 0ea3ea04817a8802fb68f98bfe1d02fe63b39d1c Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 27 Apr 2021 11:49:15 +0200 Subject: [PATCH 107/181] lint fix --- webapp/pages/settings/privacy.spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webapp/pages/settings/privacy.spec.js b/webapp/pages/settings/privacy.spec.js index 5d1686904..eb9cb90b3 100644 --- a/webapp/pages/settings/privacy.spec.js +++ b/webapp/pages/settings/privacy.spec.js @@ -13,7 +13,7 @@ describe('privacy.vue', () => { mocks = { $t: jest.fn(), $apollo: { - mutate: jest.fn() + mutate: jest.fn(), }, $toast: { success: jest.fn(), @@ -26,7 +26,8 @@ describe('privacy.vue', () => { return { id: 'u343', name: 'MyAccount', - showShoutsPublicly: true } + showShoutsPublicly: true, + } }, }, }) From 4fac1b805e88f5b9b361af0f354d6839ec3a58a9 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 29 Apr 2021 22:23:03 +0000 Subject: [PATCH 108/181] Upgrade to GitHub-native Dependabot --- .github/dependabot.yml | 179 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 179 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..c5433c921 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,179 @@ +version: 2 +updates: +- package-ecosystem: npm + directory: "/" + schedule: + interval: daily + time: "04:00" + open-pull-requests-limit: 10 + ignore: + - 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 + directory: "/backend" + schedule: + interval: daily + time: "04:00" + open-pull-requests-limit: 10 + ignore: + - 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 + directory: "/webapp" + schedule: + interval: daily + time: "04:00" + open-pull-requests-limit: 10 + ignore: + - 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 + directory: "/backend" + schedule: + interval: daily + time: "04:00" + open-pull-requests-limit: 10 + ignore: + - dependency-name: node + versions: + - ">= 15.4.a, < 15.5" + - 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 + directory: "/neo4j" + schedule: + interval: daily + time: "04:00" + open-pull-requests-limit: 10 + ignore: + - dependency-name: neo4j + versions: + - 4.2.3 + - 4.2.4 +- package-ecosystem: docker + directory: "/deployment/legacy-migration/maintenance-worker" + schedule: + interval: daily + time: "04:00" + open-pull-requests-limit: 10 From 32856dd60f0702041160f6758748e34408f64ccb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 6 May 2021 09:58:37 +0200 Subject: [PATCH 109/181] Suggest a fix and some refinements --- .../components/ComponentSlider/ComponentSlider.spec.js | 4 +--- webapp/components/Hashtag/Hashtag.spec.js | 1 - webapp/components/PageFooter/PageFooter.spec.js | 4 ++++ webapp/layouts/default.spec.js | 9 ++++++++- webapp/pages/login.spec.js | 5 ----- webapp/pages/password-reset/enter-nonce.spec.js | 1 + webapp/pages/password-reset/request.spec.js | 1 + webapp/pages/post/_id.spec.js | 1 + 8 files changed, 16 insertions(+), 10 deletions(-) diff --git a/webapp/components/ComponentSlider/ComponentSlider.spec.js b/webapp/components/ComponentSlider/ComponentSlider.spec.js index 10ab991b4..25bf3e7f4 100644 --- a/webapp/components/ComponentSlider/ComponentSlider.spec.js +++ b/webapp/components/ComponentSlider/ComponentSlider.spec.js @@ -1,8 +1,6 @@ -import { config, mount } from '@vue/test-utils' +import { mount } from '@vue/test-utils' import ComponentSlider from './ComponentSlider.vue' -config.stubs['nuxt-child'] = '' - const localVue = global.localVue describe('ComponentSlider.vue', () => { diff --git a/webapp/components/Hashtag/Hashtag.spec.js b/webapp/components/Hashtag/Hashtag.spec.js index 442f268d5..4a420d7d8 100644 --- a/webapp/components/Hashtag/Hashtag.spec.js +++ b/webapp/components/Hashtag/Hashtag.spec.js @@ -5,7 +5,6 @@ import Hashtag from './Hashtag' const localVue = global.localVue config.stubs['nuxt-link'] = '' -config.stubs['nuxt-child'] = '' describe('Hashtag', () => { let id diff --git a/webapp/components/PageFooter/PageFooter.spec.js b/webapp/components/PageFooter/PageFooter.spec.js index 6a051b020..0edc0fed2 100644 --- a/webapp/components/PageFooter/PageFooter.spec.js +++ b/webapp/components/PageFooter/PageFooter.spec.js @@ -36,5 +36,9 @@ describe('PageFooter.vue', () => { it('renders four nuxt-links', () => { expect(wrapper.findAll('.nuxt-link')).toHaveLength(4) }) + + it('renders version', () => { + expect(wrapper.find('.ds-footer').text()).toContain('v1.0.0') + }) }) }) diff --git a/webapp/layouts/default.spec.js b/webapp/layouts/default.spec.js index 170a00d97..3d465ce76 100644 --- a/webapp/layouts/default.spec.js +++ b/webapp/layouts/default.spec.js @@ -3,6 +3,7 @@ import { config, shallowMount } from '@vue/test-utils' import Default from './default.vue' const localVue = global.localVue +localVue.directive('scrollTo', jest.fn()) config.stubs.nuxt = '' config.stubs['client-only'] = '' @@ -15,13 +16,19 @@ describe('default.vue', () => { beforeEach(() => { mocks = { + $route: { + matched: [{ name: 'index' }], + }, + $scrollTo: jest.fn(), $t: jest.fn(), $env: { INVITE_REGISTRATION: true, }, } store = new Vuex.Store({ - getters: {}, + getters: { + 'auth/isLoggedIn': () => true, + }, }) }) diff --git a/webapp/pages/login.spec.js b/webapp/pages/login.spec.js index e79aff65d..09c1b066e 100644 --- a/webapp/pages/login.spec.js +++ b/webapp/pages/login.spec.js @@ -8,7 +8,6 @@ config.stubs['client-only'] = '' config.stubs['nuxt-link'] = '' describe('Login.vue', () => { - let mutations let store let mocks let wrapper @@ -17,9 +16,6 @@ describe('Login.vue', () => { let redirect beforeEach(() => { - mutations = { - // 'posts/SELECT_ORDER': jest.fn(), - } mocks = { $t: jest.fn(), $i18n: { @@ -39,7 +35,6 @@ describe('Login.vue', () => { return { termsAndConditionsAgreedVersion: tosVersion } }, }, - mutations, }) if (asyncData) { const data = login.data ? login.data() : {} diff --git a/webapp/pages/password-reset/enter-nonce.spec.js b/webapp/pages/password-reset/enter-nonce.spec.js index 42fbaa5a5..664e1f7ca 100644 --- a/webapp/pages/password-reset/enter-nonce.spec.js +++ b/webapp/pages/password-reset/enter-nonce.spec.js @@ -2,6 +2,7 @@ import { config, mount } from '@vue/test-utils' import enterNonce from './enter-nonce.vue' const localVue = global.localVue + config.stubs['nuxt-link'] = '' describe('enter-nonce.vue', () => { diff --git a/webapp/pages/password-reset/request.spec.js b/webapp/pages/password-reset/request.spec.js index 53183a3be..f9bcefd79 100644 --- a/webapp/pages/password-reset/request.spec.js +++ b/webapp/pages/password-reset/request.spec.js @@ -2,6 +2,7 @@ import { config, mount } from '@vue/test-utils' import request from './request.vue' const localVue = global.localVue + // config.stubs['sweetalert-icon'] = '' config.stubs['nuxt-link'] = '' diff --git a/webapp/pages/post/_id.spec.js b/webapp/pages/post/_id.spec.js index 662f85406..7e6812002 100644 --- a/webapp/pages/post/_id.spec.js +++ b/webapp/pages/post/_id.spec.js @@ -2,6 +2,7 @@ import { config, mount } from '@vue/test-utils' import _id from './_id.vue' const localVue = global.localVue + config.stubs['nuxt-child'] = '' describe('post/_id.vue', () => { From 97553f01fda67584a07eac331b8dbcb84e5de187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 11 May 2021 11:26:46 +0200 Subject: [PATCH 110/181] Replace ocelot logos 619x593 with 600x570 like the others --- webapp/static/img/custom/password-reset.svg | 8 ++++---- webapp/static/img/custom/welcome.svg | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/webapp/static/img/custom/password-reset.svg b/webapp/static/img/custom/password-reset.svg index 30d498fbb..f2ace345e 100644 --- a/webapp/static/img/custom/password-reset.svg +++ b/webapp/static/img/custom/password-reset.svg @@ -1,7 +1,7 @@ - - + + @@ -22,7 +22,7 @@ - + @@ -42,7 +42,7 @@ - + diff --git a/webapp/static/img/custom/welcome.svg b/webapp/static/img/custom/welcome.svg index 30d498fbb..f2ace345e 100644 --- a/webapp/static/img/custom/welcome.svg +++ b/webapp/static/img/custom/welcome.svg @@ -1,7 +1,7 @@ - - + + @@ -22,7 +22,7 @@ - + @@ -42,7 +42,7 @@ - + From 60a6ac3c5baa64164c4fddbc5613b8dcec038701 Mon Sep 17 00:00:00 2001 From: Brandon Tripp Date: Mon, 5 Apr 2021 11:53:40 -0600 Subject: [PATCH 111/181] Migration of toggle show password functionality to separate component.' --- .../ShowPassword/ShowPassword.spec.js | 0 .../components/ShowPassword/ShowPassword.vue | 46 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 webapp/components/ShowPassword/ShowPassword.spec.js create mode 100644 webapp/components/ShowPassword/ShowPassword.vue diff --git a/webapp/components/ShowPassword/ShowPassword.spec.js b/webapp/components/ShowPassword/ShowPassword.spec.js new file mode 100644 index 000000000..e69de29bb diff --git a/webapp/components/ShowPassword/ShowPassword.vue b/webapp/components/ShowPassword/ShowPassword.vue new file mode 100644 index 000000000..36d82baeb --- /dev/null +++ b/webapp/components/ShowPassword/ShowPassword.vue @@ -0,0 +1,46 @@ + + + + + + + + + + From 0e763c0ac30add8935f90144c84544ba7020718c Mon Sep 17 00:00:00 2001 From: Brandon Tripp Date: Mon, 5 Apr 2021 11:54:28 -0600 Subject: [PATCH 112/181] Login Form updated to use ShowPassword component. --- webapp/components/LoginForm/LoginForm.vue | 35 ++++------------------- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/webapp/components/LoginForm/LoginForm.vue b/webapp/components/LoginForm/LoginForm.vue index 01c3c8661..ec9dbebf8 100644 --- a/webapp/components/LoginForm/LoginForm.vue +++ b/webapp/components/LoginForm/LoginForm.vue @@ -31,11 +31,7 @@ ref="password" :type="showPassword ? 'text' : 'password'" /> - - - - - + {{ $t('login.forgotPassword') }} @@ -59,10 +55,12 @@ import LocaleSwitch from '~/components/LocaleSwitch/LocaleSwitch' import links from '~/constants/links.js' import metadata from '~/constants/metadata.js' +import ShowPassword from '../ShowPassword/ShowPassword.vue' export default { components: { LocaleSwitch, + ShowPassword }, data() { return { @@ -98,9 +96,8 @@ export default { } } }, - toggleShowPassword(event) { + toggleShowPassword() { this.showPassword = !this.showPassword - event.preventDefault() this.$nextTick(() => { this.$refs.password.$el.children[1].children[1].focus() this.$emit('focus') @@ -114,7 +111,7 @@ export default { .login-form { width: 80vw; max-width: 620px; - margin: auto; + /* margin: auto; */ .base-button { display: block; @@ -145,28 +142,6 @@ export default { outline: none; transition: all $duration-short $ease-out; - .icon-wrapper { - margin-right: 2px; - } - - .click-wrapper { - padding: 8px; - align-content: center; - color: $text-color-disabled; - cursor: pointer; - } - - .click-wrapper:hover { - &:focus-within { - background-color: $background-color-base; - border: $input-border-size solid $border-color-active; - - .toggle-icon { - color: $text-color-base; - } - } - } - &:focus-within { background-color: $background-color-base; border: $input-border-size solid $border-color-active; From cf58064e912fcad78a20049a600fbf6921c3e86e Mon Sep 17 00:00:00 2001 From: Brandon Tripp Date: Wed, 14 Apr 2021 12:48:11 -0600 Subject: [PATCH 113/181] Add tests for ShowPassword component. Lint LoginForm and ShowPassword. --- webapp/components/LoginForm/LoginForm.vue | 4 +- .../ShowPassword/ShowPassword.spec.js | 33 +++++++++++++++ .../components/ShowPassword/ShowPassword.vue | 40 +++++++++---------- 3 files changed, 54 insertions(+), 23 deletions(-) diff --git a/webapp/components/LoginForm/LoginForm.vue b/webapp/components/LoginForm/LoginForm.vue index ec9dbebf8..990a9d042 100644 --- a/webapp/components/LoginForm/LoginForm.vue +++ b/webapp/components/LoginForm/LoginForm.vue @@ -31,7 +31,7 @@ ref="password" :type="showPassword ? 'text' : 'password'" /> - + {{ $t('login.forgotPassword') }} @@ -60,7 +60,7 @@ import ShowPassword from '../ShowPassword/ShowPassword.vue' export default { components: { LocaleSwitch, - ShowPassword + ShowPassword, }, data() { return { diff --git a/webapp/components/ShowPassword/ShowPassword.spec.js b/webapp/components/ShowPassword/ShowPassword.spec.js index e69de29bb..6eb44f6b2 100644 --- a/webapp/components/ShowPassword/ShowPassword.spec.js +++ b/webapp/components/ShowPassword/ShowPassword.spec.js @@ -0,0 +1,33 @@ +import Vue from 'vue' +import { mount } from '@vue/test-utils' + +import ShowPassword from './ShowPassword.vue' + +describe('ShowPassword', () => { + describe('State of show password icon', () => { + const wrapper = mount(ShowPassword, { + propsData: { + iconName: 'eye', + }, + }) + + it('Shows eye icon by default', () => { + expect(wrapper.find('.icon-wrapper').attributes('data-test')).toEqual('eye') + }) + + describe('After click', () => { + it('Password wrapper emits show-password event', async () => { + wrapper.find('.click-wrapper').trigger('click') + await Vue.nextTick() + expect(wrapper.emitted()).toBeTruthy() + }) + + it('Shows the slash-eye icon after click', async () => { + wrapper.find('.click-wrapper').trigger('click') + wrapper.setProps({ iconName: 'eye-slash' }) + await Vue.nextTick() + expect(wrapper.find('.icon-wrapper').attributes('data-test')).toEqual('eye-slash') + }) + }) + }) +}) diff --git a/webapp/components/ShowPassword/ShowPassword.vue b/webapp/components/ShowPassword/ShowPassword.vue index 36d82baeb..c31e01b25 100644 --- a/webapp/components/ShowPassword/ShowPassword.vue +++ b/webapp/components/ShowPassword/ShowPassword.vue @@ -8,39 +8,37 @@ From 588385bf5a254b1e24fa04316930c66161a41cb1 Mon Sep 17 00:00:00 2001 From: Brandon Tripp Date: Sat, 8 May 2021 17:53:16 -0600 Subject: [PATCH 114/181] Implement the ShowPassword component in the registration slider. --- .../Registration/RegistrationSlideCreate.vue | 105 +++++++++++++++--- 1 file changed, 90 insertions(+), 15 deletions(-) diff --git a/webapp/components/Registration/RegistrationSlideCreate.vue b/webapp/components/Registration/RegistrationSlideCreate.vue index 7ac235994..3343876b9 100644 --- a/webapp/components/Registration/RegistrationSlideCreate.vue +++ b/webapp/components/Registration/RegistrationSlideCreate.vue @@ -40,24 +40,33 @@ :label="$t('settings.data.labelName')" :placeholder="$t('settings.data.namePlaceholder')" /> - - + +
+ + +
+ +
+ + +
- { + this.$refs.password.$el.children[1].children[0].focus() + this.$emit('focus') + }) + } + else { + this.showPasswordConfirm = !this.showPasswordConfirm + this.$nextTick(() => { + this.$refs.confirmPassword.$el.children[1].children[0].focus() + this.$emit('focus') + }) + } + }, }, } @@ -259,4 +294,44 @@ export default { .password-strength { margin-bottom: 14px; } + +.password-wrapper { + display: flex; + width: 100%; + align-items: center; + padding: $input-padding-vertical $space-x-small; + padding-left: 0; + padding-right: 0; + height: $input-height; + margin-bottom: 10px; + margin-bottom: 16px; + + color: $text-color-base; + background: $background-color-disabled; + + border: $input-border-size solid $border-color-softer; + border-left: none; + border-radius: $border-radius-base; + outline: none; + transition: all $duration-short $ease-out; + + &:focus-within { + background-color: $background-color-base; + border: $input-border-size solid $border-color-active; + + .toggle-icon { + color: $text-color-base; + } + } + + .password-field { + position: relative; + padding-top: 16px; + border: none; + border-style: none; + appearance: none; + margin-left: 0; + width: 100%; + } +} From 654372f60999db70c5be6ce75311808c43c294c8 Mon Sep 17 00:00:00 2001 From: Brandon Tripp Date: Sat, 8 May 2021 21:11:42 -0600 Subject: [PATCH 115/181] Linting for the component. --- .../Registration/RegistrationSlideCreate.vue | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/webapp/components/Registration/RegistrationSlideCreate.vue b/webapp/components/Registration/RegistrationSlideCreate.vue index 3343876b9..cab0e1cce 100644 --- a/webapp/components/Registration/RegistrationSlideCreate.vue +++ b/webapp/components/Registration/RegistrationSlideCreate.vue @@ -40,7 +40,9 @@ :label="$t('settings.data.labelName')" :placeholder="$t('settings.data.namePlaceholder')" /> - +
- +
- +
- +
@@ -271,14 +281,13 @@ export default { return true }, toggleShowPassword(e) { - if(e === 'password'){ + if (e === 'password') { this.showPassword = !this.showPassword this.$nextTick(() => { this.$refs.password.$el.children[1].children[0].focus() this.$emit('focus') }) - } - else { + } else { this.showPasswordConfirm = !this.showPasswordConfirm this.$nextTick(() => { this.$refs.confirmPassword.$el.children[1].children[0].focus() @@ -332,6 +341,6 @@ export default { appearance: none; margin-left: 0; width: 100%; - } + } } From ff6cc306aff6150a924f1a647387e498d050ea9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 18 May 2021 17:04:24 +0200 Subject: [PATCH 116/181] Refactor logos, first step --- README.md | 2 +- backend/src/config/links.js | 1 + backend/src/config/logos.js | 10 +++ backend/src/config/metadata.js | 2 + .../src/middleware/email/templateBuilder.js | 3 +- webapp/components/LoginForm/LoginForm.vue | 12 ++-- webapp/components/Logo/Logo.vue | 52 ++++++++++++--- .../Registration/RegistrationSlider.vue | 4 +- .../_new/generic/BaseCard/BaseCard.story.js | 5 +- webapp/constants/links.js | 1 + webapp/constants/logos.js | 10 +++ webapp/constants/metadata.js | 3 +- webapp/layouts/basic.vue | 2 +- webapp/layouts/default.vue | 2 +- webapp/maintenance/source/pages/index.vue | 12 +--- webapp/pages/logout.vue | 7 +- webapp/pages/password-reset.vue | 4 +- .../img/custom/Logo-Horizontal-Dark.svg | 48 -------------- webapp/static/img/custom/Logo-Horizontal.svg | 2 +- ...under-maintenance.svg => logo-squared.svg} | 4 +- webapp/static/img/custom/logout.svg | 65 ------------------- webapp/static/img/custom/password-reset.svg | 65 ------------------- webapp/static/img/custom/sign-up.svg | 65 ------------------- webapp/static/img/custom/welcome.svg | 65 ------------------- 24 files changed, 103 insertions(+), 343 deletions(-) create mode 100644 backend/src/config/logos.js create mode 100644 webapp/constants/logos.js delete mode 100644 webapp/static/img/custom/Logo-Horizontal-Dark.svg rename webapp/static/img/custom/{under-maintenance.svg => logo-squared.svg} (98%) delete mode 100644 webapp/static/img/custom/logout.svg delete mode 100644 webapp/static/img/custom/password-reset.svg delete mode 100644 webapp/static/img/custom/sign-up.svg delete mode 100644 webapp/static/img/custom/welcome.svg diff --git a/README.md b/README.md index 9c948e7fb..4e1777c25 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ ocelot.social is a nonprofit social, action and knowledge network that connects * **Action**: Don't just read about how to make the world a better place, but come into **Action** by following provided suggestions on the **Action** tab provided by other people or **Organisations**.

- Ocelot-Social + ocelot.social

## Live demo diff --git a/backend/src/config/links.js b/backend/src/config/links.js index 494e449ba..c6f932c82 100644 --- a/backend/src/config/links.js +++ b/backend/src/config/links.js @@ -1,3 +1,4 @@ +// this file is duplicated in `backend/src/config/links.js` and `webapp/constants/links.js` and replaced on rebranding export default { ORGANIZATION: 'https://ocelot.social', DONATE: 'https://ocelot-social.herokuapp.com/donations', diff --git a/backend/src/config/logos.js b/backend/src/config/logos.js new file mode 100644 index 000000000..d093c7b46 --- /dev/null +++ b/backend/src/config/logos.js @@ -0,0 +1,10 @@ +// this file is duplicated in `backend/src/config/logos.js` and `webapp/constants/logos.js` and replaced on rebranding +// this are the paths in the webapp +export default { + LOGO_HEADER_PATH: '/img/custom/logo-horizontal.svg', + LOGO_SIGNUP_PATH: '/img/custom/logo-squared.svg', + LOGO_WELCOME_PATH: '/img/custom/logo-squared.svg', + LOGO_LOGOUT_PATH: '/img/custom/logo-squared.svg', + LOGO_PASSWORD_RESET_PATH: '/img/custom/logo-squared.svg', + LOGO_MAINTENACE_RESET_PATH: '/img/custom/logo-squared.svg', +} diff --git a/backend/src/config/metadata.js b/backend/src/config/metadata.js index 68d353eea..d40308e80 100644 --- a/backend/src/config/metadata.js +++ b/backend/src/config/metadata.js @@ -1,7 +1,9 @@ +// this file is duplicated in `backend/src/config/metadata.js` and `webapp/constants/metadata.js` and replaced on rebranding export default { APPLICATION_NAME: 'ocelot.social', APPLICATION_SHORT_NAME: 'ocelot', APPLICATION_DESCRIPTION: 'ocelot.social Community Network', + COOKIE_NAME: 'ocelot-social-token', ORGANIZATION_NAME: 'ocelot.social Community', ORGANIZATION_JURISDICTION: 'City of Angels', } diff --git a/backend/src/middleware/email/templateBuilder.js b/backend/src/middleware/email/templateBuilder.js index 2c7038d27..872b86b29 100644 --- a/backend/src/middleware/email/templateBuilder.js +++ b/backend/src/middleware/email/templateBuilder.js @@ -1,10 +1,11 @@ import mustache from 'mustache' import CONFIG from '../../config' +import logosWebapp from '../../config/logos.js' import * as templates from './templates' const from = CONFIG.EMAIL_DEFAULT_SENDER -const welcomeImageUrl = new URL(`/img/custom/welcome.svg`, CONFIG.CLIENT_URI) +const welcomeImageUrl = new URL(logosWebapp.LOGO_WELCOME_PATH, CONFIG.CLIENT_URI) const defaultParams = { supportUrl: CONFIG.SUPPORT_URL, diff --git a/webapp/components/LoginForm/LoginForm.vue b/webapp/components/LoginForm/LoginForm.vue index 01c3c8661..0dc1b5e8a 100644 --- a/webapp/components/LoginForm/LoginForm.vue +++ b/webapp/components/LoginForm/LoginForm.vue @@ -7,7 +7,7 @@

{{ $t('login.login') }}

@@ -56,13 +56,15 @@ diff --git a/webapp/components/Registration/RegistrationSlider.vue b/webapp/components/Registration/RegistrationSlider.vue index 0e3ae17a4..64b8d9a3f 100644 --- a/webapp/components/Registration/RegistrationSlider.vue +++ b/webapp/components/Registration/RegistrationSlider.vue @@ -3,7 +3,7 @@ @@ -47,6 +47,7 @@ import links from '~/constants/links.js' import metadata from '~/constants/metadata.js' import ComponentSlider from '~/components/ComponentSlider/ComponentSlider' import LocaleSwitch from '~/components/LocaleSwitch/LocaleSwitch' +import Logo from '~/components/Logo/Logo' import RegistrationSlideCreate from './RegistrationSlideCreate' import RegistrationSlideEmail from './RegistrationSlideEmail' import RegistrationSlideInvite from './RegistrationSlideInvite' @@ -58,6 +59,7 @@ export default { components: { ComponentSlider, LocaleSwitch, + Logo, RegistrationSlideCreate, RegistrationSlideEmail, RegistrationSlideInvite, diff --git a/webapp/components/_new/generic/BaseCard/BaseCard.story.js b/webapp/components/_new/generic/BaseCard/BaseCard.story.js index 3b9e60813..928aba5e6 100644 --- a/webapp/components/_new/generic/BaseCard/BaseCard.story.js +++ b/webapp/components/_new/generic/BaseCard/BaseCard.story.js @@ -1,5 +1,6 @@ import { storiesOf } from '@storybook/vue' import helpers from '~/storybook/helpers' +import logos from '~/constants/logos.js' import BaseCard from './BaseCard.vue' storiesOf('Generic/BaseCard', module) @@ -33,7 +34,7 @@ storiesOf('Generic/BaseCard', module) template: `

I am a card heading

And I am a paragraph.

@@ -46,7 +47,7 @@ storiesOf('Generic/BaseCard', module) template: `

I am a card heading

And I am a paragraph.

diff --git a/webapp/constants/links.js b/webapp/constants/links.js index 494e449ba..c6f932c82 100644 --- a/webapp/constants/links.js +++ b/webapp/constants/links.js @@ -1,3 +1,4 @@ +// this file is duplicated in `backend/src/config/links.js` and `webapp/constants/links.js` and replaced on rebranding export default { ORGANIZATION: 'https://ocelot.social', DONATE: 'https://ocelot-social.herokuapp.com/donations', diff --git a/webapp/constants/logos.js b/webapp/constants/logos.js new file mode 100644 index 000000000..d093c7b46 --- /dev/null +++ b/webapp/constants/logos.js @@ -0,0 +1,10 @@ +// this file is duplicated in `backend/src/config/logos.js` and `webapp/constants/logos.js` and replaced on rebranding +// this are the paths in the webapp +export default { + LOGO_HEADER_PATH: '/img/custom/logo-horizontal.svg', + LOGO_SIGNUP_PATH: '/img/custom/logo-squared.svg', + LOGO_WELCOME_PATH: '/img/custom/logo-squared.svg', + LOGO_LOGOUT_PATH: '/img/custom/logo-squared.svg', + LOGO_PASSWORD_RESET_PATH: '/img/custom/logo-squared.svg', + LOGO_MAINTENACE_RESET_PATH: '/img/custom/logo-squared.svg', +} diff --git a/webapp/constants/metadata.js b/webapp/constants/metadata.js index 20b9a5896..d40308e80 100644 --- a/webapp/constants/metadata.js +++ b/webapp/constants/metadata.js @@ -1,8 +1,9 @@ +// this file is duplicated in `backend/src/config/metadata.js` and `webapp/constants/metadata.js` and replaced on rebranding export default { APPLICATION_NAME: 'ocelot.social', APPLICATION_SHORT_NAME: 'ocelot', APPLICATION_DESCRIPTION: 'ocelot.social Community Network', + COOKIE_NAME: 'ocelot-social-token', ORGANIZATION_NAME: 'ocelot.social Community', ORGANIZATION_JURISDICTION: 'City of Angels', - COOKIE_NAME: 'ocelot-social-token', } diff --git a/webapp/layouts/basic.vue b/webapp/layouts/basic.vue index 527d5239c..9dd008c88 100644 --- a/webapp/layouts/basic.vue +++ b/webapp/layouts/basic.vue @@ -6,7 +6,7 @@ - + diff --git a/webapp/layouts/default.vue b/webapp/layouts/default.vue index 0b682f3d5..8b5e6302d 100644 --- a/webapp/layouts/default.vue +++ b/webapp/layouts/default.vue @@ -6,7 +6,7 @@ - + - Under maintenance + @@ -42,11 +38,13 @@ import emails from '~/constants/emails.js' import links from '~/constants/links.js' import metadata from '~/constants/metadata.js' import LocaleSwitch from '~/components/LocaleSwitch/LocaleSwitch' +import Logo from '~/components/Logo/Logo' export default { layout: 'blank', components: { LocaleSwitch, + Logo, }, data() { return { links, metadata, supportEmail: emails.SUPPORT } @@ -55,8 +53,4 @@ export default { diff --git a/webapp/pages/logout.vue b/webapp/pages/logout.vue index 279eec511..392b66d72 100644 --- a/webapp/pages/logout.vue +++ b/webapp/pages/logout.vue @@ -3,7 +3,7 @@ - Logging out + Logging out... @@ -14,8 +14,13 @@ - + From 29be05e7ffda935df182c1c1654e2dea60f6a234 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 18 May 2021 19:37:34 +0200 Subject: [PATCH 118/181] Fix test of logo component --- webapp/components/Logo/Logo.spec.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/webapp/components/Logo/Logo.spec.js b/webapp/components/Logo/Logo.spec.js index a712a529b..5a94fe538 100644 --- a/webapp/components/Logo/Logo.spec.js +++ b/webapp/components/Logo/Logo.spec.js @@ -4,18 +4,20 @@ import Logo from './Logo.vue' const localVue = global.localVue describe('Logo.vue', () => { - let wrapper - let mocks + let mocks, propsData, wrapper beforeEach(() => { mocks = { $t: jest.fn(), } + propsData = { + type: 'header', + } }) describe('mount', () => { const Wrapper = () => { - return mount(Logo, { mocks, localVue }) + return mount(Logo, { mocks, localVue, propsData }) } beforeEach(() => { From 9a736100df208b3862732e9898f3a2e17a2f7f84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 18 May 2021 19:38:39 +0200 Subject: [PATCH 119/181] Remove comment --- webapp/components/LoginForm/LoginForm.vue | 3 --- 1 file changed, 3 deletions(-) diff --git a/webapp/components/LoginForm/LoginForm.vue b/webapp/components/LoginForm/LoginForm.vue index 0dc1b5e8a..0f2b248c9 100644 --- a/webapp/components/LoginForm/LoginForm.vue +++ b/webapp/components/LoginForm/LoginForm.vue @@ -124,9 +124,6 @@ export default { margin-top: $space-large; margin-bottom: $space-small; } - // .image { - // width: 100%; - // } } .password-wrapper { From eaf35d1bfdbe900d19b739df40160d679bf1dfbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 18 May 2021 19:55:32 +0200 Subject: [PATCH 120/181] Revert refactoring of maintenance page --- webapp/maintenance/source/pages/index.vue | 15 +++-- .../static/img/custom/under-maintenance.svg | 65 +++++++++++++++++++ 2 files changed, 76 insertions(+), 4 deletions(-) create mode 100644 webapp/static/img/custom/under-maintenance.svg diff --git a/webapp/maintenance/source/pages/index.vue b/webapp/maintenance/source/pages/index.vue index e2a5fd683..59c7d4027 100644 --- a/webapp/maintenance/source/pages/index.vue +++ b/webapp/maintenance/source/pages/index.vue @@ -9,7 +9,11 @@ - + Under maintenance @@ -38,13 +42,11 @@ import emails from '~/constants/emails.js' import links from '~/constants/links.js' import metadata from '~/constants/metadata.js' import LocaleSwitch from '~/components/LocaleSwitch/LocaleSwitch' -import Logo from '~/components/Logo/Logo' export default { layout: 'blank', components: { LocaleSwitch, - Logo, }, data() { return { links, metadata, supportEmail: emails.SUPPORT } @@ -52,4 +54,9 @@ export default { } - + diff --git a/webapp/static/img/custom/under-maintenance.svg b/webapp/static/img/custom/under-maintenance.svg new file mode 100644 index 000000000..f2ace345e --- /dev/null +++ b/webapp/static/img/custom/under-maintenance.svg @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 1f22995db63ad7962d9ec70457ad0093881c1a59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 18 May 2021 20:13:03 +0200 Subject: [PATCH 121/181] Delete 'under-maintenance.svg' and replace by 'logo-squared.svg' --- webapp/maintenance/source/pages/index.vue | 2 +- .../static/img/custom/under-maintenance.svg | 65 ------------------- 2 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 webapp/static/img/custom/under-maintenance.svg diff --git a/webapp/maintenance/source/pages/index.vue b/webapp/maintenance/source/pages/index.vue index 59c7d4027..08592084e 100644 --- a/webapp/maintenance/source/pages/index.vue +++ b/webapp/maintenance/source/pages/index.vue @@ -12,7 +12,7 @@ Under maintenance diff --git a/webapp/static/img/custom/under-maintenance.svg b/webapp/static/img/custom/under-maintenance.svg deleted file mode 100644 index f2ace345e..000000000 --- a/webapp/static/img/custom/under-maintenance.svg +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From a9a0d1c380feb28b5326391fb15adada1130d282 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 18 May 2021 20:51:01 +0200 Subject: [PATCH 122/181] Fix linting --- webapp/maintenance/source/pages/index.vue | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/webapp/maintenance/source/pages/index.vue b/webapp/maintenance/source/pages/index.vue index 08592084e..2e2cdfe3b 100644 --- a/webapp/maintenance/source/pages/index.vue +++ b/webapp/maintenance/source/pages/index.vue @@ -9,11 +9,7 @@ - Under maintenance + Under maintenance From 2f72e4eba34495a514dcc5c814636086d2425261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 18 May 2021 22:09:56 +0200 Subject: [PATCH 123/181] Follow @Mogge suggestions --- webapp/components/LoginForm/LoginForm.vue | 2 +- webapp/components/Logo/Logo.vue | 18 +++++++++--------- .../Registration/RegistrationSlider.vue | 2 +- webapp/layouts/basic.vue | 2 +- webapp/layouts/default.vue | 2 +- webapp/pages/logout.vue | 2 +- webapp/pages/password-reset.vue | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/webapp/components/LoginForm/LoginForm.vue b/webapp/components/LoginForm/LoginForm.vue index 0f2b248c9..bbc63e93a 100644 --- a/webapp/components/LoginForm/LoginForm.vue +++ b/webapp/components/LoginForm/LoginForm.vue @@ -7,7 +7,7 @@

{{ $t('login.login') }}

diff --git a/webapp/components/Logo/Logo.vue b/webapp/components/Logo/Logo.vue index 1714888d7..c93d74f81 100644 --- a/webapp/components/Logo/Logo.vue +++ b/webapp/components/Logo/Logo.vue @@ -5,14 +5,14 @@ class="ds-logo-svg" :alt="metadata.APPLICATION_NAME + ' ' + logo.alt" :src="logo.path" - :style="logoWidth" + :style="logoWidthStyle" /> @@ -31,14 +31,14 @@ export default { /** * Logo type */ - type: { + logoType: { type: String, required: true, }, /** - * Logo type + * Logo width */ - width: { + logoWidth: { type: String, default: null, }, @@ -75,17 +75,17 @@ export default { }, } return { - logo: logosObject[this.type], + logo: logosObject[this.logoType], metadata, } }, computed: { - logoWidth() { + logoWidthStyle() { let width = '' - if (this.width === null) { + if (this.logoWidth === null) { width = this.logo.widthDefault } else { - width = this.width + width = this.logoWidth } return `width: ${width};` }, diff --git a/webapp/components/Registration/RegistrationSlider.vue b/webapp/components/Registration/RegistrationSlider.vue index 64b8d9a3f..2e297bc86 100644 --- a/webapp/components/Registration/RegistrationSlider.vue +++ b/webapp/components/Registration/RegistrationSlider.vue @@ -3,7 +3,7 @@ diff --git a/webapp/layouts/basic.vue b/webapp/layouts/basic.vue index 9dd008c88..01872868e 100644 --- a/webapp/layouts/basic.vue +++ b/webapp/layouts/basic.vue @@ -6,7 +6,7 @@ - + diff --git a/webapp/layouts/default.vue b/webapp/layouts/default.vue index 8b5e6302d..0dfd752bf 100644 --- a/webapp/layouts/default.vue +++ b/webapp/layouts/default.vue @@ -6,7 +6,7 @@ - + - + Logging out... diff --git a/webapp/pages/password-reset.vue b/webapp/pages/password-reset.vue index a3f8c7bd5..caa7c3455 100644 --- a/webapp/pages/password-reset.vue +++ b/webapp/pages/password-reset.vue @@ -3,7 +3,7 @@ From 5ab01e9cd47e44c1ef52552de3ab0ece5fc02f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Tue, 18 May 2021 22:13:06 +0200 Subject: [PATCH 124/181] Fix test --- webapp/components/Logo/Logo.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/components/Logo/Logo.spec.js b/webapp/components/Logo/Logo.spec.js index 5a94fe538..103158780 100644 --- a/webapp/components/Logo/Logo.spec.js +++ b/webapp/components/Logo/Logo.spec.js @@ -11,7 +11,7 @@ describe('Logo.vue', () => { $t: jest.fn(), } propsData = { - type: 'header', + logoType: 'header', } }) From 0df0c19c7360db7c6e268ed97a1fcffa79b065b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 19 May 2021 07:08:49 +0200 Subject: [PATCH 125/181] Rename logo as dummy for following just small caps --- .../custom/{Logo-Horizontal.svg => logo-horizontal--dummy.svg} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename webapp/static/img/custom/{Logo-Horizontal.svg => logo-horizontal--dummy.svg} (100%) diff --git a/webapp/static/img/custom/Logo-Horizontal.svg b/webapp/static/img/custom/logo-horizontal--dummy.svg similarity index 100% rename from webapp/static/img/custom/Logo-Horizontal.svg rename to webapp/static/img/custom/logo-horizontal--dummy.svg From 8a51c8cb1d18f2c9ac1e204c0ba2da4db1f87cfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 19 May 2021 07:09:38 +0200 Subject: [PATCH 126/181] Rename logo to just small caps --- .../custom/{logo-horizontal--dummy.svg => logo-horizontal.svg} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename webapp/static/img/custom/{logo-horizontal--dummy.svg => logo-horizontal.svg} (100%) diff --git a/webapp/static/img/custom/logo-horizontal--dummy.svg b/webapp/static/img/custom/logo-horizontal.svg similarity index 100% rename from webapp/static/img/custom/logo-horizontal--dummy.svg rename to webapp/static/img/custom/logo-horizontal.svg From 772a892dc9466ee3badf7bdd507b79c00c3bccdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 19 May 2021 08:50:05 +0200 Subject: [PATCH 127/181] v1.0.3 --- CHANGELOG.md | 48 +++++++++++++------------- backend/package.json | 2 +- package.json | 2 +- webapp/maintenance/source/package.json | 2 +- webapp/package.json | 2 +- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 487dbe2a6..5a040d403 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,11 +4,29 @@ All notable changes to this project will be documented in this file. Dates are d Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -#### [v1.0.2](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/1.0.1...v1.0.2) +#### [v1.0.3](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/1.0.2...v1.0.3) +- chore: 🍰 Refactor Logos [`#4433`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4433) +- feat: 🍰 Show Password Component [`#4370`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4370) +- chore: 🍰 Replace Ocelot Logos 619x593 With 600x570 [`#4428`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4428) +- Coverage [`#4393`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4393) +- correct_docker_tagging [`#4391`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4391) +- 🍰 Get Cypress Tests Running Again [`#4338`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4338) +- frontend + backend coverage tests [`#4367`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4367) +- refactor: 🍰 Refactor E-Mail Templates [`#4350`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4350) +- feat: 🍰 Remove More-Info Of Post [`#4316`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4316) +- have cypress running locally - the tests still fail [`e3e0341`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/e3e03415e1bd9e0be88f33930a52e63d8af64ee1) +- have cypress running locally - the tests still fail [`0ec0574`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/0ec05743751cfef0cb86c17b87e9e4ef9a2c9e47) +- Refactor logos, first step [`ff6cc30`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/ff6cc306aff6150a924f1a647387e498d050ea9f) + +#### [1.0.2](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/1.0.1...1.0.2) + +> 6 April 2021 + +- fix: Email Confirmation-Link When An Invite-Code Is Given [`#4336`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4336) +- release v1.0.2 [`e583010`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/e5830101e4b449905fe2d0018627d75af62b2a20) - slider jumps to enter-nonce when link contains invite-code, email and nonce and method is invite-code. Thanks @tirokk [`c80b3a2`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/c80b3a212835f76cfc2f11542345d6c3b226995b) - fix enail confirmation link when an invite-code is given [`27f0de9`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/27f0de9464685c8f960bde9d07986fdc5b20f8f9) -- linting [`21a667e`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/21a667eb25a236c69f69b61f24d1578ea005a910) #### [1.0.1](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/1.0.0...1.0.1) @@ -136,21 +154,11 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - file upload: refactored [`650e83f`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/650e83f4c250389477933a2e7d21d8245b0ce882) - change user role: tests are working [`14dfe2a`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/14dfe2ae2cd4a24c06c9229893b33586dfceae4f) -#### [0.6.5](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/v0.6.4...0.6.5) +#### [0.6.5](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/0.6.4...0.6.5) > 8 February 2021 -- - adjusted changelog to ocelot-social repo [`9603882`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/9603882edebf8967e05abfa94e4e1ebf452d4e24) -- - first steps towards docker image deployment & github autotagging [`5503216`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/5503216ad4a0230ac533042e4a69806590fc2a5a) -- - deploy structure image [`a60400b`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/a60400b4fe6f59bbb80e1073db4def3ba205e1a7) - -#### [v0.6.4](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/0.6.4...v0.6.4) - -> 9 February 2021 - -- chore(release): 0.6.4 [`8b7570d`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/8b7570dc35d0ea431f673a711ac051f1e1320acb) -- change user roles is working, test fails [`8c3310a`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/8c3310abaf87c0e5597fec4f93fb37d27122c9e7) -- change user role: tests are working [`f10da4b`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/f10da4b09388fe1e2b85abd53f6ffc67c785d4c1) +- updated CHANGELOG.md [`9d9075f`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/9d9075f2117b2eb4b607e7d59ab18c7e655c6ea7) #### [0.6.4](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/0.6.3...0.6.4) @@ -160,15 +168,7 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - fetch full history [`5ecee4d`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/5ecee4d73a92d2e5c5ae971d79848ed27f65a72c) - don't fail if tag exists (release) [`39c82fc`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/39c82fcb37d5c8e7e78a79288e1ef6280f8d0892) -#### [0.6.3](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/v0.6.3...0.6.3) - -> 8 February 2021 - -- - adjusted changelog to ocelot-social repo [`9603882`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/9603882edebf8967e05abfa94e4e1ebf452d4e24) -- - fixed changelog [`cf70b12`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/cf70b12ed74011924ea788ab932fc9d7ac0e6bd9) -- - yarn install to allow yarn auto-changelog [`fc496aa`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/fc496aa04cb7e804da4335da0cb5cda26f874ea2) - -#### [v0.6.3](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/0.6.0...v0.6.3) +#### [0.6.3](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/0.6.0...0.6.3) > 8 February 2021 @@ -177,9 +177,9 @@ Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). - feat: 🍰 Allow Only Supported Image File Formats [`#3928`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/3928) - refactor: Disbale Emoji, Language And Catgeory Filter [`#4193`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4193) - refactor: Remove Catgeories From Post Teaser [`#4191`](https://github.com/Ocelot-Social-Community/Ocelot-Social/pull/4191) +- - adjusted changelog to ocelot-social repo [`9603882`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/9603882edebf8967e05abfa94e4e1ebf452d4e24) - - first steps towards docker image deployment & github autotagging [`5503216`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/5503216ad4a0230ac533042e4a69806590fc2a5a) - - lots of additional tests [`0ba37aa`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/0ba37aab18f537d722aede7b87fa0b8e79f80e66) -- - deploy structure image [`a60400b`](https://github.com/Ocelot-Social-Community/Ocelot-Social/commit/a60400b4fe6f59bbb80e1073db4def3ba205e1a7) #### [0.6.0](https://github.com/Ocelot-Social-Community/Ocelot-Social/compare/v0.6.0...0.6.0) diff --git a/backend/package.json b/backend/package.json index 8148593c4..9787253a1 100644 --- a/backend/package.json +++ b/backend/package.json @@ -1,6 +1,6 @@ { "name": "ocelot-social-backend", - "version": "1.0.2", + "version": "1.0.3", "description": "GraphQL Backend for ocelot.social", "repository": "https://github.com/Ocelot-Social-Community/Ocelot-Social", "author": "ocelot.social Community", diff --git a/package.json b/package.json index 937b0a6bc..8edeff972 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ocelot-social", - "version": "1.0.2", + "version": "1.0.3", "description": "Fullstack and API tests with cypress and cucumber for ocelot.social", "author": "ocelot.social Community", "license": "MIT", diff --git a/webapp/maintenance/source/package.json b/webapp/maintenance/source/package.json index a639ec418..2fcf86443 100644 --- a/webapp/maintenance/source/package.json +++ b/webapp/maintenance/source/package.json @@ -1,6 +1,6 @@ { "name": "@ocelot-social/maintenance", - "version": "0.6.3", + "version": "1.0.3", "description": "Maintenance page for ocelot.social", "repository": "https://github.com/Ocelot-Social-Community/Ocelot-Social", "author": "ocelot.social Community", diff --git a/webapp/package.json b/webapp/package.json index 7abe34e4a..49f77a115 100644 --- a/webapp/package.json +++ b/webapp/package.json @@ -1,6 +1,6 @@ { "name": "ocelot-social-webapp", - "version": "1.0.2", + "version": "1.0.3", "description": "ocelot.social Frontend", "repository": "https://github.com/Ocelot-Social-Community/Ocelot-Social", "author": "ocelot.social Community", From 931705976d7c6c82fe4c4c2a116b3503ab1bc255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Sun, 30 May 2021 17:58:04 +0200 Subject: [PATCH 128/181] Establish new deployment structure with base and code Docker images, first step --- .github/workflows/publish.yml | 4 ++++ backend/Dockerfile | 18 ++++++++++++------ webapp/Dockerfile | 18 +++++++++++++----- webapp/Dockerfile.maintenance | 10 ++++++++-- 4 files changed, 37 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index de956e17b..22526a735 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -55,6 +55,7 @@ jobs: # NEO4J ################################################################## ########################################################################## - name: Neo4J | Build `community` image + # TODO build and push "latest-base" and "latest-code" run: docker build --target community -t "ocelotsocialnetwork/neo4j:latest" -t "ocelotsocialnetwork/neo4j:community" -t "ocelotsocialnetwork/neo4j:${VERSION}" -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT neo4j/ - name: Neo4J | Save docker image run: docker save "ocelotsocialnetwork/neo4j" > /tmp/neo4j.tar @@ -92,6 +93,7 @@ jobs: # BUILD BACKEND DOCKER IMAGE (production) ################################ ########################################################################## - name: Backend | Build `production` image + # TODO build and push "latest-base" and "latest-code" run: docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ - name: Backend | Save docker image run: docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar @@ -129,6 +131,7 @@ jobs: # BUILD WEBAPP DOCKER IMAGE (build) ###################################### ########################################################################## - name: Webapp | Build `production` image + # TODO build and push "latest-base" and "latest-code" run: docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ - name: Webapp | Save docker image run: docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar @@ -166,6 +169,7 @@ jobs: # BUILD MAINTENANCE DOCKER IMAGE (build) ################################# ########################################################################## - name: Maintenance | Build `production` image + # TODO build and push "latest-base" and "latest-code" run: docker build --target production -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance - name: Maintenance | Save docker image run: docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar diff --git a/backend/Dockerfile b/backend/Dockerfile index c632f8803..9c1561ac9 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,5 +1,5 @@ ################################################################################## -# BASE ########################################################################### +# BASE (Is pushed to DockerHub for rebranding) ################################### ################################################################################## FROM node:12.19.0-alpine3.10 as base @@ -59,12 +59,18 @@ FROM base as development CMD /bin/sh -c "yarn install && yarn run dev" ################################################################################## -# BUILD (Does contain all files and is therefore bloated) ######################## +# CODE (Does contain all code files and is pushed to DockerHub for rebranding) ### ################################################################################## -FROM base as build +FROM base as code -# Copy everything +# copy everything, but do not build. COPY . . + +################################################################################## +# BUILD (Does contain all files and the compilate and is therefore bloated) ###### +################################################################################## +FROM code as build + # yarn install RUN yarn install --production=false --frozen-lockfile --non-interactive # yarn build @@ -86,7 +92,7 @@ FROM base as production # Copy "binary"-files from build image COPY --from=build ${DOCKER_WORKDIR}/dist ./dist COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules -# Copy static files +# Copy static files # Wolle comment overfluid here? # TODO - externalize the uploads so we can copy the whole folder COPY --from=build ${DOCKER_WORKDIR}/public/img/ ./public/img/ COPY --from=build ${DOCKER_WORKDIR}/public/providers.json ./public/providers.json @@ -94,4 +100,4 @@ COPY --from=build ${DOCKER_WORKDIR}/public/providers.json ./public/providers.jso COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json # Run command -CMD /bin/sh -c "yarn run start" \ No newline at end of file +CMD /bin/sh -c "yarn run start" diff --git a/webapp/Dockerfile b/webapp/Dockerfile index 75d43bf59..a086a4b2a 100644 --- a/webapp/Dockerfile +++ b/webapp/Dockerfile @@ -1,5 +1,5 @@ ################################################################################## -# BASE ########################################################################### +# BASE (Is pushed to DockerHub for rebranding) ################################### ################################################################################## FROM node:12.19.0-alpine3.10 as base @@ -59,12 +59,18 @@ FROM base as development CMD /bin/sh -c "yarn install && yarn run dev" ################################################################################## -# BUILD (Does contain all files and is therefore bloated) ######################## +# CODE (Does contain all code files and is pushed to DockerHub for rebranding) ### ################################################################################## -FROM base as build +FROM base as code -# Copy everything +# copy everything, but do not build. COPY . . + +################################################################################## +# BUILD (Does contain all files and the compilate and is therefore bloated) ###### +################################################################################## +FROM code as build + # yarn install RUN yarn install --production=false --frozen-lockfile --non-interactive # yarn build @@ -83,11 +89,13 @@ CMD /bin/sh -c "yarn run dev" ################################################################################## FROM base as production +# TODO - do all copying with one COPY command to have one layer # Copy "binary"-files from build image COPY --from=build ${DOCKER_WORKDIR}/.nuxt ./.nuxt COPY --from=build ${DOCKER_WORKDIR}/node_modules ./node_modules COPY --from=build ${DOCKER_WORKDIR}/nuxt.config.js ./nuxt.config.js # Copy static files +# TODO - this seems not be needed anymore for the new rebranding # TODO - this should be one Folder containign all stuff needed to be copied COPY --from=build ${DOCKER_WORKDIR}/config/ ./config/ COPY --from=build ${DOCKER_WORKDIR}/constants ./constants @@ -97,4 +105,4 @@ COPY --from=build ${DOCKER_WORKDIR}/locales ./locales COPY --from=build ${DOCKER_WORKDIR}/package.json ./package.json # Run command -CMD /bin/sh -c "yarn run start" \ No newline at end of file +CMD /bin/sh -c "yarn run start" diff --git a/webapp/Dockerfile.maintenance b/webapp/Dockerfile.maintenance index 0a7616240..b0210511f 100644 --- a/webapp/Dockerfile.maintenance +++ b/webapp/Dockerfile.maintenance @@ -48,11 +48,12 @@ WORKDIR ${DOCKER_WORKDIR} CMD ["yarn", "run", "start"] ################################################################################## -# BUILD ### TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO ## +# CODE (Does contain all code files and is pushed to DockerHub for rebranding) ### ################################################################################## -FROM base as build +FROM base as code COPY package.json yarn.lock ./ +# yarn install RUN yarn install --production=false --frozen-lockfile --non-interactive COPY assets assets @@ -70,7 +71,12 @@ COPY config/ config/ # this will also ovewrite the existing package.json COPY maintenance/source ./ +################################################################################## +# BUILD ### TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO # TODO ## +################################################################################## +FROM code as build +# yarn generate RUN yarn run generate ################################################################################## From 6ba2cf097093a1254bbd2cdb11be63011dfc811a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Sun, 30 May 2021 19:46:49 +0200 Subject: [PATCH 129/181] Build base and code Docker images - Push always for test purposes. To be reverted later. --- .github/workflows/publish.yml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 22526a735..d59a9104e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,9 +1,10 @@ name: ocelot.social publish CI -on: - push: - branches: - - master +# on: +# push: +# branches: +# - master +on: [push] # for testing while developing jobs: ############################################################################## @@ -55,7 +56,6 @@ jobs: # NEO4J ################################################################## ########################################################################## - name: Neo4J | Build `community` image - # TODO build and push "latest-base" and "latest-code" run: docker build --target community -t "ocelotsocialnetwork/neo4j:latest" -t "ocelotsocialnetwork/neo4j:community" -t "ocelotsocialnetwork/neo4j:${VERSION}" -t "ocelotsocialnetwork/neo4j:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT neo4j/ - name: Neo4J | Save docker image run: docker save "ocelotsocialnetwork/neo4j" > /tmp/neo4j.tar @@ -94,7 +94,10 @@ jobs: ########################################################################## - name: Backend | Build `production` image # TODO build and push "latest-base" and "latest-code" - run: docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ + run: | + docker build --target base -t "ocelotsocialnetwork/backend:latest-base" -t "ocelotsocialnetwork/backend:${VERSION}-base" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ + docker build --target code -t "ocelotsocialnetwork/backend:latest-code" -t "ocelotsocialnetwork/backend:${VERSION}-code" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ + docker build --target production -t "ocelotsocialnetwork/backend:latest" -t "ocelotsocialnetwork/backend:${VERSION}" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ - name: Backend | Save docker image run: docker save "ocelotsocialnetwork/backend" > /tmp/backend.tar - name: Upload Artifact @@ -132,7 +135,10 @@ jobs: ########################################################################## - name: Webapp | Build `production` image # TODO build and push "latest-base" and "latest-code" - run: docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ + run: | + docker build --target base -t "ocelotsocialnetwork/webapp:latest-base" -t "ocelotsocialnetwork/webapp:${VERSION}-base" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ + docker build --target code -t "ocelotsocialnetwork/webapp:latest-code" -t "ocelotsocialnetwork/webapp:${VERSION}-code" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ + docker build --target production -t "ocelotsocialnetwork/webapp:latest" -t "ocelotsocialnetwork/webapp:${VERSION}" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ - name: Webapp | Save docker image run: docker save "ocelotsocialnetwork/webapp" > /tmp/webapp.tar - name: Upload Artifact @@ -170,7 +176,10 @@ jobs: ########################################################################## - name: Maintenance | Build `production` image # TODO build and push "latest-base" and "latest-code" - run: docker build --target production -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance + run: | + docker build --target base -t "ocelotsocialnetwork/maintenance:latest-base" -t "ocelotsocialnetwork/maintenance:${VERSION}-base" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance + docker build --target code -t "ocelotsocialnetwork/maintenance:latest-code" -t "ocelotsocialnetwork/maintenance:${VERSION}-code" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance + docker build --target production -t "ocelotsocialnetwork/maintenance:latest" -t "ocelotsocialnetwork/maintenance:${VERSION}" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance - name: Maintenance | Save docker image run: docker save "ocelotsocialnetwork/maintenance" > /tmp/maintenance.tar - name: Upload Artifact From 92abc35a60b3e396919c29a4fa56d4d3c4c92520 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Sun, 30 May 2021 20:26:12 +0200 Subject: [PATCH 130/181] Remove comments --- .github/workflows/publish.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d59a9104e..3eb9d77e7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -93,7 +93,6 @@ jobs: # BUILD BACKEND DOCKER IMAGE (production) ################################ ########################################################################## - name: Backend | Build `production` image - # TODO build and push "latest-base" and "latest-code" run: | docker build --target base -t "ocelotsocialnetwork/backend:latest-base" -t "ocelotsocialnetwork/backend:${VERSION}-base" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ docker build --target code -t "ocelotsocialnetwork/backend:latest-code" -t "ocelotsocialnetwork/backend:${VERSION}-code" -t "ocelotsocialnetwork/backend:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT backend/ @@ -134,7 +133,6 @@ jobs: # BUILD WEBAPP DOCKER IMAGE (build) ###################################### ########################################################################## - name: Webapp | Build `production` image - # TODO build and push "latest-base" and "latest-code" run: | docker build --target base -t "ocelotsocialnetwork/webapp:latest-base" -t "ocelotsocialnetwork/webapp:${VERSION}-base" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ docker build --target code -t "ocelotsocialnetwork/webapp:latest-code" -t "ocelotsocialnetwork/webapp:${VERSION}-code" -t "ocelotsocialnetwork/webapp:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ @@ -175,7 +173,6 @@ jobs: # BUILD MAINTENANCE DOCKER IMAGE (build) ################################# ########################################################################## - name: Maintenance | Build `production` image - # TODO build and push "latest-base" and "latest-code" run: | docker build --target base -t "ocelotsocialnetwork/maintenance:latest-base" -t "ocelotsocialnetwork/maintenance:${VERSION}-base" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-base" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance docker build --target code -t "ocelotsocialnetwork/maintenance:latest-code" -t "ocelotsocialnetwork/maintenance:${VERSION}-code" -t "ocelotsocialnetwork/maintenance:${BUILD_VERSION}-code" --build-arg BBUILD_DATE=$BUILD_DATE --build-arg BBUILD_VERSION=$BUILD_VERSION --build-arg BBUILD_COMMIT=$BUILD_COMMIT webapp/ -f webapp/Dockerfile.maintenance From a0a2fb43abbb4663097b4495d736071c3a95fcef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Sun, 30 May 2021 20:52:16 +0200 Subject: [PATCH 131/181] Prettify some formating --- docker-compose.override.yml | 5 +---- docker-compose.test.yml | 5 +---- docker-compose.yml | 3 --- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 8d1bb96f2..5fceb2776 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -18,7 +18,6 @@ services: - webapp_node_modules:/app/node_modules # bind the local folder to the docker to allow live reload - ./webapp:/app - ######################################################## # BACKEND ############################################## ######################################################## @@ -35,7 +34,6 @@ services: - backend_node_modules:/app/node_modules # bind the local folder to the docker to allow live reload - ./backend:/app - ######################################################## # NEO4J ################################################ ######################################################## @@ -47,13 +45,11 @@ services: networks: # So we can access the neo4j query browser from our host machine - external-net - ######################################################## # MAINTENANCE ########################################## ######################################################## maintenance: image: ocelotsocialnetwork/maintenance:development - ######################################################## # MAILSERVER TO FAKE SMTP ############################## ######################################################## @@ -63,6 +59,7 @@ services: - 1080:80 networks: - external-net + volumes: webapp_node_modules: backend_node_modules: diff --git a/docker-compose.test.yml b/docker-compose.test.yml index eef71e67b..973cf87cf 100644 --- a/docker-compose.test.yml +++ b/docker-compose.test.yml @@ -12,7 +12,6 @@ services: - NODE_ENV="test" volumes: - ./coverage:/app/coverage - ######################################################## # BACKEND ############################################## ######################################################## @@ -24,7 +23,6 @@ services: - NODE_ENV="test" volumes: - ./coverage:/app/coverage - ######################################################## # NEO4J ################################################ ######################################################## @@ -41,13 +39,11 @@ services: networks: # So we can access the neo4j query browser from our host machine - external-net - ######################################################## # MAINTENANCE ########################################## ######################################################## maintenance: image: ocelotsocialnetwork/maintenance:test - ######################################################## # MAILSERVER TO FAKE SMTP ############################## ######################################################## @@ -57,6 +53,7 @@ services: - 1080:80 networks: - external-net + volumes: webapp_node_modules: backend_node_modules: diff --git a/docker-compose.yml b/docker-compose.yml index 392447f61..d20bb6aec 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -35,7 +35,6 @@ services: - GRAPHQL_URI=http://backend:4000 env_file: - ./webapp/.env - ######################################################## # BACKEND ############################################## ######################################################## @@ -68,7 +67,6 @@ services: - CLIENT_URI=http://webapp:3000 env_file: - ./backend/.env - ######################################################## # NEO4J ################################################ ######################################################## @@ -92,7 +90,6 @@ services: # TODO: clarify if that is the only thing needed to unlock the Enterprise version # - NEO4J_ACCEPT_LICENSE_AGREEMENT=yes # TODO: Remove the playground from production - ######################################################## # MAINTENANCE ########################################## ######################################################## From e36c88ee96507b1c336d927ab776e5fddc7718db Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 31 May 2021 05:21:24 +0000 Subject: [PATCH 132/181] Bump date-fns from 2.12.0 to 2.22.1 Bumps [date-fns](https://github.com/date-fns/date-fns) from 2.12.0 to 2.22.1. - [Release notes](https://github.com/date-fns/date-fns/releases) - [Changelog](https://github.com/date-fns/date-fns/blob/master/CHANGELOG.md) - [Commits](https://github.com/date-fns/date-fns/compare/v2.12.0...v2.22.1) Signed-off-by: dependabot-preview[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8edeff972..180d5ae75 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "cypress": "^7.0.1", "cypress-cucumber-preprocessor": "^2.2.1", "cypress-file-upload": "^3.5.3", - "date-fns": "^2.12.0", + "date-fns": "^2.22.1", "dotenv": "^8.2.0", "expect": "^25.3.0", "faker": "Marak/faker.js#master", diff --git a/yarn.lock b/yarn.lock index 15394a334..86b5f97fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2627,10 +2627,10 @@ date-fns@^1.27.2: resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw== -date-fns@^2.12.0: - version "2.12.0" - resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.12.0.tgz#01754c8a2f3368fc1119cf4625c3dad8c1845ee6" - integrity sha512-qJgn99xxKnFgB1qL4jpxU7Q2t0LOn1p8KMIveef3UZD7kqjT3tpFNNdXJelEHhE+rUgffriXriw/sOSU+cS1Hw== +date-fns@^2.22.1: + version "2.22.1" + resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.22.1.tgz#1e5af959831ebb1d82992bf67b765052d8f0efc4" + integrity sha512-yUFPQjrxEmIsMqlHhAhmxkuH769baF21Kk+nZwZGyrMoyLA+LugaQtC0+Tqf9CBUUULWwUJt6Q5ySI3LJDDCGg== date-now@^0.1.4: version "0.1.4" From 0318910488e245c4a1d09181265de63d05a89cf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 31 May 2021 15:48:52 +0200 Subject: [PATCH 133/181] Correct Discord links and divers --- .github/ISSUE_TEMPLATE/question.md | 8 +++--- CONTRIBUTING.md | 39 +++++++++++++++++++----------- README.md | 4 +-- 3 files changed, 31 insertions(+), 20 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md index aabbc0f0a..677258e6f 100644 --- a/.github/ISSUE_TEMPLATE/question.md +++ b/.github/ISSUE_TEMPLATE/question.md @@ -1,12 +1,12 @@ --- name: 💬 Question -about: If you need help understanding HumanConnection. +about: If you need help understanding ocelot.social. labels: question title: 💬 [Question] --- - - + + ## :speech_balloon: Question diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b5f74d879..aecac8945 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,21 +4,22 @@ Thank you so much for thinking of contributing to the Human Connection project! ## Getting Set Up -Instructions for how to install all the necessary software and some code guidelines can be found in our [documentation](https://docs.human-connection.org/human-connection/). +Instructions for how to install all the necessary software and some code guidelines can be found in our main [Readme](/README.md) or in our [documentation](https://docs.human-connection.org/human-connection/). -To get you started we recommend that you join forces with a regular contributor. Please join [our discord instance](https://human-connection.org/discord) to chat with developers or just get in touch directly on an issue on either [Github](https://github.com/Ocelot-Social-Community/Ocelot-Social/issues) or [Zenhub](https://app.zenhub.com/workspaces/ocelotsocial-5fb21ff922cb410015dd6535/board?filterLogic=any&repos=301151089): +To get you started we recommend that you join forces with a regular contributor. Please join [our Discord instance](https://discord.gg/AJSX9DCSUA) to chat with developers or just get in touch directly on an issue on either [Github](https://github.com/Ocelot-Social-Community/Ocelot-Social/issues) or [Zenhub](https://app.zenhub.com/workspaces/ocelotsocial-5fb21ff922cb410015dd6535/board?filterLogic=any&repos=301151089): ![](https://dl.dropbox.com/s/vbmcihkduy9dhko/Screenshot%202019-01-03%2015.50.11.png?dl=0) -We also have regular pair programming sessions that you are very welcome to join! We feel this is often the best way to get to know both the project and the team. Most developers are also available for spontaneous sessions if the times listed below don't work for you – just ping us on discord. +We also have regular pair programming sessions that you are very welcome to join! We feel this is often the best way to get to know both the project and the team. Most developers are also available for spontaneous sessions if the times listed below don't work for you – just ping us on Discord. ## Development Flow We operate in two week sprints that are planned, estimated and prioritised on [Zenhub](https://app.zenhub.com/workspaces/ocelotsocial-5fb21ff922cb410015dd6535/board?filterLogic=any&repos=301151089). All issues are also linked to and synced with [Github](https://github.com/Ocelot-Social-Community/Ocelot-Social/issues). Look for the `good first issue` label if you're not sure where to start! -We try to discuss all questions directly related to a feature or bug in the respective issue, in order to preserve it for the future and for other developers. We use discord for real-time communication. +We try to discuss all questions directly related to a feature or bug in the respective issue, in order to preserve it for the future and for other developers. We use Discord for real-time communication. This is how we solve bugs and implement features, step by step: + 1. We find an issue we want to work on, usually during the sprint planning but as an open source contributor this can happen at any time. 2. We communicate with the team to see if the issue is still available. (When you comment on an issue but don't get an answer there within 1-2 days try to mention @Human-Connection/hc-dev-team to make sure we check in.) 3. We make sure we understand the issue in detail – what problem is it solving and how should it be implemented? @@ -29,6 +30,7 @@ This is how we solve bugs and implement features, step by step: 8. We then incorporate the suggestions from the reviews into our work and once it has been approved it can be merged into master! Every pull request needs to: + * fix an issue (if there is something you want to work on but there is no issue for it, create one first and discuss it with the team) * include tests for the code that is added or changed * pass all tests (linter, backend, frontend, end-to-end) @@ -39,36 +41,44 @@ Every pull request needs to: There are many volunteers all around the world helping us build this network and without their contributions we wouldn't be where we are today. Big thank you to all of you! You can see the core team behind Human Connection [on our website](https://human-connection.org/en/the-team/). On Github you will mostly run into our developers: -* Robert (@roschaefer) -* Matt (@mattwr18) + +* Ulf (@Tirokk) +* Moriz (@Tirokk) * Wolle (@Tirokk) * Alex (@ogerly) + ## Meetings and Pair Programming Sessions Times below refer to **German Time** – that's CET (GMT+1) in winter and CEST (GMT+2) in summer – because most Human Connection core team members are living in Germany. Daily standup -* every Monday–Friday 11:30 -* in the discord `Conference Room` + +* every Monday–Thursday 11:30 am (german time see above 👆🏼) +* in our Discord `Office Cube` * all contributors welcome! * everybody shares what they are working on and asks for help if they are blocked + ## Philosophy @@ -102,10 +114,9 @@ We use pair programming sessions as a tool for knowledge sharing. We can learn a As a volunteeer you have no commitment except your own self development and your awesomeness by contributing to this free and open-source software project. Cheers to you! - ## Open-Source Bounties -There are so many good reasons to contribute to Human Connection +There are so many good reasons to contribute to ocelot.social * You learn state-of-the-art technologies * You build your portfolio @@ -121,7 +132,7 @@ pull request approved and merged for free**. You can choose something really quick and easy. What's important is starting a working relationship with the team, learning the workflow, and understanding this contribution guide. You can filter issues by 'good first issue', to get an idea where to start. Please join -our our [community chat](https://human-connection.org/discord), too. +our our [Discord community chat](https://discord.gg/AJSX9DCSUA), too. You can filter Github issues with label [bounty](https://github.com/Ocelot-Social-Community/Ocelot-Social/issues?q=is%3Aopen+is%3Aissue+label%3Abounty). These issues should have a second label `€` which indicate their respective financial compensation in Euros. diff --git a/README.md b/README.md index 4e1777c25..e50413a90 100644 --- a/README.md +++ b/README.md @@ -107,12 +107,12 @@ The only deployment method in this repository is `docker-compose` for developmen ## Developer Chat -Join our friendly open-source community on [Discord](https://discordapp.com/invite/DFSjPaX) :heart_eyes_cat: +Join our friendly open-source community on [Discord](https://discord.gg/AJSX9DCSUA) :heart_eyes_cat: Just introduce yourself at `#introduce-yourself` and mention `@@Mentor` to get you onboard :neckbeard: Check out the [contribution guideline](./CONTRIBUTING.md), too! We give write permissions to every developer who asks for it. Just text us on -[Discord](https://discord.gg/6ub73U3). +[Discord](https://discord.gg/AJSX9DCSUA). ## Technology Stack From b824ebb9f51068c40f70f110d6ef8b7ba98f69e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 31 May 2021 15:53:07 +0200 Subject: [PATCH 134/181] Correct GitHub name --- CONTRIBUTING.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aecac8945..e52f34c95 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,10 +42,11 @@ There are many volunteers all around the world helping us build this network and You can see the core team behind Human Connection [on our website](https://human-connection.org/en/the-team/). On Github you will mostly run into our developers: -* Ulf (@Tirokk) -* Moriz (@Tirokk) +* Ulf (@ulfgebhardt) +* Moriz (@Mogge) * Wolle (@Tirokk) * Alex (@ogerly) + + + {{ $t('site.made') }} + - - + + {{ $t('site.imprint') }} + + {{ $t('site.imprint') }} + - - {{ $t('site.termsAndConditions') }} + + + {{ $t('site.termsAndConditions') }} + + + {{ $t('site.termsAndConditions') }} + - - {{ $t('site.code-of-conduct') }} + + + {{ $t('site.code-of-conduct') }} + + + {{ $t('site.code-of-conduct') }} + - - + + {{ $t('site.data-privacy') }} + + {{ $t('site.data-privacy') }} + - - + + + {{ $t('site.faq') }} + + {{ $t('site.faq') }} - + import links from '~/constants/links.js' + export default { data() { return { links, version: `v${this.$env.VERSION}` } }, + methods: { + noLinkDefined(link) { + return !link || link.length === 0 + }, + }, } diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 6ef427362..042d76fac 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -771,7 +771,7 @@ "faq": "FAQ", "germany": "Deutschland", "imprint": "Impressum", - "made": "Mit ❤ gemacht", + "made": "Mit ❤️ gemacht", "register": "Registernummer", "responsible": "Verantwortlich für Inhalte dieser Seite (§ 55 Abs. 2 RStV)", "taxident": "Umsatzsteuer-Identifikationsnummer gemäß § 27 a Umsatzsteuergesetz (Deutschland)", diff --git a/webapp/locales/en.json b/webapp/locales/en.json index c5ad5c27f..cdd261700 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -771,7 +771,7 @@ "faq": "FAQ", "germany": "Germany", "imprint": "Imprint", - "made": "Made with ❤", + "made": "Made with ❤️", "register": "Registry number", "responsible": "responsible for contents of this page (§ 55 Abs. 2 RStV)", "taxident": "USt-ID. according to §27a of the German Sales Tax Law:", diff --git a/webapp/locales/es.json b/webapp/locales/es.json index 97f1f247b..1ab09e011 100644 --- a/webapp/locales/es.json +++ b/webapp/locales/es.json @@ -694,7 +694,7 @@ "faq": "Preguntas más frecuentes", "germany": "Alemania", "imprint": "Pie de imprenta", - "made": "Hecho con ❤", + "made": "Hecho con ❤️", "register": "Número de registro", "responsible": "Responsable según § 55 Abs. 2 RStV (Alemania)", "taxident": "Número de identificación del impuesto sobre el valor añadido según el § 27 a de la Ley del Impuesto sobre el Valor Añadido (Alemania)", diff --git a/webapp/locales/fr.json b/webapp/locales/fr.json index fe4cf4b9b..cb4e96bdc 100644 --- a/webapp/locales/fr.json +++ b/webapp/locales/fr.json @@ -662,7 +662,7 @@ "faq": "FAQ", "germany": "Allemagne", "imprint": "Mentions légales", - "made": "Fabriqué avec ❤", + "made": "Fabriqué avec ❤️", "register": "Numéro de registre", "responsible": "Responsable selon § 55 Abs. 2 RStV (Allemagne)", "taxident": "Numéro d'identification à la taxe sur la valeur ajoutée selon § 27 a de la loi sur la taxe sur la valeur ajoutée (Allemagne)", diff --git a/webapp/locales/html/de/faq.html b/webapp/locales/html/de/faq.html new file mode 100644 index 000000000..d51dbf6c2 --- /dev/null +++ b/webapp/locales/html/de/faq.html @@ -0,0 +1 @@ +

Hier stehen die FAQs

diff --git a/webapp/locales/html/de/index.js b/webapp/locales/html/de/index.js index 498bbb866..a97b217d6 100644 --- a/webapp/locales/html/de/index.js +++ b/webapp/locales/html/de/index.js @@ -1,11 +1,13 @@ import termsAndConditions from './terms-and-conditions.html' import codeOfConduct from './code-of-conduct.html' import dataPrivacy from './data-privacy.html' +import faq from './faq.html' import imprint from './imprint.html' export default { termsAndConditions, codeOfConduct, dataPrivacy, + faq, imprint, } diff --git a/webapp/locales/html/en/faq.html b/webapp/locales/html/en/faq.html new file mode 100644 index 000000000..cb019e96e --- /dev/null +++ b/webapp/locales/html/en/faq.html @@ -0,0 +1 @@ +

Here are the FAQs

diff --git a/webapp/locales/html/en/index.js b/webapp/locales/html/en/index.js index 498bbb866..a97b217d6 100644 --- a/webapp/locales/html/en/index.js +++ b/webapp/locales/html/en/index.js @@ -1,11 +1,13 @@ import termsAndConditions from './terms-and-conditions.html' import codeOfConduct from './code-of-conduct.html' import dataPrivacy from './data-privacy.html' +import faq from './faq.html' import imprint from './imprint.html' export default { termsAndConditions, codeOfConduct, dataPrivacy, + faq, imprint, } diff --git a/webapp/locales/it.json b/webapp/locales/it.json index 0832da2cc..a9121d184 100644 --- a/webapp/locales/it.json +++ b/webapp/locales/it.json @@ -612,7 +612,7 @@ "faq": null, "germany": "Germania", "imprint": "Impressum", - "made": "Con ❤ fatto", + "made": "Con ❤️ fatto", "register": "numero di registro", "responsible": "Responsabile ai sensi del § 55 Abs. 2 RStV (Germania)", "taxident": "Numero di identificazione dell'imposta sul valore aggiunto ai sensi del § 27 a Legge sull'imposta sul valore aggiunto (Germania)", diff --git a/webapp/locales/nl.json b/webapp/locales/nl.json index dc5670e9f..3bf453655 100644 --- a/webapp/locales/nl.json +++ b/webapp/locales/nl.json @@ -165,7 +165,7 @@ "director": "Directeur", "germany": "Duitsland", "imprint": "Afdruk", - "made": "Met ❤ gemaakt", + "made": "Met ❤️ gemaakt", "register": "inschrijfnummer", "responsible": "Verantwoordelijk volgens § 55 Abs. 2 RStV (Duitsland).", "taxident": "Identificatienummer voor de belasting over de toegevoegde waarde overeenkomstig § 27 a Wet op de belasting over de toegevoegde waarde (Duitsland).", diff --git a/webapp/locales/pl.json b/webapp/locales/pl.json index d38a62573..7cb3ee3dc 100644 --- a/webapp/locales/pl.json +++ b/webapp/locales/pl.json @@ -350,7 +350,7 @@ "director": "Dyrektor zarządzający", "germany": "Niemcy", "imprint": "Nadruk", - "made": "Z ❤ zrobiony", + "made": "Z ❤️ zrobiony", "register": "numer rejestracyjny", "responsible": "Odpowiedzialny zgodnie z § 55 Abs. 2 RStV (Niemcy)", "taxident": "Numer identyfikacyjny podatku od wartości dodanej zgodnie z § 27 a Ustawa o podatku od wartości dodanej (Niemcy)", diff --git a/webapp/locales/pt.json b/webapp/locales/pt.json index 5f8101c66..277fb9e0b 100644 --- a/webapp/locales/pt.json +++ b/webapp/locales/pt.json @@ -647,7 +647,7 @@ "faq": "FAQ", "germany": "Alemanha", "imprint": "Impressão", - "made": "Feito com ❤", + "made": "Feito com ❤️", "register": "número de registo", "responsible": "Responsável segundo § 55 Abs. 2 RStV (Alemanha) ", "taxident": "Número de identificação do imposto sobre o valor acrescentado de acordo com o § 27 da Lei do Imposto sobre o Valor Acrescentado (Alemanha)", diff --git a/webapp/locales/ru.json b/webapp/locales/ru.json index 95d26690d..72a8deb54 100644 --- a/webapp/locales/ru.json +++ b/webapp/locales/ru.json @@ -694,7 +694,7 @@ "faq": "ЧаВо (FAQ)", "germany": "Германия", "imprint": "Импрессум", - "made": "Сделано с ❤", + "made": "Сделано с ❤️", "register": "Регистрационный номер", "responsible": "ответственный за содержание этой страницы (§ 55 Abs. 2 RStV)", "taxident": "UST-ID. в соответствии с §27a Закона о налоге с продаж Германии:", diff --git a/webapp/pages/code-of-conduct.vue b/webapp/pages/code-of-conduct.vue index 7b3455934..c3cf3bf54 100644 --- a/webapp/pages/code-of-conduct.vue +++ b/webapp/pages/code-of-conduct.vue @@ -1,6 +1,6 @@