-
-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use private "__kind" property instead of instanceof
- Loading branch information
1 parent
468aa2f
commit 09ef3ef
Showing
7 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { GraphQLHandler } from '../../handlers/GraphQLHandler' | ||
import { HttpHandler } from '../../handlers/HttpHandler' | ||
import { RequestHandler } from '../../handlers/RequestHandler' | ||
import { WebSocketHandler } from '../../handlers/WebSocketHandler' | ||
import { toRequestHandlersOnly } from './toRequestHandlersOnly' | ||
|
||
it('returns true for HttpHandler', () => { | ||
expect(toRequestHandlersOnly(new HttpHandler('*', '*', () => {}))).toBe(true) | ||
}) | ||
|
||
it('returns true for GraphQLHandler', () => { | ||
expect( | ||
toRequestHandlersOnly(new GraphQLHandler('all', '*', '*', () => {})), | ||
).toBe(true) | ||
}) | ||
|
||
it('returns true for a custom RequestHandler', () => { | ||
class MyHandler extends RequestHandler { | ||
constructor() { | ||
super({ info: { header: '*' }, resolver: () => {} }) | ||
} | ||
predicate = () => false | ||
log() {} | ||
} | ||
|
||
expect(toRequestHandlersOnly(new MyHandler())).toBe(true) | ||
}) | ||
|
||
it('returns false for a WebSocketHandler', () => { | ||
expect(toRequestHandlersOnly(new WebSocketHandler('*'))).toBe(false) | ||
}) | ||
|
||
it('returns false for an arbitrary values', () => { | ||
expect(toRequestHandlersOnly(undefined)).toBe(false) | ||
expect(toRequestHandlersOnly(null)).toBe(false) | ||
expect(toRequestHandlersOnly({})).toBe(false) | ||
expect(toRequestHandlersOnly([])).toBe(false) | ||
expect(toRequestHandlersOnly(123)).toBe(false) | ||
expect(toRequestHandlersOnly('hello')).toBe(false) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters