Real unit test (isolation, no children render)
Calls:
- constructor
- render
// ... | |
describe("App", () => { | |
const wrapper = mount(<App />); | |
// ... | |
test("Contains a Start and a Finish page", () => { | |
// - when | |
const startComp = wrapper.find("Start"); |
// App.jsx | |
import React, { Fragment } from "react"; | |
// - Data | |
import data from "./data.json"; | |
export default function App() { | |
function renderQuestions() { | |
return data.results.map((result, index) => ( |
// App.test.js | |
import React from "react"; | |
import Enzyme, { mount } from "enzyme"; | |
import Adapter from "enzyme-adapter-react-16"; | |
import data from "./data.json"; | |
import App from "./App"; | |
Enzyme.configure({ adapter: new Adapter() }); |
// App.jsx | |
import React, { Fragment } from "react"; | |
// - Data | |
import data from "./data.json"; | |
export default function App() { | |
function renderQuestions() { | |
return data.results.map((result, index) => ( |
/node_modules
where your downloaded node module files go
/public
things in here are not compiled or minified by webpack (https://medium.com/@jenniferdobak/the-public-folder-and-favicons-in-create-react-app-8dc2cc1d492b)
favicon
the icon that will appear in the tab of the browser
index.html
this is our html template and react will inject the html code into the div with the id of root
[ | |
{ | |
"quote": "As the Father has loved Me, so have I loved you", | |
"verse": "John 15:9-17 (NIV)", | |
"desc": "As the Father has loved me, so have I loved you. Now remain in my love. If you keep my commands, you will remain in my love, just as I have kept my Father’s commands and remain in his love. I have told you this so that my joy may be in you and that your joy may be complete. My command is this: Love each other as I have loved you. Greater love has no one than this: to lay down one’s life for one’s friends. 14 You are my friends if you do what I command. I no longer call you servants, because a servant does not know his master’s business. Instead, I have called you friends, for everything that I learned from my Father I have made known to you. You did not choose me, but I chose you and appointed you so that you might go and bear fruit—fruit that will last—and so that whatever you ask in my name the Father will give you. This is my command: Love each other.", | |
"link": "https://www.desiringgod. |
from tornado.web import Application, RequestHandler | |
from tornado.ioloop import IOLoop | |
import json | |
items = [] | |
class TodoItems(RequestHandler): | |
def get(self): | |
self.write({'items': items}) |
from tornado.web import Application, RequestHandler | |
from tornado.ioloop import IOLoop | |
items = [] | |
class TodoItems(RequestHandler): | |
def get(self): | |
self.write({'items': items}) | |
from tornado.web import Application, RequestHandler | |
# application creats app, requesthandler, deals with HTTP requests | |
from tornado.ioloop import IOLoop | |
# input output loop used to run async server |