Skip to content

Commit 8081c34

Browse files
author
David Haeffner
committed
Fix for isRegistered hook check
1 parent 5b4680f commit 8081c34

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/code-export-utils/__test__/src/hook.spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,16 @@ describe('Hooks', () => {
6262
],
6363
})
6464
})
65-
it('should allow for checking if a command is already registered', () => {
65+
it('should check if a command is already registered', () => {
6666
const hook = new Hook()
6767
hook.register(() => {
6868
return 'blah'
6969
})
70+
hook.register(() => {
71+
return 1234
72+
})
7073
expect(hook.isRegistered('blah')).resolves.toBeTruthy()
74+
expect(hook.isRegistered(1234)).resolves.toBeTruthy()
7175
expect(hook.isRegistered('halb')).resolves.toBeFalsy()
7276
})
7377
})

packages/code-export-utils/src/hook.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export default class Hook {
8383

8484
async isRegistered(input = '') {
8585
const result = await Promise.all(this.emitters.map(emitter => emitter()))
86-
return result.map(command => command.includes(input)).includes(true)
86+
return result.includes(input)
8787
}
8888
}
8989

0 commit comments

Comments
 (0)