mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 07:55:47 +01:00
25 lines
599 B
TypeScript
25 lines
599 B
TypeScript
|
|
import fetchMock from 'fetch-mock';
|
||
|
|
import { CONTENT_TYPE_PASSWORD_OVERWRITE, setPassword } from './setPassword';
|
||
|
|
|
||
|
|
describe('password change', () => {
|
||
|
|
const SET_PASSWORD_URL = '/users/testuser/password';
|
||
|
|
const newPassword = 'testpw123';
|
||
|
|
|
||
|
|
afterEach(() => {
|
||
|
|
fetchMock.reset();
|
||
|
|
fetchMock.restore();
|
||
|
|
});
|
||
|
|
|
||
|
|
it('should set password', done => {
|
||
|
|
fetchMock.put('/api/v2' + SET_PASSWORD_URL, 204, {
|
||
|
|
headers: {
|
||
|
|
'content-type': CONTENT_TYPE_PASSWORD_OVERWRITE,
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|
||
|
|
setPassword(SET_PASSWORD_URL, newPassword).then(content => {
|
||
|
|
done();
|
||
|
|
});
|
||
|
|
});
|
||
|
|
});
|