3
babel.config.json
Archivo normal
3
babel.config.json
Archivo normal
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"presets": ["@babel/preset-react"]
|
||||
}
|
||||
13
jest.config.js
Archivo normal
13
jest.config.js
Archivo normal
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
// setupFilesAfterEnv: ["<rootDir>/src/setupTests.js"],
|
||||
testEnvironment: "jsdom",
|
||||
moduleNameMapper: {
|
||||
"\\.(css|less|scss|sass)$": "identity-obj-proxy"
|
||||
},
|
||||
testPathIgnorePatterns: ["/node_modules/", "/build/"],
|
||||
transform: {
|
||||
"^.+\\.(js|jsx|ts|tsx)$": "babel-jest",
|
||||
"^.+\\.(css|less|scss|sass)$": "jest-transform-css"
|
||||
},
|
||||
moduleFileExtensions: ["js", "jsx", "json", "node"]
|
||||
};
|
||||
4
jest.setup.js
Archivo normal
4
jest.setup.js
Archivo normal
@@ -0,0 +1,4 @@
|
||||
// jest.setup.js
|
||||
// You can add global setup for Jest here, e.g. extending expect, etc.
|
||||
// Example: import '@testing-library/jest-dom';
|
||||
import '@testing-library/jest-dom';
|
||||
27
package.json
27
package.json
@@ -1,7 +1,18 @@
|
||||
{
|
||||
"name": "stream-radio",
|
||||
"version": "0.1.0",
|
||||
"description": "A simple React application for streaming radio stations.",
|
||||
"keywords": [
|
||||
"react",
|
||||
"radio",
|
||||
"streaming",
|
||||
"music"
|
||||
],
|
||||
"private": true,
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://git.manalejandro.com/ale/stream-radio.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"@testing-library/dom": "^10.4.0",
|
||||
"@testing-library/jest-dom": "^6.6.3",
|
||||
@@ -38,5 +49,19 @@
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/preset-env": "^7.27.2",
|
||||
"@babel/preset-react": "^7.27.1",
|
||||
"babel-jest": "^29.7.0",
|
||||
"identity-obj-proxy": "^3.0.0",
|
||||
"jest": "^29.7.0",
|
||||
"jest-environment-jsdom": "^30.0.0-beta.3",
|
||||
"jest-transform-css": "^6.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.0.0",
|
||||
"npm": ">=6.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
const { render, screen } = require("@testing-library/react");
|
||||
const App = require("./App").default;
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
describe("App", () => {
|
||||
it("renders Stream Radio title", () => {
|
||||
render(<App />);
|
||||
expect(screen.getByText(/Stream Radio/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders repository link", () => {
|
||||
render(<App />);
|
||||
const link = screen.getByRole("link", { name: /Stream Radio/i });
|
||||
expect(link).toHaveAttribute(
|
||||
"href",
|
||||
"https://git.manalejandro.com/ale/stream-radio"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
5
src/hello.test.js
Archivo normal
5
src/hello.test.js
Archivo normal
@@ -0,0 +1,5 @@
|
||||
describe('Hello World Tests', () => {
|
||||
test('should return hello world', () => {
|
||||
expect('hello world').toBe('hello world');
|
||||
});
|
||||
});
|
||||
Referencia en una nueva incidencia
Block a user