-
-
Notifications
You must be signed in to change notification settings - Fork 682
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SSK_DUSSELDORF_DUSSDEDDXXX: remove non-booked transactions from import (
#553) * remove non-booked transactions from import * Add release notes * minor fix to please the linter * Add coderabbit suggestions * add test file * fix test * add coderabbit fixes to test file * fix mock console * Correct consoleSpy to make linter happy * Add mock cleanup
- Loading branch information
1 parent
5ada00c
commit 0312f51
Showing
3 changed files
with
125 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
src/app-gocardless/banks/tests/ssk_dusseldorf_dussdeddxxx.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import { jest } from '@jest/globals'; | ||
import SskDusseldorfDussdeddxxx from '../ssk_dusseldorf_dussdeddxxx.js'; | ||
|
||
describe('ssk_dusseldorf_dussdeddxxx', () => { | ||
let consoleSpy; | ||
|
||
beforeEach(() => { | ||
consoleSpy = jest.spyOn(console, 'debug'); | ||
}); | ||
|
||
afterEach(() => { | ||
consoleSpy.mockRestore(); | ||
}); | ||
|
||
describe('#normalizeTransaction', () => { | ||
const bookedTransactionOne = { | ||
transactionId: '2024102900000000-1', | ||
bookingDate: '2024-10-29', | ||
valueDate: '2024-10-29', | ||
transactionAmount: { | ||
amount: '-99.99', | ||
currency: 'EUR', | ||
}, | ||
creditorName: 'a useful creditor name', | ||
remittanceInformationStructured: 'structured information', | ||
remittanceInformationUnstructured: 'unstructured information', | ||
additionalInformation: 'some additional information', | ||
}; | ||
|
||
const bookedTransactionTwo = { | ||
transactionId: '2024102900000000-2', | ||
bookingDate: '2024-10-29', | ||
valueDate: '2024-10-29', | ||
transactionAmount: { | ||
amount: '-99.99', | ||
currency: 'EUR', | ||
}, | ||
creditorName: 'a useful creditor name', | ||
ultimateCreditor: 'ultimate creditor', | ||
remittanceInformationStructured: 'structured information', | ||
additionalInformation: 'some additional information', | ||
}; | ||
|
||
it('properly combines remittance information', () => { | ||
expect( | ||
SskDusseldorfDussdeddxxx.normalizeTransaction( | ||
bookedTransactionOne, | ||
true, | ||
).remittanceInformationUnstructured, | ||
).toEqual('unstructured information some additional information'); | ||
|
||
expect( | ||
SskDusseldorfDussdeddxxx.normalizeTransaction( | ||
bookedTransactionTwo, | ||
true, | ||
).remittanceInformationUnstructured, | ||
).toEqual('structured information some additional information'); | ||
}); | ||
|
||
it('prioritizes creditor names correctly', () => { | ||
expect( | ||
SskDusseldorfDussdeddxxx.normalizeTransaction( | ||
bookedTransactionOne, | ||
true, | ||
).payeeName, | ||
).toEqual('A Useful Creditor Name'); | ||
|
||
expect( | ||
SskDusseldorfDussdeddxxx.normalizeTransaction( | ||
bookedTransactionTwo, | ||
true, | ||
).payeeName, | ||
).toEqual('Ultimate Creditor'); | ||
}); | ||
|
||
const unbookedTransaction = { | ||
transactionId: '2024102900000000-1', | ||
valueDate: '2024-10-29', | ||
transactionAmount: { | ||
amount: '-99.99', | ||
currency: 'EUR', | ||
}, | ||
creditorName: 'some nonsensical creditor', | ||
remittanceInformationUnstructured: 'some nonsensical information', | ||
}; | ||
|
||
it('returns null for unbooked transactions', () => { | ||
expect( | ||
SskDusseldorfDussdeddxxx.normalizeTransaction( | ||
unbookedTransaction, | ||
false, | ||
), | ||
).toBeNull(); | ||
|
||
expect(consoleSpy).toHaveBeenCalledWith( | ||
'Skipping unbooked transaction:', | ||
unbookedTransaction.transactionId, | ||
); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
category: Enhancements | ||
authors: [DennaGherlyn] | ||
--- | ||
|
||
Remove non-booked transactions from import of SSK_DUSSELDORF_DUSSDEDDXXX due to placeholder text in the payee and notes field |