When I compare two public keys with:
expect(lotteryState.authority).to.equal(user.publicKey);
I get the following error:
AssertionError: expected PublicKey(DCpJReAfonSrgohiQbTmKKbjbqVofspFRHz9yQikzooP){ _bn: <BN: b5531d6246f2015e72621c71ebf9304871dd8bbcf6f6c714948be6ddbd1e6ff2> } to equal PublicKey(DCpJReAfonSrgohiQbTmKKbjbqVofspFRHz9yQikzooP){ _bn: <BN: b5531d6246f2015e72621c71ebf9304871dd8bbcf6f6c714948be6ddbd1e6ff2> }
As you can see, both keys are the same but the test suite says that they are different. I can fix this by changing to a deep equality check:
expect(lotteryState.authority).to.deep.equal(user.publicKey);
But I am wondering if there exists a native method in anchor to compare to keys such as:
expect(lotteryState.authority).to.publicKeyEqual(user.publicKey);