Skip to content

Commit ba434b2

Browse files
committed
this commit will implement the tests for pulling an image
1 parent 4c0d444 commit ba434b2

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

__tests__/ImageTab.test.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React from 'react';
2+
import * as helper from '../src/components/helper/commands';
23
import { describe, beforeEach, expect, test, jest } from '@jest/globals';
34
import Images from '../src/components/tabs/Images';
45
import {
@@ -57,14 +58,15 @@ describe('Images', () => {
5758
});
5859

5960
// currently gets stuck at window.runExec method --> reads undefined
60-
// describe('pull button on click', () => {
61-
// test('fires pull button functionality', () => {
62-
// const { container } = render(<Images {...props} />);
63-
// const pullButton = screen.getByRole('button', { name: 'Pull' });
64-
// fireEvent.click(pullButton);
65-
// expect(pullButton).toBeCalled;
66-
// });
67-
// });
61+
describe('pull button on click', () => {
62+
test('fires pull button functionality', () => {
63+
// const { container } = render(<Images {...props} />);
64+
const pullButton = screen.getByRole('button', { name: 'PULL' });
65+
fireEvent.click(pullButton);
66+
expect(pullButton).toBeCalled;
67+
expect(Images.handleClick).toBeCalled;
68+
});
69+
});
6870

6971
describe('Images', () => {
7072
test('Renders an image if one is found', () => {

src/components/tabs/Images.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const Images = (props: ImagesProps) => {
126126
setRepo(e.target.value);
127127
}}
128128
></input>
129-
<button className="etc-btn" onClick={() => handleClick()}>
129+
<button className="etc-btn" name='pull' onClick={() => handleClick()}>
130130
PULL
131131
</button>
132132
</span>

0 commit comments

Comments
 (0)