removed switch statement

This commit is contained in:
CodeByAlex 2019-08-13 09:27:48 -04:00
parent 607c0fcb5c
commit 7bf11f41d1
2 changed files with 8 additions and 23 deletions

View File

@ -83,27 +83,12 @@ interface ContentProps {
const getTestsByTypeMap = (result: any) => {
const testsByType: Map<string, any> = new Map();
result.assertionResults.forEach((assertion: any) => {
// using switch to allow for new types to be added
switch (assertion.status) {
case StatusTypes.PASSED_TYPE:
testsByType.set(
StatusTypes.PASSED_TYPE,
testsByType.get(StatusTypes.PASSED_TYPE)
? testsByType.get(StatusTypes.PASSED_TYPE).concat(assertion)
: [assertion]
);
break;
case StatusTypes.FAILED_TYPE:
testsByType.set(
StatusTypes.FAILED_TYPE,
testsByType.get(StatusTypes.FAILED_TYPE)
? testsByType.get(StatusTypes.FAILED_TYPE).concat(assertion)
: [assertion]
);
break;
default:
break;
}
testsByType.set(
assertion.status,
testsByType.get(assertion.status)
? testsByType.get(assertion.status).concat(assertion)
: [assertion]
);
});
return testsByType;
};

View File

@ -1,5 +1,5 @@
import React, { Component, Fragment, useState } from 'react';
import { styled } from '@storybook/theming';
import { styled, themes, convert } from '@storybook/theming';
import { Icons } from '@storybook/components';
import Message from './Message';
@ -70,7 +70,7 @@ export function Result(props: ResultProps) {
<Icon
icon="chevrondown"
size={10}
color="#9DA5AB"
color={convert(themes.normal).color.mediumdark}
style={{
transform: `rotate(${isOpen ? 0 : -90}deg)`,
}}