mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Added newsletter slug generation to mirage
This commit is contained in:
parent
7c04c2c472
commit
549e8c526f
@ -1,4 +1,6 @@
|
||||
import {camelize} from '@ember/string';
|
||||
import {dasherize} from '@ember/string';
|
||||
import {isBlank} from '@ember/utils';
|
||||
import {paginatedResponse} from '../utils';
|
||||
|
||||
export default function mockNewsletters(server) {
|
||||
@ -12,6 +14,10 @@ export default function mockNewsletters(server) {
|
||||
const senderEmail = attrs.senderEmail;
|
||||
attrs.senderEmail = null;
|
||||
|
||||
if (isBlank(attrs.slug) && !isBlank(attrs.name)) {
|
||||
attrs.slug = dasherize(attrs.name);
|
||||
}
|
||||
|
||||
const newsletter = newsletters.create(attrs);
|
||||
|
||||
// workaround for mirage output of meta
|
||||
|
@ -153,7 +153,7 @@ describe('Acceptance: Settings - Newsletters', function () {
|
||||
|
||||
await checkSave({});
|
||||
|
||||
expect(findAll('[data-test-newsletter]').length, 'Total newsletters shown').to.equal(2);
|
||||
expect(findAll('[data-test-newsletter]').length, 'Total newsletters shown afterwards').to.equal(2);
|
||||
});
|
||||
|
||||
it('validates create newsletter before saving', async function () {
|
||||
@ -174,7 +174,7 @@ describe('Acceptance: Settings - Newsletters', function () {
|
||||
// Everything should be valid
|
||||
await checkSave({});
|
||||
|
||||
expect(findAll('[data-test-newsletter]').length, 'Total newsletters shown').to.equal(2);
|
||||
expect(findAll('[data-test-newsletter]').length, 'Total newsletters shown afterwards').to.equal(2);
|
||||
});
|
||||
|
||||
it('checks limits when creating a newsletter', async function () {
|
||||
|
Loading…
Reference in New Issue
Block a user