Conversation
Signed-off-by: Roy Segall <roy@segall.io>
Signed-off-by: Roy Segall <roy@segall.io>
Signed-off-by: Roy Segall <roy@segall.io>
Signed-off-by: Roy Segall <roy@segall.io>
Signed-off-by: Roy Segall <roy@segall.io>
README.md
Outdated
| * Do time yourself (the benchmark is approximately 30 minutes) | ||
| * You may use every resource you would naturally use as a developer, except for AI-based tools such as Co-Pilot, ChatGPT, Bard etc. | ||
| * Please send the completed exercise zipped (.zip, or if the mail blocks just change the extension to something else) to Dror Elovits (d.elovits@tricentis.com) within up to 48h | ||
| * Please send the completed exercise zipped (.zip, or if the mail blocks just change the extension to something else) to Dror Elovits (y.raz@tricentis.com) within up to 48h |
There was a problem hiding this comment.
| * Please send the completed exercise zipped (.zip, or if the mail blocks just change the extension to something else) to Dror Elovits (y.raz@tricentis.com) within up to 48h | |
| * Please send the completed exercise zipped (.zip, or if the mail blocks just change the extension to something else) to Yuval Raz (y.raz@tricentis.com) within up to 48h |
emitter/part1.md
Outdated
| var f = new EventEmitter(); | ||
| f.on("Hello", function(data){ | ||
| ```js | ||
| var eventEitter = new EventEmitter(); |
|
Why did we remove the router exercise? you think its not needed? |
We never asked it 🤷♂️🫤 |
Signed-off-by: Roy Segall <roy@segall.io>
|
@RoySegall The router is not a bad question for some scenarios. The solution to the problem of not giving it as a question might be, giving it as a question. We might just need to develop it a little. Please don't delete it. |
Signed-off-by: Roy Segall <roy@segall.io>
@stefandokic-tricentis refactored it but since he does not have a write permission i copied it. Need to verify it. |
emitter/part2.md
Outdated
| Name your file `emitter.js` and export your class/constructor as `EventEmitter`. After you `npm i` you can execute `npm run test2`. | ||
|
|
||
| **We __encourage__ you to run the tests**. No newline at end of file | ||
| Name your file `Emitter.ts` and export your class/constructor as `EventEmitter`. After you `npm i` you can execute `npm run test:emitter:part1`. |
There was a problem hiding this comment.
| Name your file `Emitter.ts` and export your class/constructor as `EventEmitter`. After you `npm i` you can execute `npm run test:emitter:part1`. | |
| Name your file `Emitter.ts` and export your class/constructor as `EventEmitter`. After you `npm i` you can execute `npm run test:emitter:part2`. |
There was a problem hiding this comment.
Also, what if someone wants to run with bun?
This is so runtime assuming
| emitter.on("Hello", done); | ||
| emitter.trigger("Hello"); | ||
|
|
||
| expect(done).toHaveBeenCalled(); |
There was a problem hiding this comment.
This should really also test it has only been called once.
There was a problem hiding this comment.
And check it did not happen before .trigger
| const handler = vi.fn((data) => { | ||
| expect(data).toBe("World"); | ||
| }); | ||
|
|
||
| emitter.on("Hello", handler); | ||
| emitter.trigger("Hello", "World"); | ||
|
|
||
| expect(handler).toHaveBeenCalled(); |
There was a problem hiding this comment.
| const handler = vi.fn((data) => { | |
| expect(data).toBe("World"); | |
| }); | |
| emitter.on("Hello", handler); | |
| emitter.trigger("Hello", "World"); | |
| expect(handler).toHaveBeenCalled(); | |
| const handler = vi.fn(); | |
| emitter.on("Hello", handler); | |
| emitter.trigger("Hello", "World"); | |
| expect(handler).toHaveBeenCalledWith("world"); |
| }); | ||
|
|
||
| it("can trigger an event with no handlers", () => { | ||
| expect(() => emitter.trigger("Hello")).not.toThrow(); |
There was a problem hiding this comment.
Probably best to also check there were no unhandled rejections, you never know what code people write
|
|
||
| it("supports multiple event triggers same function", () => { | ||
| const trackedFunction = vi.fn(); | ||
| const trackedFunctionNotToBeInvoked = vi.fn(); |
There was a problem hiding this comment.
You never pass this function anywhere, how would it possibly be invoked?
|
|
||
| beforeEach(() => { | ||
| emitter = new EventEmitter(); | ||
| tracker = vi.fn(); |
| expect(trackedFunction).toHaveBeenCalledTimes(1); | ||
| }); | ||
|
|
||
| it("can remove and call off twice", () => { |
There was a problem hiding this comment.
You already tested you can remove, this just checks calling twice won't cause any issues
| it("can remove and call off twice", () => { | |
| it("can call off twice", () => { |
| expect(trackedFunction).toHaveBeenCalledTimes(1); | ||
| }); | ||
|
|
||
| it("removes the relevant event", () => { |
There was a problem hiding this comment.
| it("removes the relevant event", () => { | |
| it("removes only the relevant event", () => { |
Signed-off-by: Roy Segall <roy@segall.io>
מתפשרים על שאלות ראיון === מתפשרים על מועמדים, רק אומר |


A couple of notes about this one:
routerwe never got there