From 1f1008d0d2dfd278c336cc4f6ada6c17737ea110 Mon Sep 17 00:00:00 2001 From: Vitaly Tomilov Date: Sun, 15 Jul 2018 18:04:05 +0100 Subject: [PATCH] improving TS tests --- test/main.js | 6 +++++- test/main.ts | 22 +++++++++++++--------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/test/main.js b/test/main.js index 87a3431..7df0299 100644 --- a/test/main.js +++ b/test/main.js @@ -17,7 +17,11 @@ a.params = { second: 'hello!' }; var cs = a.build(); -a.setDefaults({}); +a.setDefaults({ + hosts: [ + { name: '[::]', port: 123, isIPv6: true } + ] +}); a.setDefaults({ user: '', password: '' diff --git a/test/main.ts b/test/main.ts index 177fde4..2165c8b 100644 --- a/test/main.ts +++ b/test/main.ts @@ -1,17 +1,17 @@ import {ConnectionString} from '../src' -var a = new ConnectionString('protocol://'); -var b = new ConnectionString('protocol://', {}); -var c = new ConnectionString('protocol://', { +const a = new ConnectionString('protocol://'); +const b = new ConnectionString('protocol://', {}); +const c = new ConnectionString('protocol://', { segments: ['one', 'two'] }); if ('protocol' in a) { - var protocol = a.protocol; + const protocol = a.protocol; } -var segment1: string = a.segments[0]; -var param1: string = a.params['first']; +const segment1: string = a.segments[0]; +const param1: string = a.params['first']; a.params['first'] = 'hello'; @@ -20,8 +20,12 @@ a.params = { second: 'hello!' }; -var cs = a.build(); -a.setDefaults({}); +let cs = a.build(); +a.setDefaults({ + hosts: [ + {name: '[::]', port: 123, isIPv6: true} + ] +}); a.setDefaults({ user: '', @@ -30,4 +34,4 @@ a.setDefaults({ cs = a.build(); -var qq: ConnectionString = a.setDefaults(new ConnectionString('')); +const qq: ConnectionString = a.setDefaults(new ConnectionString(''));