[ARVADOS-WORKBENCH2] updated: 2.1.0-227-ga51a9c10
Git user
git at public.arvados.org
Tue Feb 23 20:53:24 UTC 2021
Summary of changes:
.../token-dialog/token-dialog.test.tsx | 37 +++++++++++++++++++---
1 file changed, 33 insertions(+), 4 deletions(-)
via a51a9c10678118004ca3c4fb0af38c5c85d050eb (commit)
from 44a5f6968f1c2fb449dfb22e1742d2770662e6a9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit a51a9c10678118004ca3c4fb0af38c5c85d050eb
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date: Tue Feb 23 17:52:58 2021 -0300
16848: Adds unit tests.
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>
diff --git a/src/views-components/token-dialog/token-dialog.test.tsx b/src/views-components/token-dialog/token-dialog.test.tsx
index e8df29b8..519d9354 100644
--- a/src/views-components/token-dialog/token-dialog.test.tsx
+++ b/src/views-components/token-dialog/token-dialog.test.tsx
@@ -20,15 +20,44 @@ describe('<CurrentTokenDialog />', () => {
beforeEach(() => {
props = {
classes: {},
- data: {
- currentToken: '123123123123',
- },
+ token: 'xxxtokenxxx',
+ apiHost: 'example.com',
open: true,
dispatch: jest.fn(),
};
});
- describe('copy to clipboard', () => {
+ describe('Get API Token dialog', () => {
+ beforeEach(() => {
+ wrapper = mount(<TokenDialogComponent {...props} />);
+ });
+
+ it('should include API host and token', () => {
+ expect(wrapper.html()).toContain('export ARVADOS_API_HOST=example.com');
+ expect(wrapper.html()).toContain('export ARVADOS_API_TOKEN=xxxtokenxxx');
+ });
+
+ it('should show the token expiration if present', () => {
+ expect(props.tokenExpiration).toBeUndefined();
+ expect(wrapper.html()).not.toContain('Expires at:');
+
+ const someDate = '2140-01-01T00:00:00.000Z'
+ props.tokenExpiration = new Date(someDate);
+ wrapper = mount(<TokenDialogComponent {...props} />);
+ expect(wrapper.html()).toContain('Expires at:');
+ });
+
+ it('should show a create new token button when allowed', () => {
+ expect(props.canCreateNewTokens).toBeFalsy();
+ expect(wrapper.html()).not.toContain('GET NEW TOKEN');
+
+ props.canCreateNewTokens = true;
+ wrapper = mount(<TokenDialogComponent {...props} />);
+ expect(wrapper.html()).toContain('GET NEW TOKEN');
+ });
+ });
+
+ describe('copy to clipboard button', () => {
beforeEach(() => {
wrapper = mount(<TokenDialogComponent {...props} />);
});
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list