From f6f255ebcc14db9edde1b3440c9c5c86158da5a5 Mon Sep 17 00:00:00 2001 From: George Batalinski Date: Mon, 22 Mar 2021 10:28:08 -0400 Subject: [PATCH 1/2] (testing) add service test template --- snippets/typescript.json | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/snippets/typescript.json b/snippets/typescript.json index 5ab968d..0df5d6b 100644 --- a/snippets/typescript.json +++ b/snippets/typescript.json @@ -605,5 +605,21 @@ "prefix": "a-trackby", "description": "TrackBy Function", "body": ["${1:trackBy}(index: number, ${2:name}: ${3:model}): ${4:number} {", " return ${2:name}${5:.id};$0", "}"] - } + }, + "Test-bed setup": { + "prefix": "a-test-service", + "body": [ + "import { TestBed } from \"@angular/core/testing\";", + "describe(\"Service\", () => {", + "beforeEach(() => {", + "TestBed.configureTestingModule({", + "providers: [", + "]});", + "});", + "it('should have my first test', ()=> {", + "});", + "});" + ], + "description": "Service Testbed setup" + } } From 60643836c162ec6698febdf28e640ff125f852dd Mon Sep 17 00:00:00 2001 From: George Batalinski Date: Mon, 22 Mar 2021 10:33:26 -0400 Subject: [PATCH 2/2] (testing) add spacing and servicename var --- snippets/typescript.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/snippets/typescript.json b/snippets/typescript.json index 0df5d6b..e404fa7 100644 --- a/snippets/typescript.json +++ b/snippets/typescript.json @@ -610,14 +610,17 @@ "prefix": "a-test-service", "body": [ "import { TestBed } from \"@angular/core/testing\";", - "describe(\"Service\", () => {", + "describe(\"${2:ServiceName}\", () => {", "beforeEach(() => {", "TestBed.configureTestingModule({", "providers: [", + "\t$0", "]});", "});", "it('should have my first test', ()=> {", + "\t$0", "});", + "\t$0", "});" ], "description": "Service Testbed setup"