Optimise Jest run in CI (#9542)

This commit is contained in:
Michael Telatynski 2022-11-04 10:48:08 +00:00 committed by GitHub
parent 28ecdc0cb4
commit 04bc8fb71c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
55 changed files with 1388 additions and 1305 deletions

View file

@ -133,7 +133,7 @@ describe("ForwardDialog", () => {
// Make sendEvent require manual resolution so we can see the sending state
let finishSend;
let cancelSend;
mockClient.sendEvent.mockImplementation(() => new Promise((resolve, reject) => {
mockClient.sendEvent.mockImplementation(<T extends {}>() => new Promise<T>((resolve, reject) => {
finishSend = resolve;
cancelSend = reject;
}));

View file

@ -104,24 +104,27 @@ describe('<UserSettingsDialog />', () => {
});
it('renders ignored users tab when feature_mjolnir is enabled', () => {
mockSettingsStore.getValue.mockImplementation((settingName) => settingName === "feature_mjolnir");
mockSettingsStore.getValue.mockImplementation((settingName): any => settingName === "feature_mjolnir");
const { getByTestId } = render(getComponent());
expect(getByTestId(`settings-tab-${UserTab.Mjolnir}`)).toBeTruthy();
});
it('renders voip tab when voip is enabled', () => {
mockSettingsStore.getValue.mockImplementation((settingName) => settingName === UIFeature.Voip);
mockSettingsStore.getValue.mockImplementation((settingName): any => settingName === UIFeature.Voip);
const { getByTestId } = render(getComponent());
expect(getByTestId(`settings-tab-${UserTab.Voice}`)).toBeTruthy();
});
it('renders session manager tab when enabled', () => {
mockSettingsStore.getValue.mockImplementation((settingName) => settingName === "feature_new_device_manager");
mockSettingsStore.getValue.mockImplementation((settingName): any => {
return settingName === "feature_new_device_manager";
});
const { getByTestId } = render(getComponent());
expect(getByTestId(`settings-tab-${UserTab.SessionManager}`)).toBeTruthy();
});
it('renders labs tab when show_labs_settings is enabled in config', () => {
// @ts-ignore simplified test stub
mockSdkConfig.get.mockImplementation((configName) => configName === "show_labs_settings");
const { getByTestId } = render(getComponent());
expect(getByTestId(`settings-tab-${UserTab.Labs}`)).toBeTruthy();

View file

@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`<ExportDialog /> renders export dialog 1`] = `
Array [
[
<BaseDialog
className="mx_ExportDialog false"
contentId="mx_Dialog_content"
@ -14,7 +14,7 @@ Array [
<ForwardRef(FocusLockUICombination)
className="mx_ExportDialog false mx_Dialog_fixedWidth"
lockProps={
Object {
{
"aria-describedby": "mx_Dialog_content",
"aria-labelledby": "mx_BaseDialog_title",
"onKeyDown": [Function],
@ -30,7 +30,7 @@ Array [
crossFrame={true}
disabled={false}
lockProps={
Object {
{
"aria-describedby": "mx_Dialog_content",
"aria-labelledby": "mx_BaseDialog_title",
"onKeyDown": [Function],
@ -46,7 +46,7 @@ Array [
data-focus-guard={true}
key="guard-first"
style={
Object {
{
"height": "0px",
"left": "1px",
"overflow": "hidden",
@ -62,7 +62,7 @@ Array [
autoFocus={true}
crossFrame={true}
disabled={false}
id={Object {}}
id={{}}
observed={
<div
aria-describedby="mx_Dialog_content"
@ -269,12 +269,12 @@ Array [
onDeactivation={[Function]}
persistentFocus={false}
returnFocus={[Function]}
shards={Array []}
shards={[]}
sideCar={
Object {
{
"assignMedium": [Function],
"assignSyncMedium": [Function],
"options": Object {
"options": {
"async": true,
"ssr": false,
},
@ -287,7 +287,7 @@ Array [
autoFocus={true}
crossFrame={true}
disabled={false}
id={Object {}}
id={{}}
observed={
<div
aria-describedby="mx_Dialog_content"
@ -494,12 +494,12 @@ Array [
onDeactivation={[Function]}
persistentFocus={false}
returnFocus={[Function]}
shards={Array []}
shards={[]}
sideCar={
Object {
{
"assignMedium": [Function],
"assignSyncMedium": [Function],
"options": Object {
"options": {
"async": true,
"ssr": false,
},
@ -566,16 +566,16 @@ Array [
</span>
<StyledRadioGroup
definitions={
Array [
Object {
[
{
"label": "HTML",
"value": "Html",
},
Object {
{
"label": "Plain Text",
"value": "PlainText",
},
Object {
{
"label": "JSON",
"value": "Json",
},
@ -849,7 +849,7 @@ Array [
<div
data-focus-guard={true}
style={
Object {
{
"height": "0px",
"left": "1px",
"overflow": "hidden",
@ -867,7 +867,7 @@ Array [
<ForwardRef(FocusLockUICombination)
className="mx_ExportDialog false mx_Dialog_fixedWidth"
lockProps={
Object {
{
"aria-describedby": "mx_Dialog_content",
"aria-labelledby": "mx_BaseDialog_title",
"onKeyDown": [Function],
@ -883,7 +883,7 @@ Array [
crossFrame={true}
disabled={false}
lockProps={
Object {
{
"aria-describedby": "mx_Dialog_content",
"aria-labelledby": "mx_BaseDialog_title",
"onKeyDown": [Function],
@ -899,7 +899,7 @@ Array [
data-focus-guard={true}
key="guard-first"
style={
Object {
{
"height": "0px",
"left": "1px",
"overflow": "hidden",
@ -915,7 +915,7 @@ Array [
autoFocus={true}
crossFrame={true}
disabled={false}
id={Object {}}
id={{}}
observed={
<div
aria-describedby="mx_Dialog_content"
@ -1122,12 +1122,12 @@ Array [
onDeactivation={[Function]}
persistentFocus={false}
returnFocus={[Function]}
shards={Array []}
shards={[]}
sideCar={
Object {
{
"assignMedium": [Function],
"assignSyncMedium": [Function],
"options": Object {
"options": {
"async": true,
"ssr": false,
},
@ -1140,7 +1140,7 @@ Array [
autoFocus={true}
crossFrame={true}
disabled={false}
id={Object {}}
id={{}}
observed={
<div
aria-describedby="mx_Dialog_content"
@ -1347,12 +1347,12 @@ Array [
onDeactivation={[Function]}
persistentFocus={false}
returnFocus={[Function]}
shards={Array []}
shards={[]}
sideCar={
Object {
{
"assignMedium": [Function],
"assignSyncMedium": [Function],
"options": Object {
"options": {
"async": true,
"ssr": false,
},
@ -1419,16 +1419,16 @@ Array [
</span>
<StyledRadioGroup
definitions={
Array [
Object {
[
{
"label": "HTML",
"value": "Html",
},
Object {
{
"label": "Plain Text",
"value": "PlainText",
},
Object {
{
"label": "JSON",
"value": "Json",
},
@ -1702,7 +1702,7 @@ Array [
<div
data-focus-guard={true}
style={
Object {
{
"height": "0px",
"left": "1px",
"overflow": "hidden",
@ -1723,7 +1723,7 @@ Array [
crossFrame={true}
disabled={false}
lockProps={
Object {
{
"aria-describedby": "mx_Dialog_content",
"aria-labelledby": "mx_BaseDialog_title",
"onKeyDown": [Function],
@ -1739,7 +1739,7 @@ Array [
data-focus-guard={true}
key="guard-first"
style={
Object {
{
"height": "0px",
"left": "1px",
"overflow": "hidden",
@ -1755,7 +1755,7 @@ Array [
autoFocus={true}
crossFrame={true}
disabled={false}
id={Object {}}
id={{}}
observed={
<div
aria-describedby="mx_Dialog_content"
@ -1962,12 +1962,12 @@ Array [
onDeactivation={[Function]}
persistentFocus={false}
returnFocus={[Function]}
shards={Array []}
shards={[]}
sideCar={
Object {
{
"assignMedium": [Function],
"assignSyncMedium": [Function],
"options": Object {
"options": {
"async": true,
"ssr": false,
},
@ -1980,7 +1980,7 @@ Array [
autoFocus={true}
crossFrame={true}
disabled={false}
id={Object {}}
id={{}}
observed={
<div
aria-describedby="mx_Dialog_content"
@ -2187,12 +2187,12 @@ Array [
onDeactivation={[Function]}
persistentFocus={false}
returnFocus={[Function]}
shards={Array []}
shards={[]}
sideCar={
Object {
{
"assignMedium": [Function],
"assignSyncMedium": [Function],
"options": Object {
"options": {
"async": true,
"ssr": false,
},
@ -2259,16 +2259,16 @@ Array [
</span>
<StyledRadioGroup
definitions={
Array [
Object {
[
{
"label": "HTML",
"value": "Html",
},
Object {
{
"label": "Plain Text",
"value": "PlainText",
},
Object {
{
"label": "JSON",
"value": "Json",
},
@ -2542,7 +2542,7 @@ Array [
<div
data-focus-guard={true}
style={
Object {
{
"height": "0px",
"left": "1px",
"overflow": "hidden",
@ -2612,16 +2612,16 @@ Array [
</span>
<StyledRadioGroup
definitions={
Array [
Object {
[
{
"label": "HTML",
"value": "Html",
},
Object {
{
"label": "Plain Text",
"value": "PlainText",
},
Object {
{
"label": "JSON",
"value": "Json",
},