mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Fix as quick fix for all reminding tests
This commit is contained in:
parent
c498cbc299
commit
62de9a158e
@ -9,4 +9,3 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
@ -30,7 +30,9 @@ const updatePostMutation = gql`
|
||||
}
|
||||
`
|
||||
|
||||
beforeAll(() => {
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const createServerResult = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -46,6 +48,10 @@ beforeAll(() => {
|
||||
mutate = createTestClientResult.mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
hashtagingUser = await neode.create(
|
||||
'User',
|
||||
@ -66,6 +72,7 @@ beforeEach(async () => {
|
||||
})
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -12,6 +12,8 @@ const driver = getDriver()
|
||||
const neode = getNeode()
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -43,7 +45,6 @@ describe('languagesMiddleware', () => {
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
const user = await Factory.build('user')
|
||||
authenticatedUser = await user.toJson()
|
||||
await Factory.build('category', {
|
||||
|
||||
@ -37,6 +37,7 @@ const createCommentMutation = gql`
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
publishSpy = jest.spyOn(pubsub, 'publish')
|
||||
const createServerResult = createServer({
|
||||
context: () => {
|
||||
@ -53,6 +54,10 @@ beforeAll(async () => {
|
||||
mutate = createTestClientResult.mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
publishSpy.mockClear()
|
||||
notifiedUser = await neode.create(
|
||||
@ -74,6 +79,7 @@ beforeEach(async () => {
|
||||
})
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -13,6 +13,7 @@ const neode = getNeode()
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -25,6 +26,10 @@ beforeAll(async () => {
|
||||
mutate = createTestClient(server).mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
variables = {}
|
||||
const admin = await Factory.build('user', {
|
||||
@ -46,6 +51,7 @@ beforeEach(async () => {
|
||||
authenticatedUser = await admin.toJson()
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -15,6 +15,8 @@ const action = () => {
|
||||
}
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
// For performance reasons we do this only once
|
||||
const users = await Promise.all([
|
||||
Factory.build('user', { id: 'u1', role: 'user' }),
|
||||
|
||||
@ -19,6 +19,7 @@ const postQuery = gql`
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
aUser = await Factory.build('user', {
|
||||
id: 'a-user',
|
||||
})
|
||||
|
||||
@ -50,7 +50,6 @@ const reviewMutation = gql`
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const updateUserMutation = gql`
|
||||
mutation ($id: ID!, $name: String) {
|
||||
UpdateUser(id: $id, name: $name) {
|
||||
@ -58,7 +57,10 @@ const updateUserMutation = gql`
|
||||
}
|
||||
}
|
||||
`
|
||||
beforeAll(() => {
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -71,6 +73,10 @@ beforeAll(() => {
|
||||
mutate = createTestClient(server).mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
users = await Promise.all([
|
||||
Factory.build('user', {
|
||||
@ -120,6 +126,7 @@ beforeEach(async () => {
|
||||
offensivePost = posts[0]
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -3,6 +3,15 @@ import { getNeode } from '../db/neo4j'
|
||||
|
||||
const neode = getNeode()
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -11,6 +11,7 @@ let variables, mutate, authenticatedUser, commentAuthor, newlyCreatedComment
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -22,6 +23,10 @@ beforeAll(async () => {
|
||||
mutate = createTestClient(server).mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
variables = {}
|
||||
await neode.create('Category', {
|
||||
@ -31,6 +36,7 @@ beforeEach(async () => {
|
||||
})
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -29,6 +29,14 @@ const donationsQuery = gql`
|
||||
}
|
||||
`
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
describe('donations', () => {
|
||||
let currentUser, newlyCreatedDonations
|
||||
beforeAll(async () => {
|
||||
@ -52,6 +60,7 @@ describe('donations', () => {
|
||||
newlyCreatedDonations = await Factory.build('donations')
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -12,12 +12,9 @@ let user
|
||||
let variables
|
||||
const driver = getDriver()
|
||||
|
||||
beforeEach(async () => {
|
||||
variables = {}
|
||||
})
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -31,6 +28,15 @@ beforeAll(async () => {
|
||||
query = createTestClient(server).query
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
variables = {}
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -27,7 +27,6 @@ const mutationFollowUser = gql`
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const mutationUnfollowUser = gql`
|
||||
mutation ($id: ID!) {
|
||||
unfollowUser(id: $id) {
|
||||
@ -40,7 +39,6 @@ const mutationUnfollowUser = gql`
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const userQuery = gql`
|
||||
query ($id: ID) {
|
||||
User(id: $id) {
|
||||
@ -54,6 +52,7 @@ const userQuery = gql`
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => ({
|
||||
driver,
|
||||
@ -70,6 +69,10 @@ beforeAll(async () => {
|
||||
mutate = testClient.mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
user1 = await Factory.build(
|
||||
'user',
|
||||
@ -98,6 +101,7 @@ beforeEach(async () => {
|
||||
variables = { id: user2.id }
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -9,12 +9,24 @@ const uuid = '[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-
|
||||
let uploadCallback
|
||||
let deleteCallback
|
||||
|
||||
beforeEach(async () => {
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
uploadCallback = jest.fn(({ uniqueFilename }) => `/uploads/${uniqueFilename}`)
|
||||
deleteCallback = jest.fn()
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
describe('deleteImage', () => {
|
||||
describe('given a resource with an image', () => {
|
||||
let user
|
||||
|
||||
@ -19,7 +19,6 @@ const generateInviteCodeMutation = gql`
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const myInviteCodesQuery = gql`
|
||||
query {
|
||||
MyInviteCodes {
|
||||
@ -29,7 +28,6 @@ const myInviteCodesQuery = gql`
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const isValidInviteCodeQuery = gql`
|
||||
query ($code: ID!) {
|
||||
isValidInviteCode(code: $code)
|
||||
@ -38,6 +36,7 @@ const isValidInviteCodeQuery = gql`
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
|
||||
@ -9,7 +9,9 @@ let mutate, authenticatedUser
|
||||
const driver = getDriver()
|
||||
const neode = getNeode()
|
||||
|
||||
beforeAll(() => {
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -22,6 +24,11 @@ beforeAll(() => {
|
||||
mutate = createTestClient(server).mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -54,6 +54,7 @@ const reviewMutation = gql`
|
||||
describe('moderate resources', () => {
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
authenticatedUser = undefined
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
@ -67,6 +68,10 @@ describe('moderate resources', () => {
|
||||
mutate = createTestClient(server).mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
disableVariables = {
|
||||
resourceId: 'undefined-resource',
|
||||
@ -104,6 +109,7 @@ describe('moderate resources', () => {
|
||||
)
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -12,7 +12,9 @@ let variables
|
||||
let query
|
||||
let mutate
|
||||
|
||||
beforeAll(() => {
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -25,11 +27,16 @@ beforeAll(() => {
|
||||
mutate = createTestClient(server).mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
authenticatedUser = null
|
||||
variables = { orderBy: 'createdAt_asc' }
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -20,11 +20,9 @@ const getAllPasswordResets = async () => {
|
||||
return resets
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
variables = {}
|
||||
})
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
beforeAll(() => {
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -37,6 +35,15 @@ beforeAll(() => {
|
||||
mutate = createTestClient(server).mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
variables = {}
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -40,6 +40,7 @@ const createPostMutation = gql`
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -53,6 +54,10 @@ beforeAll(async () => {
|
||||
mutate = createTestClient(server).mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
variables = {}
|
||||
user = await Factory.build(
|
||||
@ -91,6 +96,7 @@ beforeEach(async () => {
|
||||
authenticatedUser = null
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -12,12 +12,9 @@ let authenticatedUser
|
||||
let variables
|
||||
const driver = getDriver()
|
||||
|
||||
beforeEach(async () => {
|
||||
variables = {}
|
||||
})
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -30,6 +27,15 @@ beforeAll(async () => {
|
||||
mutate = createTestClient(server).mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
variables = {}
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -101,6 +101,7 @@ describe('file a report on a resource', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -114,6 +115,11 @@ describe('file a report on a resource', () => {
|
||||
query = createTestClient(server).query
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -17,6 +17,7 @@ describe('rewards', () => {
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -30,6 +31,10 @@ describe('rewards', () => {
|
||||
mutate = createTestClient(server).mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
regularUser = await Factory.build(
|
||||
'user',
|
||||
@ -70,6 +75,7 @@ describe('rewards', () => {
|
||||
})
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -11,6 +11,7 @@ const neode = getNeode()
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
|
||||
@ -31,7 +31,10 @@ const queryPost = gql`
|
||||
|
||||
describe('shout and unshout posts', () => {
|
||||
let currentUser, postAuthor
|
||||
beforeAll(() => {
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
authenticatedUser = undefined
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
@ -45,6 +48,11 @@ describe('shout and unshout posts', () => {
|
||||
mutate = createTestClient(server).mutate
|
||||
query = createTestClient(server).query
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
currentUser = await Factory.build(
|
||||
'user',
|
||||
@ -70,6 +78,8 @@ describe('shout and unshout posts', () => {
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -6,6 +6,14 @@ import { getDriver } from '../../db/neo4j'
|
||||
|
||||
const driver = getDriver()
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
describe('SocialMedia', () => {
|
||||
let socialMediaAction, someUser, ownerNode, owner
|
||||
|
||||
@ -61,6 +69,7 @@ describe('SocialMedia', () => {
|
||||
}
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -22,6 +22,8 @@ const statisticsQuery = gql`
|
||||
}
|
||||
`
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
authenticatedUser = undefined
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
@ -33,9 +35,13 @@ beforeAll(async () => {
|
||||
},
|
||||
})
|
||||
query = createTestClient(server).query
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -9,8 +9,32 @@ let query, authenticatedUser
|
||||
const driver = getDriver()
|
||||
const neode = getNeode()
|
||||
|
||||
const userDataQuery = gql`
|
||||
query ($id: ID!) {
|
||||
userData(id: $id) {
|
||||
user {
|
||||
id
|
||||
name
|
||||
slug
|
||||
}
|
||||
posts {
|
||||
id
|
||||
title
|
||||
content
|
||||
comments {
|
||||
content
|
||||
author {
|
||||
slug
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const user = await Factory.build('user', {
|
||||
id: 'a-user',
|
||||
name: 'John Doe',
|
||||
@ -38,29 +62,6 @@ afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
const userDataQuery = gql`
|
||||
query ($id: ID!) {
|
||||
userData(id: $id) {
|
||||
user {
|
||||
id
|
||||
name
|
||||
slug
|
||||
}
|
||||
posts {
|
||||
id
|
||||
title
|
||||
content
|
||||
comments {
|
||||
content
|
||||
author {
|
||||
slug
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
describe('resolvers/userData', () => {
|
||||
let variables = { id: 'a-user' }
|
||||
|
||||
|
||||
@ -29,12 +29,9 @@ const disable = async (id) => {
|
||||
])
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
user = null
|
||||
req = { headers: {} }
|
||||
})
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
beforeAll(() => {
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
// One of the rare occasions where we test
|
||||
@ -46,6 +43,16 @@ beforeAll(() => {
|
||||
mutate = createTestClient(server).mutate
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
user = null
|
||||
req = { headers: {} }
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -44,7 +44,6 @@ const deleteUserMutation = gql`
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const switchUserRoleMutation = gql`
|
||||
mutation ($role: UserGroup!, $id: ID!) {
|
||||
switchUserRole(role: $role, id: $id) {
|
||||
@ -57,7 +56,9 @@ const switchUserRoleMutation = gql`
|
||||
}
|
||||
`
|
||||
|
||||
beforeAll(() => {
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -71,7 +72,12 @@ beforeAll(() => {
|
||||
mutate = createTestClient(server).mutate
|
||||
})
|
||||
|
||||
beforeEach(async () => {
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
|
||||
@ -15,7 +15,6 @@ const updateUserMutation = gql`
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const queryLocations = gql`
|
||||
query ($place: String!, $lang: String!) {
|
||||
queryLocations(place: $place, lang: $lang) {
|
||||
@ -24,7 +23,6 @@ const queryLocations = gql`
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
const newlyCreatedNodesWithLocales = [
|
||||
{
|
||||
city: {
|
||||
@ -74,7 +72,9 @@ const newlyCreatedNodesWithLocales = [
|
||||
},
|
||||
]
|
||||
|
||||
beforeAll(() => {
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
@ -88,12 +88,19 @@ beforeAll(() => {
|
||||
query = createTestClient(server).query
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
variables = {}
|
||||
authenticatedUser = null
|
||||
})
|
||||
|
||||
afterEach(cleanDatabase)
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
describe('Location Service', () => {
|
||||
// Authentication
|
||||
|
||||
@ -12,6 +12,14 @@ let mutedUser
|
||||
let authenticatedUser
|
||||
let server
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
afterAll(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
beforeEach(() => {
|
||||
authenticatedUser = undefined
|
||||
;({ server } = createServer({
|
||||
@ -28,6 +36,7 @@ beforeEach(() => {
|
||||
}))
|
||||
})
|
||||
|
||||
// TODO: avoid database clean after each test in the future if possible for performance and flakyness reasons by filling the database step by step, see issue https://github.com/Ocelot-Social-Community/Ocelot-Social/issues/4543
|
||||
afterEach(async () => {
|
||||
await cleanDatabase()
|
||||
})
|
||||
|
||||
@ -13,6 +13,7 @@ let variables
|
||||
|
||||
beforeAll(async () => {
|
||||
await cleanDatabase()
|
||||
|
||||
const { server } = createServer({
|
||||
context: () => {
|
||||
return {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user