23 Commits

Author SHA1 Message Date
Alina Beck
77f4810ddc set up global localVue
by setting up localVue with all required plugins (such as styleguide and vuex)
in a separate testSetup file we can avoid doing this individually in all component tests
the testSetup is executed before each test suite, so each test file gets a fresh
instance of localVue
2019-11-20 12:31:40 +03:00
mattwr18
fd388fc1ba Fix tests for changed implementation
- we do not display a load more button when there are clearly no more
posts to load... if there are at least 6, the pageSize, we display it
because there might or might not be posts to load
2019-10-04 12:34:48 +02:00
roschaefer
1bd57dfeb8 Fix console.errors in test 2019-09-06 16:42:16 +02:00
roschaefer
e4d57f80aa Fix #1333
Ok, so here are multiple issues:
1. In cypher, `NOT NULL` will return `NULL` not `FALSE`. If we want
`FALSE` to be set in the database import, we should use `COAELESCE`
to find the first not-null value.
See:
https://neo4j.com/docs/cypher-manual/current/syntax/working-with-null/
https://markhneedham.com/blog/2017/02/22/neo4j-null-values-even-work/

2. I removed the `disabled` and `deleted` checks on the commented
counter. With `neo4j-graphql-js` it is not possible to filter on the
join models (at least not without a lot of complexity) for disabled or
deleted items. Let's live with the fact that the list of commented posts
will include those posts, where the user has deleted his comment or where
the user's comment was disabled. It's being displayed as "not available"
so I think this is OK for now.

3. De-couple the pagination counters from the "commented", "shouted"
etc. counters. It might be that the list of posts is different for
different users. E.g. if the user has blocked you, the "posts" list
will be empty. The "shouted" or "commented" list will not have the
posts of the author. If you are a moderator, the list will include
disabled posts. So the counters are not in sync with the actual list
coming from the backend. Therefore I implemented "fetch and check if
resultSet < pageSize" instead of a global counter.
2019-08-28 12:57:32 +02:00
Matt Rider
2af4151918 Update to use <client-only> instead of <no-ssr> 2019-08-26 17:09:24 +02:00
Robert Schäfer
f5c939472b Fix console.errors in frontend tests
@MoldaB here's how you can register plugins in a frontend test. Pro tip:
You can run `yarn run test --run-in-band` to find out where the
console.errors come from. Jest, by default, runs in parallel which makes
it a little difficult to debug errors that don't fail the test.
2019-08-15 11:08:42 +02:00
Wolfgang Huß
68dcbacaff Merge branch 'master' of https://github.com/Human-Connection/Human-Connection into 734-authorization-problem-disabling-post
# Conflicts:
#	webapp/components/ContributionForm/index.vue
#	webapp/graphql/PostMutations.js
2019-06-14 19:02:33 +02:00
Matt Rider
1c10e0863f Merge branch 'master' of github.com:Human-Connection/Human-Connection into 781-language-of-contribution 2019-06-14 13:31:39 -03:00
Wolfgang Huß
58b36372b9 Merge remote-tracking branch 'origin/master' into 734-authorization-problem-disabling-post
# Conflicts:
#	webapp/pages/profile/_id/_slug.spec.js

Defined missing `$filter.truncate` which made console errors in the webapp Jest test.
2019-06-14 11:11:22 +02:00
Wolfgang Huß
482ac1572b Refactored and created the tests of DeletePostCallback
Created a folder `utils` for PostHelpers.js.
Fixed a new incoming problem of the master with deleting Posts on the User Profile.

Co-Authored-By: mattwr18 <mattwr18@gmail.com>
2019-06-13 19:23:13 +02:00
Robert Schäfer
b8c5db48a6 Implement prefix of image urls with a filter
Fix #820

Ok, so after I would have to use the same method in three different
locations (`<ds-card>` expects an `image` attribute but cannot render
entire components) I decided to implement the prefix of image urls with
a filter rather than a component. The downside of this is that we have
to add the filter on a lot of component tests. The benefit is less
components and hopefully less complexity.
2019-06-13 16:56:41 +02:00
Matt Rider
40aaa151dd Merge branch 'master' of github.com:Human-Connection/Human-Connection into 781-language-of-contribution 2019-06-12 16:42:40 -03:00
Wolfgang Huß
1339734281 Rename DeleteModal to ConfirmModel and write some refactor some tests
Co-Authored-By: mattwr18 <mattwr18@gmail.com>
2019-06-12 18:02:50 +02:00
Wolfgang Huß
1c6016ddcc Refactored the PostHelpers to an imported lib instead a mixin 2019-06-12 09:05:43 +02:00
Matt Rider
4407d6648a Add component tests, translations 2019-06-11 15:47:10 -03:00
Robert Schäfer
5eaac8b077 Document loading spinner implementation with test
Because it's slightly odd how I avoid a duplicate loading spinner, I
 thought this is a good target for a test.
2019-06-11 18:48:01 +02:00
Robert Schäfer
15b7043d00 Write a test for "load more" button
The crucial test is still missing: Write a test to check that no more
than one loading spinner is visible all the time.

@Tirokk FYI I wrote a page component test and made sure that the test
will also fail if the implementation is broken.
2019-06-08 01:50:08 +02:00
Robert Schäfer
9384f85ebf Use jest's expectation matchers if possible
@Tirokk jest has a lot of assertion matchers that will give you better
error messages than the default ones:
https://jestjs.io/docs/en/expect.html#tohavelengthnumber
2019-06-07 16:53:30 +02:00
Robert Schäfer
de0bcd949a Fix test 2019-06-07 01:39:09 +02:00
Wolfgang Huß
3e3e447bc5 Refactored three quater of the tests 2019-05-29 17:59:07 +02:00
Wolfgang Huß
19771a342e First approach to test '_slug.spec.js' 2019-05-29 12:19:51 +02:00
Wolfgang Huß
f9fe4f742f Lint fixes 2019-05-27 12:39:37 +02:00
Wolfgang Huß
8bcb250951 Started to rewrite the tests of DeleteModal.vue 2019-05-23 10:22:36 +02:00