Skip to content

Instantly share code, notes, and snippets.

View manoj-mass's full-sized avatar
🤠
Focusing

Manoj Masakorala manoj-mass

🤠
Focusing
View GitHub Profile
import axios from 'axios';
export const ACTION_TYPES = {
SET_HEADERDETAILS: 'SET_HEADERDETAILS',
};
const initialState = {
headerTitle: '',
};
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';
import header, { loadHeader, ACTION_TYPES } from 'app/shared/reducers/header';
describe('Header reducer tests', () => {
it('should return the initial state', () => {
const headerState = header(undefined, {});
expect(headerState).toMatchObject({
headerTitle: '',
});
import axios from 'axios';
export const getPost = () => {
return axios.get('https://jsonplaceholder.typicode.com/posts/1').then(res => res.data);
}
import { render, screen } from '@testing-library/react';
import axios from 'axios';
import { getPost } from '../apis/Posts';
describe('test post app', () => {
it('check get post', () => {
jest.mock('axios');
axios.get = jest.fn();
const postResponse = {
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import Counter from './Counter';
const setUp = () => render(<Counter />);
beforeEach(() => {
setUp()
})
import { useState } from 'react';
function Counter() {
const [count , setCount] = useState(0);
return (
<>
<div className="counter">
<h1>Current count is - <label data-testid={"counterID"}>{count}</label></h1>
<button onClick={e => setCount(count + 1)}>Increment</button>
// ------------------------------------------------- current version
var synthetics = require('Synthetics');
const log = require('SyntheticsLogger');
const getYYYYMMDD = (d0) => {
const d = new Date(d0)
return new Date(d.getTime() - d.getTimezoneOffset() * 60 * 1000).toISOString().split('T')[0]
}
@manoj-mass
manoj-mass / .lighthouserc.json​
Created January 11, 2020 20:49
.lighthouserc.json​
{
"ci": {
"collect": {
"numberOfRuns": 1,
"settings": {
}
},
"assert": {
"preset": "lighthouse:recommended",
"assertions": {