Skip to content

Commit

Permalink
SBERDOMA-192 Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoviazin committed Aug 5, 2021
1 parent 447084a commit 3d6aec6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apps/condo/domains/ticket/gql.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const TicketCategoryClassifier = generateGqlQueries('TicketCategoryClassifier',
const TICKET_DESCRIPTION_CLASSIFIER_FIELDS = `{ organization { id } name ${COMMON_FIELDS} }`
const TicketDescriptionClassifier = generateGqlQueries('TicketDescriptionClassifier', TICKET_DESCRIPTION_CLASSIFIER_FIELDS)

const TICKET_CLASSIFIER_RULE_FIELDS = '{ place { id name } category { id name } description { id name } id dv }'
const TICKET_CLASSIFIER_RULE_FIELDS = `{ place { id name } category { id name } description { id name } ${COMMON_FIELDS} }`
const TicketClassifierRule = generateGqlQueries('TicketClassifierRule', TICKET_CLASSIFIER_RULE_FIELDS)

/* AUTOGENERATE MARKER <CONST> */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('TicketDescriptionClassifier CRUD', () => {
})
it('can not update', async () => {
const admin = await makeLoggedInAdminClient()
const [_, userAttrs] = await createTestUser(admin)
const [, userAttrs] = await createTestUser(admin)
const client = await makeLoggedInClient(userAttrs)
const [objCreated] = await createTestTicketDescriptionClassifier(admin)
const payload = { name: faker.lorem.word() }
Expand Down
16 changes: 9 additions & 7 deletions apps/condo/domains/ticket/utils/testSchema/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
const faker = require('faker')
const { get } = require('lodash')
const { makeClientWithProperty } = require('@condo/domains/property/utils/testSchema')
const { makeLoggedInAdminClient } = require('@core/keystone/test.utils')
const { TICKET_STATUS_TYPES } = require('../../constants')
const { generateGQLTestUtils } = require('@condo/domains/common/utils/codegeneration/generate.test.utils')
const { Ticket: TicketGQL } = require('@condo/domains/ticket/gql')
Expand Down Expand Up @@ -280,7 +281,6 @@ async function updateTestTicketCategoryClassifier (client, id, extraAttrs = {})
const attrs = {
dv: 1,
sender,
name: faker.lorem.word(),
...extraAttrs,
}
const obj = await TicketCategoryClassifier.update(client, id, attrs)
Expand All @@ -293,6 +293,7 @@ async function createTestTicketDescriptionClassifier (client, extraAttrs = {}) {
const attrs = {
dv: 1,
sender,
name: faker.lorem.word(),
...extraAttrs,
}
const obj = await TicketDescriptionClassifier.create(client, attrs)
Expand All @@ -315,15 +316,16 @@ async function updateTestTicketDescriptionClassifier (client, id, extraAttrs = {
async function createTestTicketClassifierRule (client, extraAttrs = {}) {
if (!client) throw new Error('no client')
const sender = { dv: 1, fingerprint: faker.random.alphaNumeric(8) }
const [place] = await createTestTicketPlaceClassifier()
const [category] = await createTestTicketCategoryClassifier()
const [description] = await createTestTicketDescriptionClassifier()
const admin = await makeLoggedInAdminClient()
const [place] = await createTestTicketPlaceClassifier(admin)
const [category] = await createTestTicketCategoryClassifier(admin)
const [description] = await createTestTicketDescriptionClassifier(admin)
const attrs = {
dv: 1,
sender,
place: { connect: place.id },
category: { connect: category.id },
description: { connect: description.id },
place: { connect: { id: place.id } },
category: { connect: { id: category.id } },
description: { connect: { id: description.id } },
...extraAttrs,
}
const obj = await TicketClassifierRule.create(client, attrs)
Expand Down

0 comments on commit 3d6aec6

Please sign in to comment.