mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-01 02:41:39 -05:00
Improved settings model tests
no-issue This makes them way less brittle and reliant on correctly indexing an array
This commit is contained in:
parent
1500881923
commit
95fa815eb3
1 changed files with 6 additions and 8 deletions
|
@ -114,16 +114,14 @@ describe('Unit: models/settings', function () {
|
|||
return models.Settings.populateDefaults()
|
||||
.then(() => {
|
||||
eventSpy.callCount.should.equal(82);
|
||||
const eventsEmitted = eventSpy.args.map(args => args[0]);
|
||||
const checkEventEmitted = event => should.ok(eventsEmitted.includes(event), `${event} event should be emitted`);
|
||||
|
||||
eventSpy.args[1][0].should.equal('settings.db_hash.added');
|
||||
eventSpy.args[1][1].attributes.type.should.equal('core');
|
||||
checkEventEmitted('settings.db_hash.added');
|
||||
checkEventEmitted('settings.description.added');
|
||||
|
||||
eventSpy.args[13][0].should.equal('settings.description.added');
|
||||
eventSpy.args[13][1].attributes.type.should.equal('blog');
|
||||
eventSpy.args[13][1].attributes.value.should.equal('The professional publishing platform');
|
||||
|
||||
eventSpy.args[77][0].should.equal('settings.default_content_visibility.added');
|
||||
eventSpy.args[79][0].should.equal('settings.members_subscription_settings.added');
|
||||
checkEventEmitted('settings.default_content_visibility.added');
|
||||
checkEventEmitted('settings.members_subscription_settings.added');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue