sanex3339 пре 9 година
родитељ
комит
62b838d271
2 измењених фајлова са 11 додато и 11 уклоњено
  1. 2 2
      src/Utils.ts
  2. 9 9
      test/utils.spec.ts

+ 2 - 2
src/Utils.ts

@@ -53,7 +53,7 @@ export class Utils {
      * @param dec
      * @param dec
      * @returns {string}
      * @returns {string}
      */
      */
-    public static decToHex(dec: number): string {
+    public static decToHex (dec: number): string {
         const decToHexSliceValue: number = -6,
         const decToHexSliceValue: number = -6,
             exponent: number = 6,
             exponent: number = 6,
             radix: number = 16;
             radix: number = 16;
@@ -69,7 +69,7 @@ export class Utils {
      * @param max
      * @param max
      * @returns {number}
      * @returns {number}
      */
      */
-    public static getRandomInteger(min: number, max: number): number {
+    public static getRandomInteger (min: number, max: number): number {
         return Math.round(Math.floor(Math.random() * (max - min + 1)) + min);
         return Math.round(Math.floor(Math.random() * (max - min + 1)) + min);
     }
     }
 
 

+ 9 - 9
test/utils.spec.ts

@@ -5,7 +5,7 @@ import { JSFuck } from '../src/enums/JSFuck';
 let assert: any = require('chai').assert;
 let assert: any = require('chai').assert;
 
 
 describe('Utils', () => {
 describe('Utils', () => {
-    describe('arrayContains ()', () => {
+    describe('arrayContains (array: any[], searchElement: any): boolean', () => {
         it('should return boolean depends on condition if array is contains given value or not', () => {
         it('should return boolean depends on condition if array is contains given value or not', () => {
             assert.equal(Utils.arrayContains(['1', '2', '3'], '2'), true);
             assert.equal(Utils.arrayContains(['1', '2', '3'], '2'), true);
             assert.equal(Utils.arrayContains([1, 2, 3], 2), true);
             assert.equal(Utils.arrayContains([1, 2, 3], 2), true);
@@ -13,7 +13,7 @@ describe('Utils', () => {
         });
         });
     });
     });
 
 
-    describe('arrayRotate ()', () => {
+    describe('arrayRotate <T> (array: T[], times: number, reverse: boolean = false): T[]', () => {
         let array: number[];
         let array: number[];
 
 
         beforeEach(() => {
         beforeEach(() => {
@@ -29,13 +29,13 @@ describe('Utils', () => {
         });
         });
     });
     });
 
 
-    describe('btoa ()', () => {
+    describe('btoa (string: string): string', () => {
         it('should creates a base-64 encoded string from a given string', () => {
         it('should creates a base-64 encoded string from a given string', () => {
             assert.equal(Utils.btoa('string'), 'c3RyaW5n');
             assert.equal(Utils.btoa('string'), 'c3RyaW5n');
         });
         });
     });
     });
 
 
-    describe('decToHex ()', () => {
+    describe('decToHex (dec: number): string', () => {
         it('should creates a string with hexadecimal value from a given decimal number', () => {
         it('should creates a string with hexadecimal value from a given decimal number', () => {
             assert.equal(Utils.decToHex(0), '0');
             assert.equal(Utils.decToHex(0), '0');
             assert.equal(Utils.decToHex(10), 'a');
             assert.equal(Utils.decToHex(10), 'a');
@@ -43,7 +43,7 @@ describe('Utils', () => {
         });
         });
     });
     });
 
 
-    describe('getRandomInteger ()', () => {
+    describe('getRandomInteger (min: number, max: number): number', () => {
         let values: number[] = [],
         let values: number[] = [],
             randomValue: number;
             randomValue: number;
 
 
@@ -67,14 +67,14 @@ describe('Utils', () => {
         });
         });
     });
     });
 
 
-    describe('getRandomVariableName ()', () => {
+    describe('getRandomVariableName (length: number = 6): string', () => {
         it('should return a string of given length with random variable name', () => {
         it('should return a string of given length with random variable name', () => {
             assert.match(Utils.getRandomVariableName(4), /^_0x(\w){4}$/);
             assert.match(Utils.getRandomVariableName(4), /^_0x(\w){4}$/);
             assert.match(Utils.getRandomVariableName(6), /^_0x(\w){6}$/);
             assert.match(Utils.getRandomVariableName(6), /^_0x(\w){6}$/);
         });
         });
     });
     });
 
 
-    describe('isInteger ()', () => {
+    describe('isInteger (number: number): boolean', () => {
         it('should return true if given number or string is integer', () => {
         it('should return true if given number or string is integer', () => {
             assert.equal(Utils.isInteger(4), true);
             assert.equal(Utils.isInteger(4), true);
             assert.equal(Utils.isInteger(<any>'4'), true);
             assert.equal(Utils.isInteger(<any>'4'), true);
@@ -82,7 +82,7 @@ describe('Utils', () => {
         });
         });
     });
     });
 
 
-    describe('stringToJSFuck ()', () => {
+    describe('stringToJSFuck (string: string): string', () => {
         let expected: string = `${JSFuck.s} + ${JSFuck.t} + ${JSFuck.r} + ${JSFuck.i} + ${JSFuck.n} + ${JSFuck.g}`;
         let expected: string = `${JSFuck.s} + ${JSFuck.t} + ${JSFuck.r} + ${JSFuck.i} + ${JSFuck.n} + ${JSFuck.g}`;
 
 
         it('should creates a JSFuck encoded string from a given string', () => {
         it('should creates a JSFuck encoded string from a given string', () => {
@@ -90,7 +90,7 @@ describe('Utils', () => {
         });
         });
     });
     });
 
 
-    describe('stringToUnicode ()', () => {
+    describe('stringToUnicode (string: string): string', () => {
         let expected: string = `'\\x73\\x74\\x72\\x69\\x6e\\x67'`;
         let expected: string = `'\\x73\\x74\\x72\\x69\\x6e\\x67'`;
 
 
         it('should return a unicode encoded string from a given string', () => {
         it('should return a unicode encoded string from a given string', () => {