mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Added missing error messages for members uploader
fix https://linear.app/tryghost/issue/SLO-97/missing-messages-for-members-file-upload - these were missing, so if the members importer wasn't given a file, it would crash with an HTTP 500 error - also added a test to ensure we get a 422 back
This commit is contained in:
parent
5a8145139a
commit
a50bb8d79e
2 changed files with 16 additions and 0 deletions
|
@ -24,6 +24,10 @@ const messages = {
|
||||||
missingFile: 'Please select a theme.',
|
missingFile: 'Please select a theme.',
|
||||||
invalidFile: 'Please select a valid zip file.'
|
invalidFile: 'Please select a valid zip file.'
|
||||||
},
|
},
|
||||||
|
members: {
|
||||||
|
missingFile: 'Please select a members CSV file.',
|
||||||
|
invalidFile: 'Please select a valid CSV file.'
|
||||||
|
},
|
||||||
images: {
|
images: {
|
||||||
missingFile: 'Please select an image.',
|
missingFile: 'Please select an image.',
|
||||||
invalidFile: 'Please select a valid image.'
|
invalidFile: 'Please select a valid image.'
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const assert = require('assert/strict');
|
||||||
const should = require('should');
|
const should = require('should');
|
||||||
const supertest = require('supertest');
|
const supertest = require('supertest');
|
||||||
const testUtils = require('../../utils');
|
const testUtils = require('../../utils');
|
||||||
|
@ -312,4 +313,15 @@ describe('Members Importer API', function () {
|
||||||
|
|
||||||
postLabelRemoveBrowseResponse.body.members.should.have.length(0);
|
postLabelRemoveBrowseResponse.body.members.should.have.length(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Can handle empty body', async function () {
|
||||||
|
const res = await request
|
||||||
|
.post(localUtils.API.getApiQuery(`members/upload/`))
|
||||||
|
.set('Origin', config.get('url'))
|
||||||
|
.expect('Content-Type', /json/)
|
||||||
|
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||||
|
.expect(422);
|
||||||
|
|
||||||
|
assert.equal(res.body.errors[0].message, 'Please select a members CSV file.');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue