chore: save pending changes
This commit is contained in:
@@ -709,4 +709,28 @@ describe('Manual bank cards configured HTTP and real SQLite', () => {
|
||||
}),
|
||||
).rejects.toMatchObject({ code: 'P2002' });
|
||||
});
|
||||
it('persists payment systems, preserves omitted metadata and allows clearing', async () => {
|
||||
const card = await createCard('1000', owner, { paymentSystem: 'mir' });
|
||||
expect((await getCard(card.id)).paymentSystem).toBe('mir');
|
||||
await auth('patch', '/' + card.id)
|
||||
.send({ version: 1, name: 'Renamed' })
|
||||
.expect(200);
|
||||
expect((await getCard(card.id)).paymentSystem).toBe('mir');
|
||||
await auth('patch', '/' + card.id)
|
||||
.send({ version: 2, paymentSystem: 'visa' })
|
||||
.expect(200);
|
||||
expect((await getCard(card.id)).paymentSystem).toBe('visa');
|
||||
await auth('patch', '/' + card.id)
|
||||
.send({ version: 3, paymentSystem: 'unknown' })
|
||||
.expect(400);
|
||||
await auth('patch', '/' + card.id)
|
||||
.send({ version: 3, paymentSystem: null })
|
||||
.expect(200);
|
||||
expect((await getCard(card.id)).paymentSystem).toBeNull();
|
||||
expect((await createCard()).paymentSystem).toBeNull();
|
||||
expect(
|
||||
(await createCard('1000', owner, { paymentSystem: 'mastercard' }))
|
||||
.paymentSystem,
|
||||
).toBe('mastercard');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user