const buster = require('buster')
const supertest = require('supertest')
const app = require('../lib/router')

buster.testCase('router test', {
  'should return monitoring page on all routes': function (done) {
    this.timeout = 1000
    var router = app.makeServer(1234)
    supertest(router)
    .get('/')
    .expect(200)
    .end(done((err, res) => {
      buster.refute(err)
      buster.assert.match(res.text, /You visited following IP addresses/)
      app.stopServer(router)
    }))
    router = app.makeServer(4321)
    supertest(router)
    .post('/anotherRoute')
    .expect(200)
    .end(done((err, res) => {
      buster.refute(err)
      buster.assert.match(res.text, /You visited following IP addresses/)
      app.stopServer(router)
    }))
  }
})

buster.testCase('cleanIP', {
  'Should return clean IP': function () {
    buster.assert.equals(app.removeIPv6Preface('::ffff:0.0.0.0'), '0.0.0.0')
  }
})

@@ -1,41 +1,39 @@
-const buster = require('buster')%0Acons
+import %7B expect %7D from 'chai'%0Aimpor
 t su
@@ -40,26 +40,21 @@
 pertest 
-= require(
+from 
 'superte
@@ -60,30 +60,67 @@
 est'
-)%0Aconst app = require(
+%0Aimport %7B makeServer, killServer, removeIPv6Preface %7D from 
 '../
@@ -134,29 +134,21 @@
 ter'
-)
 %0A%0A
-buster.testCase('r
+describe('R
 oute
@@ -155,21 +155,32 @@
 r test',
+ () =%3E
  %7B%0A  
+  it(
 'should 
@@ -191,17 +191,17 @@
 rn monit
-o
+p
 ring pag
@@ -209,42 +209,42 @@
  on 
-all 
 route
-s': function
+ %22/%22',
  (done)
+ =%3E
  %7B%0A   
+     //
  thi
@@ -268,25 +268,27 @@
     
-var rout
+    const serv
 er = 
-app.
 make
@@ -300,16 +300,20 @@
 r(1234)%0A
+    
     supe
@@ -314,32 +314,40 @@
   supertest(
-rout
+serv
 er)%0A
+        
     .get('/'
@@ -348,16 +348,24 @@
 et('/')%0A
+        
     .exp
@@ -373,33 +373,36 @@
 ct(200)%0A    
-.end(done
+        .end
 ((err, res) 
@@ -416,155 +416,361 @@
     
-buster.refute(err)%0A      buster.assert.match(res.text, /You visited following IP addresses/)%0A      app.stopServer(router)%0A    %7D))%0A    router = app.
+          console.log(err)%0A                expect(err).to.equal(null)%0A                expect(res.text).to.match(/You visited following IP addresses/)%0A                killServer(server)%0A                done()%0A            %7D)%0A    %7D)%0A    it('should return monitpring page on another route', (done) =%3E %7B%0A        // this.timeout = 1000%0A        const server = 
 make
@@ -780,14 +780,18 @@
 ver(
-4321
+1234
 )%0A
+    
     
@@ -804,24 +804,31 @@
 est(
-router)%0A
+server)%0A        
     .
-pos
+ge
 t('/
@@ -842,16 +842,24 @@
 Route')%0A
+        
     .exp
@@ -863,24 +863,32 @@
 expect(200)%0A
+        
     .end(don
@@ -884,21 +884,16 @@
    .end(
-done(
 (err, re
@@ -910,21 +910,29 @@
     
-buster.refute
+          console.log
 (err
@@ -943,38 +943,87 @@
     
-buster.assert.match(res.text, 
+          expect(err).to.equal(null)%0A                expect(res.text).to.match(
 /You
@@ -1066,35 +1066,41 @@
     
-app.stop
+          kill
 Server(
-rout
+serv
 er)%0A    
 %7D))%0A
@@ -1099,42 +1099,68 @@
     
+            done()%0A            
 %7D
-)
 )%0A  
-%7D
+  %7D)
 %0A%7D)%0A%0A
-buster.testCas
+describ
 e('clean
 IP',
@@ -1159,86 +1159,90 @@
 lean
+ 
 IP
-', %7B%0A  'Should return clean IP': function () %7B%0A    buster.assert.equals(app.
+ address', () =%3E %7B%0A    it('should remove IPv6 preface', () =%3E %7B%0A        expect(
 remo
@@ -1272,18 +1272,30 @@
 .0.0.0')
-, 
+).to.be.equal(
 '0.0.0.0
@@ -1299,13 +1299,16 @@
 0.0')%0A  
-%7D
+  %7D)
 %0A%7D)%0A

Move test from buster to chai