const detector = require("../src/detector");

describe("When detector emit hotword", () => {
  it("should emit an hotword event in speeech", () => {
    const mockSpeeech = {
      emit: jest.fn()
    };

    const mydetector = detector(mockSpeeech);
    mydetector.emit("hotword");

    expect(mockSpeeech.emit.mock.calls.length).toBe(1);
  });
});

@@ -1,50 +1,475 @@
-const detector = require(%22../src/detector%22);%0A%0A
+describe(%22Detector%22, () =%3E %7B%0A  beforeEach(() =%3E %7B%0A    jest.resetModules();%0A  %7D);%0A%0A  describe(%22When create detector and emit hotword%22, () =%3E %7B%0A    it(%22should emit an hotword event in speeech%22, () =%3E %7B%0A      const detector = require(%22../src/detector%22);%0A      const mockSpeeech = %7B%0A        emit: jest.fn()%0A      %7D;%0A%0A      const mydetector = detector(mockSpeeech);%0A      mydetector.emit(%22hotword%22);%0A%0A      expect(mockSpeeech.emit.mock.calls.length).toBe(1);%0A    %7D);%0A  %7D);%0A%0A  
 desc
@@ -479,16 +479,27 @@
 e(%22When 
+create two 
 detector
@@ -499,16 +499,20 @@
 etector 
+and 
 emit hot
@@ -526,16 +526,18 @@
 () =%3E %7B%0A
+  
   it(%22sh
@@ -538,34 +538,40 @@
 it(%22should emit 
-an
+just one
  hotword event i
@@ -586,24 +586,77 @@
 h%22, () =%3E %7B%0A
+      const detector = require(%22../src/detector%22);%0A  
     const mo
@@ -671,24 +671,26 @@
 h = %7B%0A      
+ 
+ 
 emit: jest.f
@@ -697,24 +697,26 @@
 n()%0A    
+  
 %7D;%0A%0A    
 const my
@@ -703,29 +703,71 @@
     %7D;%0A%0A    
-const
+  let mydetector = detector(mockSpeeech);%0A     
  mydetector 
@@ -791,24 +791,26 @@
 eeech);%0A    
+  
 mydetector.e
@@ -822,24 +822,26 @@
 hotword%22);%0A%0A
+  
     expect(m
@@ -884,16 +884,24 @@
 oBe(1);%0A
+    %7D);%0A
   %7D);%0A%7D)

Add test for detector