Skip to content

Commit

Permalink
renamed expectSecret method
Browse files Browse the repository at this point in the history
  • Loading branch information
Egge21M committed Dec 30, 2024
1 parent 3253045 commit e75cd1b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const unit = 'sat';

injectWebSocketImpl(ws);

function expectProofsSecretToEqual(p: Array<Proof>, s: string) {
function expectNUT10SecretDataToEqual(p: Array<Proof>, s: string) {
p.forEach((p) => {
const parsedSecret = JSON.parse(p.secret);
expect(parsedSecret[1].data).toBe(s);
Expand Down Expand Up @@ -506,7 +506,7 @@ describe('Custom Outputs', () => {
const proofs = await wallet.mintProofs(32, quoteRes.quote);

// Because of the keepFactory we expect these proofs to be locked to our public key
expectProofsSecretToEqual(proofs, hexPk);
expectNUT10SecretDataToEqual(proofs, hexPk);

// Lets melt some of these proofs to pay an invoice
const meltQuote = await wallet.createMeltQuote(invoice);
Expand All @@ -517,13 +517,13 @@ describe('Custom Outputs', () => {
includeFees: true
});
// Again the change we get from the swap are expected to be locked to our public key
expectProofsSecretToEqual(meltKeep, hexPk);
expectNUT10SecretDataToEqual(meltKeep, hexPk);

// We then pay the melt. In this case no private key is required, as our factory only applies to keep Proofs, not send Proofs
const meltRes = await wallet.meltProofs(meltQuote, meltSend);
// Even the change we receive from the fee reserve is expected to be locked
if (meltRes.change && meltRes.change.length > 0) {
expectProofsSecretToEqual(meltRes.change, hexPk);
expectNUT10SecretDataToEqual(meltRes.change, hexPk);
}
// Finally we want to check wheter received token are locked as well
const restAmount = sumProofs(meltKeep) - wallet.getFeesForProofs(meltKeep);
Expand All @@ -537,7 +537,7 @@ describe('Custom Outputs', () => {
{ outputData: (a, k) => OutputData.createSingleP2PKData({ pubkey: 'testKey' }, a, k.id) }
);
// Our factory also applies to the receive method, so we expect all received proofs to be locked
expectProofsSecretToEqual(newProofs, 'testKey');
expectNUT10SecretDataToEqual(newProofs, 'testKey');
}, 15000);
test('Manual Factory Mint', async () => {
function createFactory(pubkey: string): OutputDataFactory {
Expand All @@ -555,7 +555,7 @@ describe('Custom Outputs', () => {
const proofs = await wallet.mintProofs(21, quote.quote, {
outputData: createFactory('mintTest')
});
expectProofsSecretToEqual(proofs, 'mintTest');
expectNUT10SecretDataToEqual(proofs, 'mintTest');
});
test('Manual Factory Send', async () => {
function createFactory(pubkey: string): OutputDataFactory {
Expand All @@ -575,8 +575,8 @@ describe('Custom Outputs', () => {
const { send, keep } = await wallet.send(amount, proofs, {
outputData: { send: createFactory('send'), keep: createFactory('keep') }
});
expectProofsSecretToEqual(send, 'send');
expectProofsSecretToEqual(keep, 'keep');
expectNUT10SecretDataToEqual(send, 'send');
expectNUT10SecretDataToEqual(keep, 'keep');
});
test('Manual BlindingData', async () => {
const mint = new CashuMint(mintUrl);
Expand All @@ -593,8 +593,8 @@ describe('Custom Outputs', () => {
});
const key1Sends = send.slice(0, data1.length);
const key2Sends = send.slice(data1.length);
expectProofsSecretToEqual(key1Sends, 'key1');
expectProofsSecretToEqual(key2Sends, 'key2');
expectNUT10SecretDataToEqual(key1Sends, 'key1');
expectNUT10SecretDataToEqual(key2Sends, 'key2');
});
});
describe('Keep Vector and Reordering', () => {
Expand Down

0 comments on commit e75cd1b

Please sign in to comment.