Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { fireEvent, screen, within } from '@testing-library/vue';
import { expect, it, vi } from 'vitest';

import Liquibase from './index.vue';

import { applications } from '@/mocks/applications/data';
import Application from '@/services/application';
import { render } from '@/test-utils';

it('opens only the selected execution when two databases ran the same changelog', async () => {
const instance = new Application(applications[0]).instances[0];
const changeSet = {
id: '001',
author: 'db',
changeLog: 'orders.xml',
checksum: '9:abc',
execType: 'EXECUTED',
contexts: [],
labels: [],
};
vi.spyOn(instance, 'fetchLiquibase').mockResolvedValue({
data: {
contexts: {
application: {
liquibaseBeans: {
east: {
changeSets: [{ ...changeSet, deploymentId: 'east-deploy' }],
},
west: {
changeSets: [{ ...changeSet, deploymentId: 'west-deploy' }],
},
},
},
},
},
} as never);
render(Liquibase, { props: { instance } });
const [east, west] = await screen.findAllByText('001');
await fireEvent.click(east);
expect(screen.getByText('east-deploy')).toBeVisible();
expect(screen.queryByText('west-deploy')).toBeNull();
await fireEvent.click(west);
expect(screen.getByText('west-deploy')).toBeVisible();
await fireEvent.click(east);
expect(within(west.closest('table')!).getByText('west-deploy')).toBeVisible();
});
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,20 @@
<tbody>
<template
v-for="changeSet in report.changeSets"
:key="`${ctxName}-${name}-${changeSet.id}`"
:key="
JSON.stringify([
changeSet.changeLog,
changeSet.author,
changeSet.id,
])
"
>
<tr
class="is-selectable"
@click="
showDetails[changeSet.checksum]
? delete showDetails[changeSet.checksum]
: (showDetails[changeSet.checksum] = true)
showDetails.has(changeSet)
? showDetails.delete(changeSet)
: showDetails.add(changeSet)
"
>
<td v-text="changeSet.id" />
Expand All @@ -70,10 +76,7 @@
/>
</td>
</tr>
<tr
v-if="showDetails[changeSet.checksum]"
:key="`${ctxName}-${name}-${changeSet.id}-details`"
>
<tr v-if="showDetails.has(changeSet)">
<td colspan="6">
<table class="table is-fullwidth">
<tbody>
Expand Down Expand Up @@ -133,7 +136,7 @@ export default {
hasLoaded: false,
error: null,
contexts: null,
showDetails: {},
showDetails: new Set(),
}),
computed: {},
created() {
Expand Down
Loading