Skip to content

Commit

Permalink
Don't mutate with deepmerge
Browse files Browse the repository at this point in the history
  • Loading branch information
dapplion committed Feb 15, 2022
1 parent cbcde08 commit 40c2fc5
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
generateEmptySignedBlock,
generateSignedBlock,
} from "../../../../../utils/block";
import deepmerge from "deepmerge";
import {expect} from "chai";
import {setupApiImplTestServer, ApiImplTestModules} from "../../index.test";
import {toHexString} from "@chainsafe/ssz";
Expand All @@ -31,7 +30,11 @@ describe("api - beacon - getBlockHeaders", function () {
blockRoot: toHexString(ssz.phase0.BeaconBlock.hashTreeRoot(generateEmptyBlock())),
},
]);
server.dbStub.block.get.resolves(deepmerge(generateEmptySignedBlock(), {message: {slot: 3}}));

const blockFromDb3 = generateEmptySignedBlock();
blockFromDb3.message.slot = 3;
server.dbStub.block.get.resolves(blockFromDb3);

server.dbStub.blockArchive.get.resolves(null);
const {data: blockHeaders} = await server.blockApi.getBlockHeaders({});
expect(blockHeaders).to.not.be.null;
Expand Down

0 comments on commit 40c2fc5

Please sign in to comment.