mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-08-28 05:25:25 +00:00
test(ingestion): pin the modifiers isRequestHandler must NOT reject
The non-handler table covered the three markers that must reject and one control, but nothing covered the other half. Adding `'async'` to NON_HANDLER_MODIFIERS left all 56 tests green — and async is the dominant shape of a real Nest handler, so that widening would have silently deleted most routes in most Nest repos with the suite passing. Two reviewers reached this independently. The mutation now fails 2 tests. Also pins `override`, accessibility modifiers, and methods merely NAMED `get`/`set`/`static` — those are property_identifiers, not modifiers, and must survive.
This commit is contained in:
parent
c0e74a29f2
commit
4a381940c4
1 changed files with 29 additions and 0 deletions
|
|
@ -624,6 +624,35 @@ describe('NestJS decorator routes', () => {
|
|||
).toEqual([]);
|
||||
});
|
||||
|
||||
// The other half of the modifier check, and the half a mutation can actually
|
||||
// reach: these modifiers must NOT reject. `async` matters most — it is the
|
||||
// dominant shape of a real Nest handler, so widening the exclusion set to
|
||||
// include it would silently delete most routes in most Nest repos while the
|
||||
// table above stayed green. `override` and an accessibility modifier are the
|
||||
// other tokens that sit in the same position on a `method_definition`, and a
|
||||
// method merely NAMED `get`/`set`/`static` is a property_identifier, not a
|
||||
// modifier — it must survive too.
|
||||
it.each([
|
||||
{ label: 'an async method', member: "@Get('s') async s() {}" },
|
||||
{ label: 'a public method', member: "@Get('s') public s() {}" },
|
||||
{ label: 'a protected method', member: "@Get('s') protected s() {}" },
|
||||
{
|
||||
label: 'an async method with an accessibility modifier',
|
||||
member: "@Get('s') public async s() {}",
|
||||
},
|
||||
{ label: 'a method named get', member: "@Get('s') get() {}" },
|
||||
{ label: 'a method named static', member: "@Get('s') static() {}" },
|
||||
])('still emits the route for $label', ({ member }) => {
|
||||
expect(
|
||||
urls(`
|
||||
@Controller('v')
|
||||
export class C {
|
||||
${member}
|
||||
}
|
||||
`),
|
||||
).toEqual(['GET /v/s']);
|
||||
});
|
||||
|
||||
it('still emits the route for that same decorator on an instance method', () => {
|
||||
// The control for the table above — identical source minus the modifier.
|
||||
// It is what makes those three empty results evidence of the modifier
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue