Skip to content

Commit

Permalink
test: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Jankowski committed Dec 21, 2023
1 parent 553ae50 commit 219ba0d
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -621,11 +621,20 @@ describe('HttpOperation', () => {
it('should display callback operation', async () => {
const { unmount } = render(<HttpOperation data={{ ...httpOperation, deprecated: false }} />);

const serversButton = screen.getByRole('button', { name: /server/i });
userEvent.click(serversButton);

const enableItem = screen.getByRole('menuitemradio', { name: /development/i });
userEvent.click(enableItem);

expect(serversButton).toHaveTextContent('Development');

//operation name
expect(screen.queryByText('newPet')).toBeInTheDocument();

// operation header
expect(screen.queryByText('{$request.body#/newPetAvailableUrl}')).toBeInTheDocument();
expect(screen.queryAllByText(/https:\/\/todos-dev.stoplight.io/).length).toEqual(1); // server url visible only in the main operation header, not in callback

// operation body
expect(screen.queryByText('Callback body description')).toBeInTheDocument();
Expand Down

0 comments on commit 219ba0d

Please sign in to comment.