Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Jun 4, 2024
1 parent f12f7a6 commit b8e3cb7
Showing 1 changed file with 31 additions and 24 deletions.
55 changes: 31 additions & 24 deletions yarn-project/pxe/src/note_processor/note_processor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ describe('Note Processor', () => {
}

beforeAll(() => {
const app = AztecAddress.random();

const ownerSk = Fr.random();
const allOwnerKeys = deriveKeys(ownerSk);
const app = AztecAddress.random();
const partialAddress = Fr.random();
account = CompleteAddress.fromSecretKeyAndPartialAddress(ownerSk, partialAddress);

Expand Down Expand Up @@ -173,12 +174,15 @@ describe('Note Processor', () => {
await noteProcessor.process(blocks, encryptedLogs);

expect(addNotesSpy).toHaveBeenCalledTimes(1);
expect(addNotesSpy).toHaveBeenCalledWith([
expect.objectContaining({
...request.note.notePayload,
index: request.indexWithinNoteHashTree,
}),
]);
expect(addNotesSpy).toHaveBeenCalledWith(
[
expect.objectContaining({
...request.note.notePayload,
index: request.indexWithinNoteHashTree,
}),
],
[],
);
}, 25_000);

it('should store multiple notes that belong to us', async () => {
Expand All @@ -196,23 +200,26 @@ describe('Note Processor', () => {
await noteProcessor.process(blocks, encryptedLogs);

expect(addNotesSpy).toHaveBeenCalledTimes(1);
expect(addNotesSpy).toHaveBeenCalledWith([
expect.objectContaining({
...requests[0].note.notePayload,
// Index 1 log in the 2nd tx.
index: requests[0].indexWithinNoteHashTree,
}),
expect.objectContaining({
...requests[1].note.notePayload,
// Index 0 log in the 4th tx.
index: requests[1].indexWithinNoteHashTree,
}),
expect.objectContaining({
...requests[2].note.notePayload,
// Index 2 log in the 4th tx.
index: requests[2].indexWithinNoteHashTree,
}),
]);
expect(addNotesSpy).toHaveBeenCalledWith(
[
expect.objectContaining({
...requests[0].note.notePayload,
// Index 1 log in the 2nd tx.
index: requests[0].indexWithinNoteHashTree,
}),
expect.objectContaining({
...requests[1].note.notePayload,
// Index 0 log in the 4th tx.
index: requests[1].indexWithinNoteHashTree,
}),
expect.objectContaining({
...requests[2].note.notePayload,
// Index 2 log in the 4th tx.
index: requests[2].indexWithinNoteHashTree,
}),
],
[],
);
}, 30_000);

it('should not store notes that do not belong to us', async () => {
Expand Down

0 comments on commit b8e3cb7

Please sign in to comment.