This commit is contained in:
einhorn_b 2023-11-06 10:10:08 +01:00
parent f03f428477
commit dfb85d036b
3 changed files with 5 additions and 26 deletions

View File

@ -497,28 +497,6 @@ describe('ContributionResolver', () => {
})
})
it('throws an error', async () => {
jest.clearAllMocks()
const { errors: errorObjects } = await mutate({
mutation: adminUpdateContribution,
variables: {
id: pendingContribution.data.createContribution.id,
amount: 10.0,
memo: 'Test env contribution',
creationDate: new Date().toString(),
},
})
expect(errorObjects).toEqual([
new GraphQLError('An admin is not allowed to update an user contribution'),
])
})
it('logs the error "An admin is not allowed to update an user contribution"', () => {
expect(logger.error).toBeCalledWith(
'An admin is not allowed to update an user contribution',
)
})
describe('contribution has wrong status', () => {
beforeAll(async () => {
const contribution = await Contribution.findOneOrFail({
@ -2824,7 +2802,8 @@ describe('ContributionResolver', () => {
} = await query({
query: adminListContributions,
})
// console.log('17 contributions: %s', JSON.stringify(contributionListObject, null, 2))
// console.log('18 contributions: %s', JSON.stringify(contributionListObject, null, 2))
// console.log(contributionListObject)
expect(contributionListObject.contributionList).toHaveLength(18)
expect(contributionListObject).toMatchObject({
contributionCount: 18,

View File

@ -19,7 +19,7 @@ export class UnconfirmedContributionUserRole extends UnconfirmedContributionRole
this.self.contributionStatus = ContributionStatus.PENDING
this.self.updatedAt = new Date()
// null because updated by user them self
this.self.updatedBy = undefined
this.self.updatedBy = null
}
public checkAuthorization(user: User): UnconfirmedContributionRole {

View File

@ -85,8 +85,8 @@ export class Contribution extends BaseEntity {
@Column({ nullable: true, name: 'updated_at' })
updatedAt: Date
@Column({ nullable: true, unsigned: true, name: 'updated_by' })
updatedBy?: number
@Column({ nullable: true, unsigned: true, name: 'updated_by', type: 'int' })
updatedBy: number | null
@DeleteDateColumn({ name: 'deleted_at' })
deletedAt: Date | null