0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Fixed tests

refs 85cce39af7

- removed out of date transfer owner modal integration test
- fixed missing `?` in optional chaining in `<GhImageUploader>` error handling
This commit is contained in:
Kevin Ansfield 2022-10-03 22:05:02 +01:00
parent bdc5984cdc
commit cd9a50841e
2 changed files with 1 additions and 28 deletions

View file

@ -248,7 +248,7 @@ export default Component.extend({
message = `The image type you uploaded is not supported. Please use ${validExtensions}`;
} else if (isRequestEntityTooLargeError(error)) {
message = 'The image you uploaded was larger than the maximum file size your server allows.';
} else if (!isBlank(error.payload?.errors[0]?.message)) {
} else if (!isBlank(error.payload?.errors?.[0]?.message)) {
message = error.payload.errors[0].message;
} else {
message = 'Something went wrong :(';

View file

@ -1,27 +0,0 @@
import RSVP from 'rsvp';
import hbs from 'htmlbars-inline-precompile';
import sinon from 'sinon';
import {click, render} from '@ember/test-helpers';
import {describe, it} from 'mocha';
import {expect} from 'chai';
import {setupRenderingTest} from 'ember-mocha';
describe('Integration: Component: modal-transfer-owner', function () {
setupRenderingTest();
it('triggers confirm action', async function () {
let confirm = sinon.stub();
let closeModal = sinon.spy();
confirm.returns(RSVP.resolve({}));
this.set('confirm', confirm);
this.set('closeModal', closeModal);
await render(hbs`{{modal-transfer-owner confirm=(action confirm) closeModal=(action closeModal)}}`);
await click('.gh-btn.gh-btn-red');
expect(confirm.calledOnce, 'confirm called').to.be.true;
expect(closeModal.calledOnce, 'closeModal called').to.be.true;
});
});