unit test for the ListView in TransferToken

This commit is contained in:
Simone Taeggi 2023-02-03 17:47:27 +01:00
parent 1ad7b79862
commit f3ee8e94fe
5 changed files with 1261 additions and 188 deletions

View File

@ -1,7 +1,7 @@
import React from 'react';
import Pencil from '@strapi/icons/Pencil';
import PropTypes from 'prop-types';
import DefaultButton from '../../../../pages/ApiTokens/ListView/DynamicTable/DefaultButton';
import DefaultButton from '../DefaultButton';
const UpdateButton = ({ tokenName, tokenId }) => {
return (

View File

@ -32,7 +32,6 @@ const Table = ({ permissions, headers, contentType, isLoading, tokens, onConfirm
return sortOrder === 'DESC' ? -comparaison : comparaison;
});
console.log('isLoading', isLoading);
return (
<DynamicTable

View File

@ -684,99 +684,6 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot
max-width: 100%;
}
.c32 {
border: 1px solid #dcdce4;
border-radius: 4px;
padding-left: 16px;
padding-right: 16px;
padding-top: 12px;
padding-bottom: 12px;
background: #ffffff;
outline: none;
box-shadow: 0;
-webkit-transition-property: border-color,box-shadow,fill;
transition-property: border-color,box-shadow,fill;
-webkit-transition-duration: 0.2s;
transition-duration: 0.2s;
}
.c32:focus-within {
border: 1px solid #4945ff;
box-shadow: #4945ff 0px 0px 0px 2px;
}
.c33 {
display: block;
width: 100%;
font-weight: 400;
font-size: 0.875rem;
border: none;
color: #32324d;
resize: none;
background: inherit;
}
.c33::-webkit-input-placeholder {
color: #8e8ea9;
opacity: 1;
}
.c33::-moz-placeholder {
color: #8e8ea9;
opacity: 1;
}
.c33:-ms-input-placeholder {
color: #8e8ea9;
opacity: 1;
}
.c33::placeholder {
color: #8e8ea9;
opacity: 1;
}
.c33:focus-within {
outline: none;
}
.c31 textarea {
height: 5rem;
line-height: 1.25rem;
}
.c31 textarea::-webkit-input-placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c31 textarea::-moz-placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c31 textarea:-ms-input-placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c31 textarea::placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c51 {
border: 1px solid #f6f6f9;
}
@ -900,6 +807,99 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot
fill: #4945ff;
}
.c32 {
border: 1px solid #dcdce4;
border-radius: 4px;
padding-left: 16px;
padding-right: 16px;
padding-top: 12px;
padding-bottom: 12px;
background: #ffffff;
outline: none;
box-shadow: 0;
-webkit-transition-property: border-color,box-shadow,fill;
transition-property: border-color,box-shadow,fill;
-webkit-transition-duration: 0.2s;
transition-duration: 0.2s;
}
.c32:focus-within {
border: 1px solid #4945ff;
box-shadow: #4945ff 0px 0px 0px 2px;
}
.c33 {
display: block;
width: 100%;
font-weight: 400;
font-size: 0.875rem;
border: none;
color: #32324d;
resize: none;
background: inherit;
}
.c33::-webkit-input-placeholder {
color: #8e8ea9;
opacity: 1;
}
.c33::-moz-placeholder {
color: #8e8ea9;
opacity: 1;
}
.c33:-ms-input-placeholder {
color: #8e8ea9;
opacity: 1;
}
.c33::placeholder {
color: #8e8ea9;
opacity: 1;
}
.c33:focus-within {
outline: none;
}
.c31 textarea {
height: 5rem;
line-height: 1.25rem;
}
.c31 textarea::-webkit-input-placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c31 textarea::-moz-placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c31 textarea:-ms-input-placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c31 textarea::placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
@media (max-width:68.75rem) {
.c25 {
grid-column: span;
@ -2400,99 +2400,6 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot
max-width: 100%;
}
.c39 {
border: 1px solid #dcdce4;
border-radius: 4px;
padding-left: 16px;
padding-right: 16px;
padding-top: 12px;
padding-bottom: 12px;
background: #ffffff;
outline: none;
box-shadow: 0;
-webkit-transition-property: border-color,box-shadow,fill;
transition-property: border-color,box-shadow,fill;
-webkit-transition-duration: 0.2s;
transition-duration: 0.2s;
}
.c39:focus-within {
border: 1px solid #4945ff;
box-shadow: #4945ff 0px 0px 0px 2px;
}
.c40 {
display: block;
width: 100%;
font-weight: 400;
font-size: 0.875rem;
border: none;
color: #32324d;
resize: none;
background: inherit;
}
.c40::-webkit-input-placeholder {
color: #8e8ea9;
opacity: 1;
}
.c40::-moz-placeholder {
color: #8e8ea9;
opacity: 1;
}
.c40:-ms-input-placeholder {
color: #8e8ea9;
opacity: 1;
}
.c40::placeholder {
color: #8e8ea9;
opacity: 1;
}
.c40:focus-within {
outline: none;
}
.c38 textarea {
height: 5rem;
line-height: 1.25rem;
}
.c38 textarea::-webkit-input-placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c38 textarea::-moz-placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c38 textarea:-ms-input-placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c38 textarea::placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c60 {
border: 1px solid #f6f6f9;
}
@ -2616,6 +2523,99 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot
fill: #4945ff;
}
.c39 {
border: 1px solid #dcdce4;
border-radius: 4px;
padding-left: 16px;
padding-right: 16px;
padding-top: 12px;
padding-bottom: 12px;
background: #ffffff;
outline: none;
box-shadow: 0;
-webkit-transition-property: border-color,box-shadow,fill;
transition-property: border-color,box-shadow,fill;
-webkit-transition-duration: 0.2s;
transition-duration: 0.2s;
}
.c39:focus-within {
border: 1px solid #4945ff;
box-shadow: #4945ff 0px 0px 0px 2px;
}
.c40 {
display: block;
width: 100%;
font-weight: 400;
font-size: 0.875rem;
border: none;
color: #32324d;
resize: none;
background: inherit;
}
.c40::-webkit-input-placeholder {
color: #8e8ea9;
opacity: 1;
}
.c40::-moz-placeholder {
color: #8e8ea9;
opacity: 1;
}
.c40:-ms-input-placeholder {
color: #8e8ea9;
opacity: 1;
}
.c40::placeholder {
color: #8e8ea9;
opacity: 1;
}
.c40:focus-within {
outline: none;
}
.c38 textarea {
height: 5rem;
line-height: 1.25rem;
}
.c38 textarea::-webkit-input-placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c38 textarea::-moz-placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c38 textarea:-ms-input-placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
.c38 textarea::placeholder {
font-weight: 400;
font-size: 0.875rem;
line-height: 1.43;
color: #8e8ea9;
opacity: 1;
}
@media (max-width:68.75rem) {
.c33 {
grid-column: span;

View File

@ -18,6 +18,13 @@ jest.mock('@strapi/helper-plugin', () => ({
useGuidedTour: jest.fn(() => ({
startSection: jest.fn(),
})),
useQueryParams: jest.fn().mockReturnValue([
{
query: {
sort: 'test:ASC',
},
},
]),
useFetchClient: jest.fn().mockReturnValue({
get: jest.fn().mockResolvedValue({
data: {
@ -855,6 +862,8 @@ describe('ADMIN | Pages | API TOKENS | ListPage', () => {
</thead>
<tbody
class="c27"
entriestodelete=""
headers="[object Object],[object Object],[object Object],[object Object]"
>
<tr
aria-rowindex="2"