-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
create new types for createOrder and creatVaultToken #605
Changes from 1 commit
5748656
37ef35d
25fa9d1
35591cd
393e35f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { test, vi, describe, expect } from "vitest"; | ||
|
||
import { PayPalCardFieldsComponentOptions } from "../components/card-fields"; | ||
|
||
describe("testing", () => { | ||
test("only creatOrder", () => { | ||
const createOrderCallback: PayPalCardFieldsComponentOptions = { | ||
createOrder: vi.fn(), | ||
onApprove: vi.fn(), | ||
onError: vi.fn(), | ||
}; | ||
|
||
expect(createOrderCallback.createVaultSetupToken).toBeUndefined(); | ||
}); | ||
|
||
test("only createVaultSetupToken", () => { | ||
const createVaultSetupTokenCallback: PayPalCardFieldsComponentOptions = | ||
{ | ||
createVaultSetupToken: vi.fn(), | ||
onApprove: vi.fn(), | ||
onError: vi.fn(), | ||
}; | ||
|
||
expect(createVaultSetupTokenCallback.createOrder).toBeUndefined(); | ||
}); | ||
|
||
test.skip("Can't have both", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these test still supposed to be skipped? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It still need to be skip right now because there is assertionError. Not sure what assertion call I should do instead. |
||
// @ts-expect-error : should throw error if both createOrder and createVaultSetuptoken called | ||
const callback: PayPalCardFieldsComponentOptions = { | ||
createOrder: vi.fn(), | ||
createVaultSetupToken: vi.fn(), | ||
onApprove: vi.fn(), | ||
onError: vi.fn(), | ||
}; | ||
|
||
expect(callback).toThrowError(); | ||
}); | ||
|
||
test.skip("Can't have both", () => { | ||
// @ts-expect-error: should throw error if neither createOrder or createVaultSetuptoken called | ||
const callback: PayPalCardFieldsComponentOptions = { | ||
onApprove: vi.fn(), | ||
onError: vi.fn(), | ||
}; | ||
|
||
expect(callback).toThrowError(); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets revisit if we need createOrder?: never;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if
createOrder?: never
add any value, so i feel like we can remove thatThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There might be value in future clarity.