Skip to content

Commit

Permalink
fix: audit events error
Browse files Browse the repository at this point in the history
  • Loading branch information
SteKoe committed Jun 22, 2022
1 parent 77de9ec commit fb6cdd2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 32 deletions.
@@ -1,7 +1,7 @@
import {render} from '@/test-utils';
import Auditevents from '@/views/instances/auditevents/index';
import Instance from '@/services/instance.js';
import {screen, waitFor} from '@testing-library/vue';
import {getByText, screen, waitFor} from '@testing-library/vue';
import userEvent from '@testing-library/user-event';

describe('Auditevents', () => {
Expand Down Expand Up @@ -59,22 +59,6 @@ describe('Auditevents', () => {
await screen.findByText('Fetching of data failed.');
});

it('handles error when fetching data from Spring 1 services', async () => {
await render(Auditevents, {
props: {
instance: createInstance(jest.fn().mockRejectedValue({
response: {
headers: {
'content-type': ''
}
}
}))
}
});

await screen.findByText('instances.auditevents.audit_log_not_supported_spring_boot_1');
});

function createInstance(fetchAuditevents) {
let instance = new Instance({id: 4711});
instance.fetchAuditevents = fetchAuditevents;
Expand Down
Expand Up @@ -53,15 +53,6 @@
</template>

<sba-panel :seamless="true">
<div
v-if="isOldAuditevents"
class="message is-warning"
>
<div
class="message-body"
v-html="$t('instances.auditevents.audit_log_not_supported_spring_boot_1')"
/>
</div>
<auditevents-list
:instance="instance"
:events="events"
Expand All @@ -83,6 +74,7 @@ import SbaInstanceSection from "../shell/sba-instance-section.vue";
import SbaStickySubnav from "../../../components/sba-sticky-subnav.vue";
import SbaPanel from "../../../components/sba-panel.vue";
import SbaInput from "../../../components/sba-input.vue";
import SbaAlert from "../../../components/sba-alert.vue";
class Auditevent {
constructor({timestamp, ...event}) {
Expand Down Expand Up @@ -130,7 +122,6 @@ export default {
type: null,
principal: null
},
isOldAuditevents: false
}),
watch: {
filter: {
Expand Down Expand Up @@ -176,11 +167,7 @@ export default {
},
error: error => {
console.warn('Fetching audit events failed:', error);
if (error.response.headers['content-type'].includes('application/vnd.spring-boot.actuator.v2')) {
vm.error = error;
} else {
vm.isOldAuditevents = true;
}
vm.error = error;
}
});
},
Expand Down

0 comments on commit fb6cdd2

Please sign in to comment.