Skip to content

Commit

Permalink
Expanded number of tests in initCSF.test.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
sponglord committed Dec 8, 2023
1 parent 479cbef commit 2e9b82f
Showing 1 changed file with 49 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('Calling initCSF', () => {
expect(() => initCSF({ rootNode: {}, clientKey: 'fsdg', type: 'card' })).toThrow(/WARNING Config :: no loadingContext has been specified!/);
});

test('initializing correctly should lead to the return of a CSF object exposing key functions', () => {
test('initializing correctly (for a "card") should lead to the return of a CSF object exposing key functions', () => {
/* @ts-ignore deliberately-not-implementing-all-members */
const csf = initCSF({ rootNode: {}, clientKey: 'fsdg', type: 'card', loadingContext: 'http' });

Expand All @@ -77,4 +77,52 @@ describe('Calling initCSF', () => {
expect(csf).toHaveProperty('setKCPStatus');
expect(csf).toHaveProperty('sfIsOptionalOrHidden');
});

test('initializing correctly (for a non-card) should lead to the return of a CSF object exposing key functions', () => {
/* @ts-ignore deliberately-not-implementing-all-members */
const csf = initCSF({ rootNode: {}, clientKey: 'fsdg', type: 'ach', loadingContext: 'http' });

expect(csf).toHaveProperty('updateStyles');
expect(csf).toHaveProperty('setFocusOnFrame');
expect(csf).toHaveProperty('isValidated');
expect(csf).toHaveProperty('hasUnsupportedCard');
expect(csf).toHaveProperty('destroy');
expect(csf).toHaveProperty('brandsFromBinLookup');
expect(csf).toHaveProperty('addSecuredField');
expect(csf).toHaveProperty('removeSecuredField');
expect(csf).toHaveProperty('setKCPStatus');
expect(csf).toHaveProperty('sfIsOptionalOrHidden');
});

test('initializing for a "card" with one brand should lead to the return of a CSF object exposing key functions', () => {
/* @ts-ignore deliberately-not-implementing-all-members */
const csf = initCSF({ rootNode: {}, clientKey: 'fsdg', type: 'card', loadingContext: 'http', cardGroupTypes: ['mc'] });

expect(csf).toHaveProperty('updateStyles');
expect(csf).toHaveProperty('setFocusOnFrame');
expect(csf).toHaveProperty('isValidated');
expect(csf).toHaveProperty('hasUnsupportedCard');
expect(csf).toHaveProperty('destroy');
expect(csf).toHaveProperty('brandsFromBinLookup');
expect(csf).toHaveProperty('addSecuredField');
expect(csf).toHaveProperty('removeSecuredField');
expect(csf).toHaveProperty('setKCPStatus');
expect(csf).toHaveProperty('sfIsOptionalOrHidden');
});

test('initializing for a "card" with one unrecognised brand should lead to the return of a CSF object exposing key functions', () => {
/* @ts-ignore deliberately-not-implementing-all-members */
const csf = initCSF({ rootNode: {}, clientKey: 'fsdg', type: 'card', loadingContext: 'http', cardGroupTypes: ['madeupcard'] });

expect(csf).toHaveProperty('updateStyles');
expect(csf).toHaveProperty('setFocusOnFrame');
expect(csf).toHaveProperty('isValidated');
expect(csf).toHaveProperty('hasUnsupportedCard');
expect(csf).toHaveProperty('destroy');
expect(csf).toHaveProperty('brandsFromBinLookup');
expect(csf).toHaveProperty('addSecuredField');
expect(csf).toHaveProperty('removeSecuredField');
expect(csf).toHaveProperty('setKCPStatus');
expect(csf).toHaveProperty('sfIsOptionalOrHidden');
});
});

0 comments on commit 2e9b82f

Please sign in to comment.