mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-22 14:41:04 +01:00
Merge pull request #1213 from bpoulaindev/bugfix/delete_running_api
bugfix(#1210): prevent collection run mapping on deleted items
This commit is contained in:
commit
4b76bf85f4
@ -31,35 +31,39 @@ export default function RunnerResults({ collection }) {
|
|||||||
}, [collection, setSelectedItem]);
|
}, [collection, setSelectedItem]);
|
||||||
|
|
||||||
const collectionCopy = cloneDeep(collection);
|
const collectionCopy = cloneDeep(collection);
|
||||||
const items = cloneDeep(get(collection, 'runnerResult.items', []));
|
|
||||||
const runnerInfo = get(collection, 'runnerResult.info', {});
|
const runnerInfo = get(collection, 'runnerResult.info', {});
|
||||||
each(items, (item) => {
|
const items = cloneDeep(get(collection, 'runnerResult.items', []))
|
||||||
const info = findItemInCollection(collectionCopy, item.uid);
|
.map((item) => {
|
||||||
|
const info = findItemInCollection(collectionCopy, item.uid);
|
||||||
item.name = info.name;
|
if (!info) {
|
||||||
item.type = info.type;
|
return null;
|
||||||
item.filename = info.filename;
|
|
||||||
item.pathname = info.pathname;
|
|
||||||
item.relativePath = getRelativePath(collection.pathname, info.pathname);
|
|
||||||
|
|
||||||
if (item.status !== 'error') {
|
|
||||||
if (item.testResults) {
|
|
||||||
const failed = item.testResults.filter((result) => result.status === 'fail');
|
|
||||||
|
|
||||||
item.testStatus = failed.length ? 'fail' : 'pass';
|
|
||||||
} else {
|
|
||||||
item.testStatus = 'pass';
|
|
||||||
}
|
}
|
||||||
|
const newItem = {
|
||||||
|
...item,
|
||||||
|
name: info.name,
|
||||||
|
type: info.type,
|
||||||
|
filename: info.filename,
|
||||||
|
pathname: info.pathname,
|
||||||
|
relativePath: getRelativePath(collection.pathname, info.pathname)
|
||||||
|
};
|
||||||
|
if (newItem.status !== 'error') {
|
||||||
|
if (newItem.testResults) {
|
||||||
|
const failed = newItem.testResults.filter((result) => result.status === 'fail');
|
||||||
|
newItem.testStatus = failed.length ? 'fail' : 'pass';
|
||||||
|
} else {
|
||||||
|
newItem.testStatus = 'pass';
|
||||||
|
}
|
||||||
|
|
||||||
if (item.assertionResults) {
|
if (newItem.assertionResults) {
|
||||||
const failed = item.assertionResults.filter((result) => result.status === 'fail');
|
const failed = newItem.assertionResults.filter((result) => result.status === 'fail');
|
||||||
|
newItem.assertionStatus = failed.length ? 'fail' : 'pass';
|
||||||
item.assertionStatus = failed.length ? 'fail' : 'pass';
|
} else {
|
||||||
} else {
|
newItem.assertionStatus = 'pass';
|
||||||
item.assertionStatus = 'pass';
|
}
|
||||||
}
|
}
|
||||||
}
|
return newItem;
|
||||||
});
|
})
|
||||||
|
.filter(Boolean);
|
||||||
|
|
||||||
const runCollection = () => {
|
const runCollection = () => {
|
||||||
dispatch(runCollectionFolder(collection.uid, null, true));
|
dispatch(runCollectionFolder(collection.uid, null, true));
|
||||||
@ -168,26 +172,24 @@ export default function RunnerResults({ collection }) {
|
|||||||
</li>
|
</li>
|
||||||
))
|
))
|
||||||
: null}
|
: null}
|
||||||
{item.assertionResults
|
{item.assertionResults?.map((result) => (
|
||||||
? item.assertionResults.map((result) => (
|
<li key={result.uid}>
|
||||||
<li key={result.uid}>
|
{result.status === 'pass' ? (
|
||||||
{result.status === 'pass' ? (
|
<span className="test-success flex items-center">
|
||||||
<span className="test-success flex items-center">
|
<IconCheck size={18} strokeWidth={2} className="mr-2" />
|
||||||
<IconCheck size={18} strokeWidth={2} className="mr-2" />
|
{result.lhsExpr}: {result.rhsExpr}
|
||||||
{result.lhsExpr}: {result.rhsExpr}
|
</span>
|
||||||
</span>
|
) : (
|
||||||
) : (
|
<>
|
||||||
<>
|
<span className="test-failure flex items-center">
|
||||||
<span className="test-failure flex items-center">
|
<IconX size={18} strokeWidth={2} className="mr-2" />
|
||||||
<IconX size={18} strokeWidth={2} className="mr-2" />
|
{result.lhsExpr}: {result.rhsExpr}
|
||||||
{result.lhsExpr}: {result.rhsExpr}
|
</span>
|
||||||
</span>
|
<span className="error-message pl-8 text-xs">{result.error}</span>
|
||||||
<span className="error-message pl-8 text-xs">{result.error}</span>
|
</>
|
||||||
</>
|
)}
|
||||||
)}
|
</li>
|
||||||
</li>
|
))}
|
||||||
))
|
|
||||||
: null}
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue
Block a user