Skip to content

Commit

Permalink
improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuzen committed Jul 24, 2023
1 parent 6d99c18 commit 3bcd67f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
9 changes: 6 additions & 3 deletions frontend/components/CommentCount.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,20 @@
*/

import {expect, test} from 'vitest';
import {mount} from '@vue/test-utils';
import {flushPromises, mount} from '@vue/test-utils';
import CommentCount from "./CommentCount.vue";

test('comment count', () => {

const apiUrl = "/api/dac97c6d-ddb9-47cf-bf72-913fa0ebbbfd/count";
test('comment count', async () => {
expect(CommentCount).toBeTruthy();

const wrapper = mount(CommentCount, {
props: {
url: "apiUrl",
url: apiUrl,
},
});
await flushPromises();

expect(wrapper.html()).toMatchSnapshot();
expect(wrapper.exists()).toBe(true);
Expand Down
2 changes: 0 additions & 2 deletions frontend/components/CommentCount.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ export default defineComponent({
}
this.loading = false;
return response.json();
} else {
this.error = response.statusText;
}
} catch (e) {
this.error = (e as Error).message;
Expand Down
1 change: 1 addition & 0 deletions frontend/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ beforeEach(() => {

test('mount app', async () => {
document.body.innerHTML = `<div class="comment-viewer" data-url="/api"></div>
<div class="comment-count" data-url="/api"></div>
<input name="csrfmiddlewaretoken"/>`;

const spy = vi.spyOn(exports, 'createApp').mockImplementation(createApp);
Expand Down

0 comments on commit 3bcd67f

Please sign in to comment.