Skip to content

Lesson 6 Testing addPerson function [Uncovered lines(31,32) Challenge] #1543

Discussion options

You must be logged in to vote

@oneyellowpeacock 1 issue that @IANGECHUKI176 mentioned above and 2 issues you are comparing with transactionResponse that is to equivalent. You need the get the added person from person array and then compare with that.

Here is my example of that test:

it("Should add a person with favorite number", async function () {
  const personName = "Ali Murtaza";
  const personFavoriteNumber = "40";
  const transactionResponse = await simpleStorage.addPerson(
    personName,
    personFavoriteNumber
  );
  await transactionResponse.wait(1);

  const person = await simpleStorage.people(0);
  assert.equal(person.name, personName);
  assert.equal(person.favoriteNumber.toString(), personFavoriteNumber);

Replies: 4 comments 12 replies

Comment options

You must be logged in to vote
1 reply
@oneyellowpeacock
Comment options

Comment options

You must be logged in to vote
6 replies
@oneyellowpeacock
Comment options

@SidharthK2
Comment options

@pacelliv
Comment options

@SidharthK2
Comment options

@ygorz
Comment options

Answer selected by alymurtazamemon
Comment options

You must be logged in to vote
4 replies
@alymurtazamemon
Comment options

@SanderLoman
Comment options

@alymurtazamemon
Comment options

@SanderLoman
Comment options

Comment options

You must be logged in to vote
1 reply
@JuniorSua
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
9 participants