Git Product home page Git Product logo

fewpjs-fetch-lab's People

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fewpjs-fetch-lab's Issues

Problem with boilerplate

function renderBooks(json) {
  const main = document.querySelector('main')
  json.forEach(book => {
    const h2 = document.createElement('h2')
    h2.innerHTML = `<h2>${book.name}</h2>`
    main.appendChild(h2)
  })
}

Some problems with this:

  • Calling .json() doesn't turn a response into JSON- it turns a JSON string into a JS object. This function should take in something like books.
  • Setting the innerHTML of an h2 to an h2 nests them: <h2><h2>A Tale of Two Cities</h2></h2>

The tests do not run on this lab

After completing this lab, I find that the tests do not run. I've tried to download the solution and run the tests to no avail as well.

The error I get is as follows

// ♥ Traceback (most recent call last): 9: from /Users/donnovanlyons/.rvm/gems/ruby-2.6.4/bin/learn-test:23:in

'
8: from /Users/donnovanlyons/.rvm/gems/ruby-2.6.4/bin/learn-test:23:in load' 7: from /Users/donnovanlyons/.rvm/gems/ruby-2.6.4/gems/learn-test-2.6.1/bin/learn-test:68:in <top (required)>'
6: from /Users/donnovanlyons/.rvm/gems/ruby-2.6.4/gems/learn-test-2.6.1/lib/learn_test/runner.rb:20:in run' 5: from /Users/donnovanlyons/.rvm/gems/ruby-2.6.4/gems/learn-test-2.6.1/lib/learn_test/runner.rb:20:in fork'
4: from /Users/donnovanlyons/.rvm/gems/ruby-2.6.4/gems/learn-test-2.6.1/lib/learn_test/runner.rb:21:in block in run' 3: from /Users/donnovanlyons/.rvm/gems/ruby-2.6.4/gems/learn-test-2.6.1/lib/learn_test/runner.rb:44:in report_and_clean'
2: from /Users/donnovanlyons/.rvm/gems/ruby-2.6.4/gems/learn-test-2.6.1/lib/learn_test/reporter.rb:13:in report' 1: from /Users/donnovanlyons/.rvm/gems/ruby-2.6.4/gems/learn-test-2.6.1/lib/learn_test/reporter.rb:47:in report'
/Users/donnovanlyons/.rvm/gems/ruby-2.6.4/gems/learn-test-2.6.1/lib/learn_test/strategies/mocha.rb:42:in results': undefined method []' for nil:NilClass (NoMethodError)`

Issue with learn and mocha –– `results`: undefined method`[]' for nil:NilClass (NoMethodError)

I am flagging the below as an issue because this lab seems to be an outlier.

  • Events Leading to Error
    running learn on my system consistently produces this error:

  • Error Message
    /Users/home/.rvm/gems/ruby-2.6.1/gems/learn-test-2.6.1/lib/learn_test/strategies/mocha.rb:42:in `results': undefined method `[]' for nil:NilClass (NoMethodError)

  • Additional Testing
    Even after completing the assignment correctly (confirmed by comparing my code with the solutions branch), learn throws the same error; I initially suspected the results error may have relied upon completion of the assignment to populate the test's results method with an array of data from Game of Throne's API.

EDIT:

  • Temporary Fix: I was able to get around the issue by commenting out Flatiron's unit test file, running learn, and then running npm audit fix.

Missing Script Tag and Tests don't test that renderBooks is ever called

inedx.html is missing <script type="text/javascript" src="index.js"></script>

Also, the following code passes all test cases even though renderBooks is never called:

function fetchBooks() {
  fetch('https://anapioficeandfire.com/api/books')
  .then(resp => resp.json())
  .then(json => console.log(json));
}

The correct code should be:

function fetchBooks() {
  fetch('https://anapioficeandfire.com/api/books')
  .then(resp => resp.json())
  .then(json => renderBooks(json));
}

Typo

Under deliverables:

In order to give them access, write you solution so that

should be "your solution"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.