chore(test): remove email-sign-up.test.js in favor of e2e (#53886)

This commit is contained in:
Huyen Nguyen
2024-02-26 21:24:48 +07:00
committed by GitHub
parent 511ddc149d
commit e03b78666b
4 changed files with 0 additions and 303 deletions

View File

@@ -191,7 +191,6 @@
"monaco-editor-webpack-plugin": "4.2.0",
"node-fetch": "2.7.0",
"react-test-renderer": "16.14.0",
"redux-mock-store": "1.5.4",
"redux-saga-test-plan": "4.0.6",
"serve": "13.0.4",
"ts-node": "10.9.2",

View File

@@ -1,192 +0,0 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<EmailSignUp /> Authenticated user "accepted terms and condition" it should render correctly 1`] = `null`;
exports[`<EmailSignUp /> Non-Authenticated user "not accepted terms and condition" it should render correctly 1`] = `
<div
className="mx-auto px-[15px] my-0 md:w-[750px] min-[992px]:w-[970px] min-[1200px]:w-[1170px] "
>
<div
className="mx-[-15px] "
>
<div
className=" min-h-[1px] px-[15px] w-full md:w-5/6 min-[992px]:w-2/3 md:ml-[8.3%] min-[992px]:ml-[16.6%] "
>
<div
className="spacer"
style={
{
"padding": "5px 0",
}
}
/>
<div
className="intro-description"
data-playwright-test-label="learn-read-this-section"
>
<div
className="spacer"
style={
{
"padding": "15px 0",
}
}
/>
<p
className="text-center"
data-playwright-test-label="learn-read-this-heading"
>
<strong>
learn.read-this.heading
</strong>
</p>
<div
className="spacer"
style={
{
"padding": "15px 0",
}
}
/>
<p
data-playwright-test-label="learn-read-this-p"
>
learn.read-this.p1
</p>
<p
data-playwright-test-label="learn-read-this-p"
>
learn.read-this.p2
</p>
<p
data-playwright-test-label="learn-read-this-p"
>
learn.read-this.p3
</p>
<p
data-playwright-test-label="learn-read-this-p"
>
learn.read-this.p4
</p>
<p
data-playwright-test-label="learn-read-this-p"
>
learn.read-this.p5
</p>
<p
data-playwright-test-label="learn-read-this-p"
>
learn.read-this.p6
</p>
<p
data-playwright-test-label="learn-read-this-p"
>
learn.read-this.p7
</p>
<p
data-playwright-test-label="learn-read-this-p"
>
learn.read-this.p8
</p>
<p>
<a
className="inline"
href="https://youtube.com/freecodecamp"
rel="noopener noreferrer"
target="_blank"
/>
</p>
<p
data-playwright-test-label="learn-read-this-p"
>
learn.read-this.p10
</p>
<p>
<a
className="inline"
href="https://forum.freecodecamp.org"
rel="noopener noreferrer"
target="_blank"
/>
</p>
<p
data-playwright-test-label="learn-read-this-p"
>
learn.read-this.p12
</p>
<strong>
misc.quincy
</strong>
</div>
<hr />
</div>
</div>
<div
className="mx-[-15px] email-sign-up"
data-cy="email-sign-up"
>
<div
className=" min-h-[1px] px-[15px] w-full md:w-5/6 min-[992px]:w-2/3 md:ml-[8.3%] min-[992px]:ml-[16.6%] "
>
<div
className="spacer"
style={
{
"padding": "5px 0",
}
}
/>
<p>
misc.email-blast
</p>
<div
className="spacer"
style={
{
"padding": "5px 0",
}
}
/>
</div>
<div
className=" min-h-[1px] px-[15px] w-full md:w-5/6 min-[992px]:w-2/3 md:ml-[8.3%] min-[992px]:ml-[16.6%] "
>
<div
className="spacer"
style={
{
"padding": "5px 0",
}
}
/>
<a
className=" relative inline-block mt-[0.5px] border-solid border-3 active:before:w-full active:before:h-full active:before:absolute active:before:inset-0 active:before:border-3 active:before:border-transparent active:before:bg-gray-900 active:before:opacity-20 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 focus:outline-none focus-visible:ring focus-visible:ring-focus-outline-color text-center cursor-pointer no-underline block w-full border-foreground-secondary bg-background-quaternary text-foreground-secondary hover:bg-foreground-primary hover:text-background-primary hover:border-foreground-secondary dark:hover:bg-background-primary dark:hover:text-foreground-primary px-4 py-2.5 text-lg"
href="http://localhost:3000/signin"
>
buttons.sign-up-email-list
</a>
<div
className="spacer"
style={
{
"padding": "5px 0",
}
}
/>
</div>
<div
className=" min-h-[1px] px-[15px] w-full "
>
<div
className="spacer"
style={
{
"padding": "15px 0",
}
}
/>
</div>
</div>
</div>
`;

View File

@@ -1,101 +0,0 @@
import { navigate } from 'gatsby';
import React from 'react';
import { Provider } from 'react-redux';
import renderer from 'react-test-renderer';
import configureStore from 'redux-mock-store';
import EmailSignUp from './email-sign-up';
const middlewares = [];
const mockStore = configureStore(middlewares);
jest.mock('../analytics');
jest.mock('gatsby', () => ({
navigate: jest.fn()
}));
describe('<EmailSignUp />', () => {
let component;
let tree;
describe('Non-Authenticated user "not accepted terms and condition"', () => {
beforeEach(() => {
const initialState = {
app: {
appUsername: '',
user: {},
userFetchState: {
pending: false,
complete: true,
errored: false,
error: null
}
}
};
const store = mockStore(initialState);
const container = renderer.create(
<Provider store={store}>
<EmailSignUp />
</Provider>
);
component = container.root;
tree = container.toJSON();
});
it('it should render correctly', () => {
expect(tree).toMatchSnapshot();
});
it('it should have a intro description section', () => {
// eslint-disable-next-line testing-library/await-async-query
const sectionIntroDescription = component.findByProps({
className: 'intro-description'
});
expect(sectionIntroDescription).toBeTruthy();
});
});
describe('Authenticated user "accepted terms and condition"', () => {
beforeEach(() => {
const initialState = {
app: {
appUsername: 'John Doe',
user: {
'John Doe': {
acceptedPrivacyTerms: true,
name: 'John Doe'
}
},
userFetchState: {
pending: false,
complete: true,
errored: false,
error: null
}
}
};
const store = mockStore(initialState);
store.dispatch = jest.fn();
const container = renderer.create(
<Provider store={store}>
<EmailSignUp />
</Provider>
);
component = container.root;
tree = container.toJSON();
});
it('it should render correctly', () => {
expect(tree).toMatchSnapshot();
});
it('it should redirect to learn url', () => {
expect(navigate).toHaveBeenCalledWith('/learn');
});
});
});

9
pnpm-lock.yaml generated
View File

@@ -933,9 +933,6 @@ importers:
react-test-renderer:
specifier: 16.14.0
version: 16.14.0(react@16.14.0)
redux-mock-store:
specifier: 1.5.4
version: 1.5.4
redux-saga-test-plan:
specifier: 4.0.6
version: 4.0.6(@redux-saga/is@1.1.3)(@redux-saga/symbols@1.1.3)(redux-saga@1.2.3)
@@ -28998,12 +28995,6 @@ packages:
redux: 4.2.1
dev: false
/redux-mock-store@1.5.4:
resolution: {integrity: sha512-xmcA0O/tjCLXhh9Fuiq6pMrJCwFRaouA8436zcikdIpYWWCjU76CRk+i2bHx8EeiSiMGnB85/lZdU3wIJVXHTA==}
dependencies:
lodash.isplainobject: 4.0.6
dev: true
/redux-observable@1.2.0(redux@4.2.1)(rxjs@6.6.7):
resolution: {integrity: sha512-yeR90RP2WzZzCxxnQPlh2uFzyfFLsfXu8ROh53jGDPXVqj71uNDMmvi/YKQkd9ofiVoO4OYb1snbowO49tCEMg==}
peerDependencies: