-
Notifications
You must be signed in to change notification settings - Fork 568
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include branded in HCF eligibility check
- Loading branch information
1 parent
e628f02
commit 37358d0
Showing
5 changed files
with
68 additions
and
1 deletion.
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
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,55 @@ | ||
/* @flow */ | ||
|
||
import { FUNDING } from "@paypal/sdk-constants/src"; | ||
|
||
import { | ||
createTestContainer, | ||
destroyTestContainer, | ||
mockProp, | ||
assert, | ||
} from "../common"; | ||
|
||
describe.only(`paypal card fields component`, () => { | ||
beforeEach(() => { | ||
createTestContainer(); | ||
}); | ||
|
||
afterEach(() => { | ||
destroyTestContainer(); | ||
}); | ||
|
||
it(`should not be eligible or render when branded is true`, (done) => { | ||
const fundingSource = FUNDING.CARD; | ||
mockProp(window.__TEST_FUNDING_ELIGIBILITY__, fundingSource, { | ||
eligible: true, | ||
branded: true, | ||
}); | ||
|
||
const cardButton = window.paypal.Buttons({ | ||
fundingSource, | ||
}); | ||
|
||
const cardFields = window.paypal.CardFields({}); | ||
|
||
assert.equal(cardFields.isEligible(), false); | ||
done(); | ||
}); | ||
|
||
it(`should be eligible when branded is false`, (done) => { | ||
const fundingSource = FUNDING.CARD; | ||
mockProp(window.__TEST_FUNDING_ELIGIBILITY__, fundingSource, { | ||
eligible: true, | ||
branded: false, | ||
}); | ||
window.__COMPONENTS__ = ["buttons", "card-fields"]; | ||
|
||
const cardButton = window.paypal.Buttons({ | ||
fundingSource, | ||
}); | ||
|
||
const cardFields = window.paypal.CardFields({}); | ||
|
||
assert.equal(cardFields.isEligible(), true); | ||
done(); | ||
}); | ||
}); |
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,3 @@ | ||
/* @flow */ | ||
|
||
import "./eligibility"; |
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
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