-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e93b296
commit d4161b0
Showing
4 changed files
with
198 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from 'react' | ||
import {render, fireEvent} from '@testing-library/react' | ||
import { | ||
mockedUseAuth0, | ||
mockedUserLoggedIn, | ||
mockedUserLoggedOut} from '../__mocks__/authentication' | ||
import OpenModelControl from './OpenModelControl' | ||
import ShareMock from '../ShareMock' | ||
|
||
|
||
describe('Open Model Dialog', () => { | ||
it('Renders a login message if the user is not logged in', () => { | ||
mockedUseAuth0.mockReturnValue(mockedUserLoggedOut) | ||
const {getByTitle, getByText} = render(<ShareMock><OpenModelControl/></ShareMock>) | ||
const button = getByTitle('Open IFC') | ||
fireEvent.click(button) | ||
const loginText = getByText('Please login to get access to your files on GitHub') | ||
expect(loginText).toBeInTheDocument() | ||
}) | ||
it('Renders file selector if the user is logged in', async () => { | ||
mockedUseAuth0.mockReturnValue(mockedUserLoggedIn) | ||
const {getByTitle, getByTestId} = render(<ShareMock><OpenModelControl/></ShareMock>) | ||
const button = getByTitle('Open IFC') | ||
fireEvent.click(button) | ||
const File = getByTestId('File') | ||
const Repository = await getByTestId('Repository') | ||
expect(File).toBeInTheDocument() | ||
expect(Repository).toBeInTheDocument() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters