machinomy
Version:
Micropayments powered by Ethereum
37 lines • 1.54 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const ChannelId_1 = require("./ChannelId");
const support = require("./support");
const payment_1 = require("./payment");
const Signature_1 = require("./Signature");
const PaymentChannel_1 = require("./PaymentChannel");
const expect = require("expect");
describe('Payment', () => {
describe('.fromPaymentChannel', () => {
it('build Payment object', () => {
let channelId = ChannelId_1.default.random();
let payment = new payment_1.default({
channelId: channelId.toString(),
sender: 'sender',
receiver: 'receiver',
price: support.randomBigNumber(),
value: support.randomBigNumber(),
channelValue: support.randomBigNumber(),
meta: 'metaexample',
signature: Signature_1.default.fromParts({
v: 27,
r: '0x2',
s: '0x3'
}),
token: undefined,
tokenContract: ''
});
let paymentChannel = PaymentChannel_1.PaymentChannel.fromPayment(payment);
expect(paymentChannel.channelId).toBe(payment.channelId);
expect(paymentChannel.sender).toBe(payment.sender);
expect(paymentChannel.receiver).toBe(payment.receiver);
expect(paymentChannel.value).toEqual(payment.channelValue);
});
});
});
//# sourceMappingURL=Payment.test.js.map