Description: modernize mocha test for mocha ≥ 8
Author: Xavier Guimard <yadd@debian.org>
Forwarded: not-needed
Last-Update: 2020-12-27

--- a/buffer-writer/test/writer-tests.js
+++ b/buffer-writer/test/writer-tests.js
@@ -22,9 +22,9 @@
   }
 };
 
-suite('adding int32', function () {
+describe('adding int32', function () {
   var testAddingInt32 = function (int, expectedBuffer) {
-    test('writes ' + int, function () {
+    it('writes ' + int, function () {
       var subject = new Writer();
       var result = subject.addInt32(int).join();
       assert.equalBuffers(result, expectedBuffer);
@@ -34,19 +34,19 @@
   testAddingInt32(0, [0, 0, 0, 0]);
   testAddingInt32(1, [0, 0, 0, 1]);
   testAddingInt32(256, [0, 0, 1, 0]);
-  test('writes largest int32', function () {
+  it('writes largest int32', function () {
     //todo need to find largest int32 when I have internet access
     return false;
   });
 
-  test('writing multiple int32s', function () {
+  it('writing multiple int32s', function () {
     var subject = new Writer();
     var result = subject.addInt32(1).addInt32(10).addInt32(0).join();
     assert.equalBuffers(result, [0, 0, 0, 1, 0, 0, 0, 0x0a, 0, 0, 0, 0]);
   });
 
-  suite('having to resize the buffer', function () {
-    test('after resize correct result returned', function () {
+  describe('having to resize the buffer', function () {
+    it('after resize correct result returned', function () {
       var subject = new Writer(10);
       subject.addInt32(1).addInt32(1).addInt32(1);
       assert.equalBuffers(subject.join(), [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1]);
@@ -54,26 +54,26 @@
   });
 });
 
-suite('int16', function () {
-  test('writes 0', function () {
+describe('int16', function () {
+  it('writes 0', function () {
     var subject = new Writer();
     var result = subject.addInt16(0).join();
     assert.equalBuffers(result, [0, 0]);
   });
 
-  test('writes 400', function () {
+  it('writes 400', function () {
     var subject = new Writer();
     var result = subject.addInt16(400).join();
     assert.equalBuffers(result, [1, 0x90]);
   });
 
-  test('writes many', function () {
+  it('writes many', function () {
     var subject = new Writer();
     var result = subject.addInt16(0).addInt16(1).addInt16(2).join();
     assert.equalBuffers(result, [0, 0, 0, 1, 0, 2]);
   });
 
-  test('resizes if internal buffer fills up', function () {
+  it('resizes if internal buffer fills up', function () {
     var subject = new Writer(3);
     var result = subject.addInt16(2).addInt16(3).join();
     assert.equalBuffers(result, [0, 2, 0, 3]);
@@ -81,33 +81,33 @@
 
 });
 
-suite('cString', function () {
-  test('writes empty cstring', function () {
+describe('cString', function () {
+  it('writes empty cstring', function () {
     var subject = new Writer();
     var result = subject.addCString().join();
     assert.equalBuffers(result, [0]);
   });
 
-  test('writes two empty cstrings', function () {
+  it('writes two empty cstrings', function () {
     var subject = new Writer();
     var result = subject.addCString("").addCString("").join();
     assert.equalBuffers(result, [0, 0]);
   });
 
 
-  test('writes non-empty cstring', function () {
+  it('writes non-empty cstring', function () {
     var subject = new Writer();
     var result = subject.addCString("!!!").join();
     assert.equalBuffers(result, [33, 33, 33, 0]);
   });
 
-  test('resizes if reached end', function () {
+  it('resizes if reached end', function () {
     var subject = new Writer(3);
     var result = subject.addCString("!!!").join();
     assert.equalBuffers(result, [33, 33, 33, 0]);
   });
 
-  test('writes multiple cstrings', function () {
+  it('writes multiple cstrings', function () {
     var subject = new Writer();
     var result = subject.addCString("!").addCString("!").join();
     assert.equalBuffers(result, [33, 0, 33, 0]);
@@ -115,13 +115,13 @@
 
 });
 
-test('writes char', function () {
+it('writes char', function () {
   var subject = new Writer(2);
   var result = subject.addChar('a').addChar('b').addChar('c').join();
   assert.equalBuffers(result, [0x61, 0x62, 0x63]);
 });
 
-test('gets correct byte length', function () {
+it('gets correct byte length', function () {
   var subject = new Writer(5);
   assert.strictEqual(subject.getByteLength(), 0);
   subject.addInt32(0);
@@ -130,79 +130,79 @@
   assert.strictEqual(subject.getByteLength(), 6);
 });
 
-test('can add arbitrary buffer to the end', function () {
+it('can add arbitrary buffer to the end', function () {
   var subject = new Writer(4);
   subject.addCString("!!!")
   var result = subject.add(Buffer.from("@@@")).join();
   assert.equalBuffers(result, [33, 33, 33, 0, 0x40, 0x40, 0x40]);
 });
 
-suite('can write normal string', function () {
+describe('can write normal string', function () {
   var subject = new Writer(4);
   var result = subject.addString("!").join();
   assert.equalBuffers(result, [33]);
-  test('can write cString too', function () {
+  it('can write cString too', function () {
     var result = subject.addCString("!").join();
     assert.equalBuffers(result, [33, 33, 0]);
   });
-  test('can resize', function () {
+  it('can resize', function () {
     var result = subject.addString("!!").join();
     assert.equalBuffers(result, [33, 33, 0, 33, 33]);
   });
 });
 
 
-suite('clearing', function () {
+describe('clearing', function () {
   var subject = new Writer();
   subject.addCString("@!!#!#");
   subject.addInt32(10401);
-  test('clears', function () {
+  it('clears', function () {
     subject.clear();
     assert.equalBuffers(subject.join(), []);
   });
-  test('writing more', function () {
+  it('writing more', function () {
     var joinedResult = subject.addCString("!").addInt32(9).addInt16(2).join();
     assert.equalBuffers(joinedResult, [33, 0, 0, 0, 0, 9, 0, 2]);
   });
-  test('returns result', function () {
+  it('returns result', function () {
     var flushedResult = subject.flush();
     assert.equalBuffers(flushedResult, [33, 0, 0, 0, 0, 9, 0, 2])
   });
-  test('clears the writer', function () {
+  it('clears the writer', function () {
     assert.equalBuffers(subject.join(), [])
     assert.equalBuffers(subject.flush(), [])
   });
 });
 
-test("resizing to much larger", function () {
+it("resizing to much larger", function () {
   var subject = new Writer(2);
   var string = "!!!!!!!!";
   var result = subject.addCString(string).flush();
   assert.equalBuffers(result, [33, 33, 33, 33, 33, 33, 33, 33, 0]);
 });
 
-suite("flush", function () {
-  test('added as a hex code to a full writer', function () {
+describe("flush", function () {
+  it('added as a hex code to a full writer', function () {
     var subject = new Writer(2);
     var result = subject.addCString("!").flush(0x50);
     assert.equalBuffers(result, [0x50, 0, 0, 0, 6, 33, 0]);
   });
 
-  test('added as a hex code to a non-full writer', function () {
+  it('added as a hex code to a non-full writer', function () {
     var subject = new Writer(10).addCString("!");
     var joinedResult = subject.join(0x50);
     var result = subject.flush(0x50);
     assert.equalBuffers(result, [0x50, 0, 0, 0, 6, 33, 0]);
   });
 
-  test('added as a hex code to a buffer which requires resizing', function () {
+  it('added as a hex code to a buffer which requires resizing', function () {
     var result = new Writer(2).addCString("!!!!!!!!").flush(0x50);
     assert.equalBuffers(result, [0x50, 0, 0, 0, 0x0D, 33, 33, 33, 33, 33, 33, 33, 33, 0]);
   });
 });
 
-suite("header", function () {
-  test('adding two packets with headers', function () {
+describe("header", function () {
+  it('adding two packets with headers', function () {
     var subject = new Writer(10).addCString("!");
     subject.addHeader(0x50);
     subject.addCString("!!");
