This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
export const ACTION_TYPES = { | |
SET_HEADERDETAILS: 'SET_HEADERDETAILS', | |
}; | |
const initialState = { | |
headerTitle: '', | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: '', | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
export const getPost = () => { | |
return axios.get('https://jsonplaceholder.typicode.com/posts/1').then(res => res.data); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { render, screen } from '@testing-library/react'; | |
import userEvent from '@testing-library/user-event'; | |
import Counter from './Counter'; | |
const setUp = () => render(<Counter />); | |
beforeEach(() => { | |
setUp() | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------------------------- 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] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ci": { | |
"collect": { | |
"numberOfRuns": 1, | |
"settings": { | |
} | |
}, | |
"assert": { | |
"preset": "lighthouse:recommended", | |
"assertions": { |