Hello,
I am trying to setup react locally and complete test while I am doing the exercises for FCC.
I’ve been able to setup everything except react test.
My repository:
These are the test I am trying to setup:
The constant JSX should return an h1 element.
assert(JSX.type === ‘h1’);
The h1 tag should include the text Hello JSX!
assert(Enzyme.shallow(JSX).contains(‘Hello JSX!’));
[freeCodeCamp/create-a-simple-jsx-element.md at main · freeCodeCamp/freeCodeCamp · GitHub]
This link provided some hints as how I could perform the test.
Where can I find the actual code source for the test?(having no luck setting it up)?
Code of interest in my repository:
// The constant JSX should return an h1 element.
// assert(JSX.type === 'h1');
// The h1 tag should include the text Hello JSX!
// assert(Enzyme.shallow(JSX).contains('Hello JSX!'));
// MyComponent.test.js
import React from 'react';
import Enzyme, {shallow } from 'enzyme';
import Adapter from '@wojtekmaj/enzyme-adapter-react-17'
import JSX from './fccexercises/react01';
Enzyme.configure({adapter: new Adapter()})
describe("H1 tag should include the text: Hello JSX!", () => {
it("should render my component", () => {
const wrapper = shallow(<JSX />);
assert(wrapper.type === 'h1');
// assert(Enzyme.shallow(JSX).contains('Hello JSX!'));
});
});