Skip to content

Commit

Permalink
test: Adjust files_external tests for password confirmation
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux committed Oct 30, 2024
1 parent 8434dbf commit 31be95e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion apps/files_external/tests/js/settingsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@ describe('OCA.Files_External.Settings tests', function() {
var clock;
var select2Stub;
var select2ApplicableUsers;
var passwordConfirmationStub;

beforeEach(function() {
beforeAll(() => {
clock = sinon.useFakeTimers();
passwordConfirmationStub = sinon.stub(window.OC.PasswordConfirmation, 'requirePasswordConfirmation');
passwordConfirmationStub.callsArg(0);
})

beforeEach(function() {
passwordConfirmationStub.resetHistory()
select2ApplicableUsers = [];
select2Stub = sinon.stub($.fn, 'select2').callsFake(function(args) {
if (args === 'val') {
Expand Down Expand Up @@ -236,6 +243,8 @@ describe('OCA.Files_External.Settings tests', function() {
var $saveButton = $tr.find('td.save .icon-checkmark');
$saveButton.click();

sinon.assert.calledOnce(passwordConfirmationStub);

expect(fakeServer.requests.length).toEqual(1);
var request = fakeServer.requests[0];
expect(request.url).toEqual(OC.getRootPath() + '/index.php/apps/files_external/globalstorages');
Expand Down Expand Up @@ -270,6 +279,8 @@ describe('OCA.Files_External.Settings tests', function() {
var $saveButton = $tr.find('td.save .icon-checkmark');
$saveButton.click();

sinon.assert.calledOnce(passwordConfirmationStub);

expect(fakeServer.requests.length).toEqual(1);
var request = fakeServer.requests[0];
expect(request.url).toEqual(OC.getRootPath() + '/index.php/apps/files_external/globalstorages');
Expand Down

0 comments on commit 31be95e

Please sign in to comment.