should
cy.url().should('include', 'login')
cy.get('input[name=email]').type(email);
test("returns undefined by default", () => {
const mock = jest.fn();
let result = mock("foo");
expect(result).toBeUndefined();
expect(mock).toHaveBeenCalled();
expect(mock).toHaveBeenCalledTimes(1);
expect(mock).toHaveBeenCalledWith("foo");
unstyled list:
list-style-type: none;
yarn add history
import createHistory from 'history/createBrowserHistory';
export const history = createHistory();
<Router history={history}>
above code has warning so I changed it to this:
import { createBrowserHistory } from 'history';
export const history = createBrowserHistory();
curl https://0ca6yach5d.execute-api.us-east-1.amazonaws.com/development/account/api/v1/users/ --header "Authorization: Bearer my-token"
remove from array in returning removed item:
const removeUser = id => {
const index = users.findIndex((user) => user.id === id)
if (index !== -1) {
return users.splice(index, 1)[0]
}
}
//import {Field, Form, Formik} from "formik";
// import * as Yup from "yup";
<Formik
enableReinitialize
initialValues={calculatedFormInitialValues}
validate={values => {
let errors = {};
if (values.responsible_user === "" && values.responsible_department === "") {
If we have multiple promises we could use Promise.all with await
async function asyncFunc() {
const response = await Promise.all([
axios.get("/some_url_endpoint"),
axios.get("/some_url_endpoint")
]);
...
}
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max-min)) + min
}
how to put element in vertical center of parent?
<div class={"parent"}>
...
<div class={"child"}>
...
</div>
</div>
vertical center: