more integration test for age restriction: trying to pay age-restricted contract with not-age-restricted coins and using age-restricted coins with not-age-restricted-contract
This commit is contained in:
parent
7a2fe8018f
commit
cad6d99453
@ -18,7 +18,7 @@
|
|||||||
* Imports.
|
* Imports.
|
||||||
*/
|
*/
|
||||||
import { defaultCoinConfig } from "../harness/denomStructures.js";
|
import { defaultCoinConfig } from "../harness/denomStructures.js";
|
||||||
import { GlobalTestState } from "../harness/harness.js";
|
import { GlobalTestState, WalletCli } from "../harness/harness.js";
|
||||||
import {
|
import {
|
||||||
createSimpleTestkudosEnvironment,
|
createSimpleTestkudosEnvironment,
|
||||||
withdrawViaBank,
|
withdrawViaBank,
|
||||||
@ -31,7 +31,7 @@ import {
|
|||||||
export async function runAgeRestrictionsTest(t: GlobalTestState) {
|
export async function runAgeRestrictionsTest(t: GlobalTestState) {
|
||||||
// Set up test environment
|
// Set up test environment
|
||||||
|
|
||||||
const { wallet, bank, exchange, merchant } =
|
const { wallet: walletOne, bank, exchange, merchant } =
|
||||||
await createSimpleTestkudosEnvironment(
|
await createSimpleTestkudosEnvironment(
|
||||||
t,
|
t,
|
||||||
defaultCoinConfig.map((x) => x("TESTKUDOS")),
|
defaultCoinConfig.map((x) => x("TESTKUDOS")),
|
||||||
@ -40,7 +40,11 @@ export async function runAgeRestrictionsTest(t: GlobalTestState) {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
// Withdraw digital cash into the wallet.
|
const walletTwo = new WalletCli(t, "walletTwo");
|
||||||
|
const walletThree = new WalletCli(t, "walletThree");
|
||||||
|
|
||||||
|
{
|
||||||
|
const wallet = walletOne;
|
||||||
|
|
||||||
await withdrawViaBank(t, {
|
await withdrawViaBank(t, {
|
||||||
wallet,
|
wallet,
|
||||||
@ -59,6 +63,50 @@ export async function runAgeRestrictionsTest(t: GlobalTestState) {
|
|||||||
|
|
||||||
await makeTestPayment(t, { wallet, merchant, order });
|
await makeTestPayment(t, { wallet, merchant, order });
|
||||||
await wallet.runUntilDone();
|
await wallet.runUntilDone();
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const wallet = walletTwo;
|
||||||
|
|
||||||
|
await withdrawViaBank(t, {
|
||||||
|
wallet,
|
||||||
|
bank,
|
||||||
|
exchange,
|
||||||
|
amount: "TESTKUDOS:20",
|
||||||
|
restrictAge: 13,
|
||||||
|
});
|
||||||
|
|
||||||
|
const order = {
|
||||||
|
summary: "Buy me!",
|
||||||
|
amount: "TESTKUDOS:5",
|
||||||
|
fulfillment_url: "taler://fulfillment-success/thx",
|
||||||
|
};
|
||||||
|
|
||||||
|
await makeTestPayment(t, { wallet, merchant, order });
|
||||||
|
await wallet.runUntilDone();
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const wallet = walletThree;
|
||||||
|
|
||||||
|
await withdrawViaBank(t, {
|
||||||
|
wallet,
|
||||||
|
bank,
|
||||||
|
exchange,
|
||||||
|
amount: "TESTKUDOS:20",
|
||||||
|
});
|
||||||
|
|
||||||
|
const order = {
|
||||||
|
summary: "Buy me!",
|
||||||
|
amount: "TESTKUDOS:5",
|
||||||
|
fulfillment_url: "taler://fulfillment-success/thx",
|
||||||
|
minimum_age: 9,
|
||||||
|
};
|
||||||
|
|
||||||
|
await makeTestPayment(t, { wallet, merchant, order });
|
||||||
|
await wallet.runUntilDone();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
runAgeRestrictionsTest.suites = ["wallet"];
|
runAgeRestrictionsTest.suites = ["wallet"];
|
||||||
|
Loading…
Reference in New Issue
Block a user