Build a Project Idea Board - Please help me with test case 17

Tell us what’s happening:

Test case 17 doesn’t pass, even though I’ve implemented it as expected.

Please help me identify the problems I’m not seeing. What am I not considering?

Test case 17: When new ProjectIdeaBoard("Empty Board") is empty, emptyBoard.formatToString() should return Empty Board has 0 ideas\n

Your code so far

const projectStatus = {
  PENDING: { description: 'Pending Execution' },
  SUCCESS: { description: 'Executed Successfully' },
  FAILURE: { description: 'Execution Failed' },
};

class ProjectIdea {

  constructor(title, description) {
    this.title = title;
    this.description = description;
    this.status = projectStatus.PENDING;
  }

  updateProjectStatus(status) {
    this.status = status;
  }

  toString() {
    return `${this.title} (${this.status.description}) - ${this.description}\n`;
  }
}

class ProjectIdeaBoard {

  constructor(title) {
    this.title = title;
    this.ideas = [];
  }

  pin(projectIdea) {
    this.ideas.push(projectIdea);
  }

  unpin() {
    this.ideas.pop();
  }

  count() {
    return this.ideas.length;
  }
  
  formatToString() {
    const count = this.count();
    if (count === 0) {
      return `${this.title} has 0 ideas\n`;
    }

    const projectIdeas = this.ideas
      .map((idea) => idea.toString())
      .join('');
    return `${this.title} has ${count} idea(s)\n${projectIdeas}`;
  }
}

// Demo for test case 17
const emptyBoard = new ProjectIdeaBoard("Empty Board");
console.log(emptyBoard.formatToString()); // Empty Board has 0 ideas

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36

Challenge Information:

Build a Project Idea Board - Build a Project Idea Board

Hi @Alberto-RJ

There is a typo, here is the correct test to pass:

  1. When new ProjectIdeaBoard("Empty Board") is empty, emptyBoard.formatToString() should return Empty Board has 0 idea(s)\n .

Happy coding

1 Like

The test passed, thank you very much for your review @Teller!

But I would like to emphasize that in the lab for this test, it still keeps saying:

When new ProjectIdeaBoard("Empty Board") is empty, emptyBoard.formatToString() should return Empty Board has 0 ideas\n

Wouldn’t that be a problem for other campers who are also working on this lab?

1 Like

yes it would
could you open an issue for it?

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

1 Like

Yes, I’ve just done this now and thank you very
much for your encouragement @ILM!

1 Like

thank you for making the issue! it’s a great help in improving the curriculum!

1 Like