Skip to content

Commit

Permalink
fix: app.keys getter must have a setter either (#3891)
Browse files Browse the repository at this point in the history
  • Loading branch information
dead-horse authored Aug 21, 2019
1 parent f170741 commit a9d0cf5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ class Application extends EggApplication {
return this[KEYS];
}

set keys(_) {
// ignore
}

/**
* reference to {@link Helper}
* @member {Helper} Application#Helper
Expand Down
16 changes: 16 additions & 0 deletions test/app/extend/application.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,20 @@ describe('test/app/extend/application.test.js', () => {
assert(ctx.body === 'middleware resolution');
});
});

describe('app.keys', () => {
let app;
before(() => {
app = utils.app('apps/demo');
return app.ready();
});
after(() => app.close());

it('should work for app.keys and app.keys=', async () => {
assert.deepEqual(app.keys, [ 'foo' ]);
// `app.keys=` will be ignored
app.keys = undefined;
assert.deepEqual(app.keys, [ 'foo' ]);
});
});
});

0 comments on commit a9d0cf5

Please sign in to comment.