|
@@ -0,0 +1,28 @@
|
|
|
|
|
+import test from 'node:test'
|
|
|
|
|
+import assert from 'node:assert/strict'
|
|
|
|
|
+import {
|
|
|
|
|
+ isPaymentEntryView,
|
|
|
|
|
+ filterProtocolActionsForPaymentEntry
|
|
|
|
|
+} from './payment-entry.js'
|
|
|
|
|
+
|
|
|
|
|
+test('isPaymentEntryView detects from=payment', () => {
|
|
|
|
|
+ assert.equal(isPaymentEntryView({ from: 'payment' }), true)
|
|
|
|
|
+ assert.equal(isPaymentEntryView({ from: 'Payment' }), false)
|
|
|
|
|
+ assert.equal(isPaymentEntryView({}), false)
|
|
|
|
|
+ assert.equal(isPaymentEntryView(null), false)
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+test('filterProtocolActionsForPaymentEntry hides edit and delete', () => {
|
|
|
|
|
+ assert.deepEqual(
|
|
|
|
|
+ filterProtocolActionsForPaymentEntry(['view', 'edit', 'delete', 'create']),
|
|
|
|
|
+ ['view']
|
|
|
|
|
+ )
|
|
|
|
|
+ assert.deepEqual(
|
|
|
|
|
+ filterProtocolActionsForPaymentEntry([
|
|
|
|
|
+ { code: 'edit' },
|
|
|
|
|
+ { code: 'delete' },
|
|
|
|
|
+ { code: 'view' }
|
|
|
|
|
+ ]),
|
|
|
|
|
+ [{ code: 'view' }]
|
|
|
|
|
+ )
|
|
|
|
|
+})
|