mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-22 08:46:39 -06:00
62056cab14
1. Delete unreachable code or refactor the code to make it reachable. 2. Unexpected var, use let or const instead. 3. Remove useless assignment to variable. 4. Define a constant instead of duplicating the literal 5. Remove commented out code
54 lines
1.4 KiB
JavaScript
54 lines
1.4 KiB
JavaScript
/////////////////////////////////////////////////////////////
|
|
//
|
|
// pgAdmin 4 - PostgreSQL Tools
|
|
//
|
|
// Copyright (C) 2013 - 2023, The pgAdmin Development Team
|
|
// This software is released under the PostgreSQL Licence
|
|
//
|
|
//////////////////////////////////////////////////////////////
|
|
|
|
import jasmineEnzyme from 'jasmine-enzyme';
|
|
import React from 'react';
|
|
import '../helper/enzyme.helper';
|
|
import { createMount } from '@material-ui/core/test-utils';
|
|
import Theme from '../../../pgadmin/static/js/Theme';
|
|
import PasswordResetPage from '../../../pgadmin/static/js/SecurityPages/PasswordResetPage';
|
|
|
|
describe('PasswordResetPage', ()=>{
|
|
let mount;
|
|
|
|
/* Use createMount so that material ui components gets the required context */
|
|
/* https://material-ui.com/guides/testing/#api */
|
|
beforeAll(()=>{
|
|
mount = createMount();
|
|
});
|
|
|
|
afterAll(() => {
|
|
mount.cleanUp();
|
|
});
|
|
|
|
beforeEach(()=>{
|
|
jasmineEnzyme();
|
|
});
|
|
|
|
let ctrlMount = (props)=>{
|
|
return mount(<Theme>
|
|
<PasswordResetPage {...props}/>
|
|
</Theme>);
|
|
};
|
|
|
|
it('basic', (done)=>{
|
|
const ctrl = ctrlMount({
|
|
actionUrl: '/reset/url',
|
|
csrfToken: 'some-token',
|
|
});
|
|
setTimeout(()=>{
|
|
expect(ctrl.find('form')).toHaveProp('action', '/reset/url');
|
|
expect(ctrl.find('input[name="password"]')).toExist();
|
|
expect(ctrl.find('input[name="password_confirm"]')).toExist();
|
|
ctrl.unmount();
|
|
done();
|
|
}, 100);
|
|
});
|
|
});
|