-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
83 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,48 @@ | ||
import { test, vi, describe, expect } from "vitest"; | ||
|
||
import { PayPalCardFieldsComponentOptions } from "../components/card-fields"; | ||
|
||
describe.only("testing createOrder and createVaultToken types", () => { | ||
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 createOrdre and createVaultSetupToken", () => { | ||
// @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 implement neither", () => { | ||
// @ts-expect-error: should throw error if neither createOrder or createVaultSetuptoken called | ||
const callback: PayPalCardFieldsComponentOptions = { | ||
onApprove: vi.fn(), | ||
onError: vi.fn(), | ||
}; | ||
|
||
expect(callback).toThrowError(); | ||
}); | ||
}); |