How to include the FCC test CDN ( Bundle.js ) in my local react project?

I’m using create-react-app for the Random Quote Machine project. Where or how do I add the test cdn to pass the user stories ? I used the usual way of in the index.html file and it doesn’t work that way.

3 Likes

you have to add the cdn link in your codepen project, see this page here for more info: https://github.com/freeCodeCamp/testable-projects-fcc

You didn’t understand… I’m not making the project on codepen.io. I have a local React project in my pc I setup with the package create-react-app

1 Like

just add it in a script tag just before the closing </body> tag.

like it is below:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Pomodoro Clock</title>
</head>
<body>
  <div id="app"></div>
  <script src="bundle.js"></script>
  <script src="https://cdn.freecodecamp.org/testable-projects-fcc/v1/bundle.js"></script>
</body>
</html>
5 Likes

Thanks ! Well that fixed it . I realized that I was rendering the<div> inside the body with ReactDOM.render so the test button that came in from the script needed to be on it.

2 Likes

An easy solution is to simply use ReactFCCtest

All you have to do is run
npm install react-fcctest
OR
yarn add react-fcctest

THEN place import ReactFCCtest from ‘react-fcctest’; at the top of your App.js file

LIKE THIS

import React, { Component } from 'react';
import ReactFCCtest from 'react-fcctest';
 
class App extends Component {
  render() {
    return (
      <div>
        <ReactFCCtest />
      </div>
    );
  }
};

export default App;
15 Likes

Good work man. Thanks for putting in the effort do create the package and for linking it here!

1 Like