-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Shared Data files (Feature PR) (#330)
- Loading branch information
Showing
63 changed files
with
2,238 additions
and
544 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 |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
pull_request: | ||
branches: | ||
- main | ||
- feature/shared-files | ||
types: | ||
- opened | ||
- edited | ||
|
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
REACT_APP_TERRASO_ENV=local | ||
REACT_APP_TERRASO_API_URL=http://127.0.0.1:8000 | ||
REACT_APP_PLAUSIBLE_DOMAIN=app.local.terraso.org | ||
REACT_APP_SHARED_DATA_ACCEPTED_EXTENSIONS=xlsx,xls,csv |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -59,7 +59,7 @@ test('AccountProfile: Display Avatar with missing image', async () => { | |
}); | ||
|
||
test('AccountProfile: Save', async () => { | ||
terrasoApi.request.mockResolvedValue( | ||
terrasoApi.requestGraphQL.mockResolvedValue( | ||
_.set( | ||
'updateUser.user', | ||
{ | ||
|
@@ -98,8 +98,8 @@ test('AccountProfile: Save', async () => { | |
await act(async () => | ||
fireEvent.click(screen.getByRole('button', { name: 'Confirm' })) | ||
); | ||
expect(terrasoApi.request).toHaveBeenCalledTimes(1); | ||
expect(terrasoApi.request.mock.calls[0][1]).toStrictEqual({ | ||
expect(terrasoApi.requestGraphQL).toHaveBeenCalledTimes(1); | ||
expect(terrasoApi.requestGraphQL.mock.calls[0][1]).toStrictEqual({ | ||
input: { | ||
id: 'user-id', | ||
firstName: 'Pablo', | ||
|
@@ -108,7 +108,7 @@ test('AccountProfile: Save', async () => { | |
}); | ||
}); | ||
test('AccountProfile: Save language', async () => { | ||
terrasoApi.request.mockResolvedValueOnce( | ||
terrasoApi.requestGraphQL.mockResolvedValueOnce( | ||
_.set( | ||
'updateUser.user', | ||
{ | ||
|
@@ -124,7 +124,7 @@ test('AccountProfile: Save language', async () => { | |
{} | ||
) | ||
); | ||
terrasoApi.request.mockResolvedValueOnce( | ||
terrasoApi.requestGraphQL.mockResolvedValueOnce( | ||
_.set( | ||
'updateUserPreference.preference', | ||
{ key: 'language', value: 'es-ES' }, | ||
|
@@ -164,15 +164,15 @@ test('AccountProfile: Save language', async () => { | |
await act(async () => | ||
fireEvent.click(screen.getByRole('button', { name: 'Confirm' })) | ||
); | ||
expect(terrasoApi.request).toHaveBeenCalledTimes(2); | ||
expect(terrasoApi.request.mock.calls[0][1]).toStrictEqual({ | ||
expect(terrasoApi.requestGraphQL).toHaveBeenCalledTimes(2); | ||
expect(terrasoApi.requestGraphQL.mock.calls[0][1]).toStrictEqual({ | ||
input: { | ||
id: 'user-id', | ||
firstName: 'Pablo', | ||
lastName: 'Perez', | ||
}, | ||
}); | ||
expect(terrasoApi.request.mock.calls[1][1]).toStrictEqual({ | ||
expect(terrasoApi.requestGraphQL.mock.calls[1][1]).toStrictEqual({ | ||
input: { | ||
key: 'language', | ||
userEmail: '[email protected]', | ||
|
@@ -181,7 +181,7 @@ test('AccountProfile: Save language', async () => { | |
}); | ||
}); | ||
test('AccountProfile: Save error', async () => { | ||
terrasoApi.request.mockRejectedValueOnce('Save Error'); | ||
terrasoApi.requestGraphQL.mockRejectedValueOnce('Save Error'); | ||
|
||
const { inputs } = await setup({ | ||
account: { | ||
|
@@ -205,7 +205,7 @@ test('AccountProfile: Save error', async () => { | |
await act(async () => | ||
fireEvent.click(screen.getByRole('button', { name: 'Confirm' })) | ||
); | ||
expect(terrasoApi.request).toHaveBeenCalledTimes(1); | ||
expect(terrasoApi.requestGraphQL).toHaveBeenCalledTimes(1); | ||
|
||
// Test error display | ||
expect(screen.getByText(/Save Error/i)).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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ test('Auth: test redirect', async () => { | |
useParams.mockReturnValue({ | ||
slug: 'slug-1', | ||
}); | ||
terrasoApi.request.mockRejectedValueOnce('UNAUTHENTICATED'); | ||
terrasoApi.requestGraphQL.mockRejectedValueOnce('UNAUTHENTICATED'); | ||
global.fetch.mockResolvedValueOnce({ | ||
status: 401, | ||
}); | ||
|
@@ -59,7 +59,7 @@ test('Auth: test redirect', async () => { | |
); | ||
|
||
expect(global.fetch).toHaveBeenCalledTimes(2); | ||
expect(terrasoApi.request).toHaveBeenCalledTimes(1); | ||
expect(terrasoApi.requestGraphQL).toHaveBeenCalledTimes(1); | ||
expect(screen.getByText('To: /account')).toBeInTheDocument(); | ||
}); | ||
test('Auth: test redirect referrer', async () => { | ||
|
@@ -81,7 +81,7 @@ test('Auth: test refresh tokens', async () => { | |
useParams.mockReturnValue({ | ||
slug: 'slug-1', | ||
}); | ||
terrasoApi.request | ||
terrasoApi.requestGraphQL | ||
.mockRejectedValueOnce('UNAUTHENTICATED') | ||
.mockResolvedValueOnce({}); | ||
global.fetch.mockResolvedValueOnce({ | ||
|
@@ -114,7 +114,7 @@ test('Auth: test refresh tokens', async () => { | |
}); | ||
test('Auth: test fetch user', async () => { | ||
getUserEmail.mockReturnValue(Promise.resolve('[email protected]')); | ||
terrasoApi.request.mockReturnValue( | ||
terrasoApi.requestGraphQL.mockReturnValue( | ||
Promise.resolve( | ||
_.set( | ||
'users.edges[0].node', | ||
|
@@ -141,5 +141,5 @@ test('Auth: test fetch user', async () => { | |
} | ||
); | ||
|
||
expect(terrasoApi.request).toHaveBeenCalledTimes(1); | ||
expect(terrasoApi.requestGraphQL).toHaveBeenCalledTimes(1); | ||
}); |
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
Oops, something went wrong.