summaryrefslogtreecommitdiffstats
path: root/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.spec.ts')
-rw-r--r--src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.spec.ts40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.spec.ts b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.spec.ts
index da422c3..8ad635b 100644
--- a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.spec.ts
+++ b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.spec.ts
@@ -17,7 +17,6 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
*/
@@ -218,6 +217,7 @@ describe('GoldenConfigurationComponent', () => {
component.userId = "sj108s";
component.apiToken = "87264736473";
+ mappingEditorService.identifier = "id1";
component.prepareAppData();
var paramData = { "input": ({ "design-request": ({ "request-id": '87264736473', "action": 'uploadArtifact', "payload": '{"userID":"sj108s","vnf-type":"testVnf","action":"Configure","artifact-name":"param_Configure_testVnf_0.0.1V.json","artifact-type":"APPC-CONFIG","artifact-version":"0.0.1","artifact-contents":"[{\"sync_auto-pop_name1\":\"10.0.1.34\",\"sync_auto-pop_address1\":\"\",\"node0_tacplus_server_name2\":\"192.34.45.5\"}]"}' }) }) };
var templateData = { input: ({ "design-request": ({ "request-id": '87264736473', "action": 'uploadArtifact', "payload": '{"userID":"sj108s","vnf-type":"testVnf","action":"Configure","artifact-name":"template_Configure_test_0.0.1V.json","artifact-type":"APPC-CONFIG","artifact-version":"0.0.1","artifact-contents":"<configuration xmlns=\"http://xml.juniper.net/xnm/1.1/xnm\" \n xmlns:a=\"http://xml.juniper.net/junos/15.1X49/junos\" >\n<version>15.1X49-D50.3</version>\n <groups>\n <name>node0</name>\n <system>\n <tacplus-server>\n <name>${sync_auto-pop_name1}</name>\n <source-address>${sync_auto-pop_address1}</source-address>\n </tacplus-server>\n <tacplus-server>\n <name>${node0_tacplus_server_name2}</name>\n <source-address>${sync_auto-pop_address1}</source-address>\n </tacplus-server>\n </system> \n </groups>\n </configuration>"}' }) }) };
@@ -375,54 +375,54 @@ describe('GoldenConfigurationComponent', () => {
// fileChange method
it('Should validatte fileChange method if file type is xml', async(() => {
let reader = new FileReader();
- let file = new File(["testing"], "foo.xml", {type: "text/xml"});
- let input = {files: [file]};
+ let file = new File(["testing"], "foo.xml", { type: "text/xml" });
+ let input = { files: [file] };
component.refObj = true;
component.fileChange(input);
- component.readFile(input.files[0], reader,(res) => {
+ component.readFile(input.files[0], reader, (res) => {
expect(component.selectedUploadType).toEqual('Generated Template');
expect(component.configMappingEditorContent).toEqual(res);
expect(component.artifactRequest.templateContent).toEqual(res);
- });
+ });
}));
it('Should validatte fileChange method if file type is json', async(() => {
let reader = new FileReader();
- let file = new File(["testing"], "foo.json", {type: "text/json"});
- let input = {files: [file]};
+ let file = new File(["testing"], "foo.json", { type: "text/json" });
+ let input = { files: [file] };
component.refObj = true;
component.fileChange(input);
- component.readFile(input.files[0], reader,(res) => {
+ component.readFile(input.files[0], reader, (res) => {
expect(component.selectedUploadType).toEqual('Generated Template');
expect(component.configMappingEditorContent).toEqual(res);
expect(component.artifactRequest.templateContent).toEqual(res);
- });
+ });
}));
it('Should validatte fileChange method if file type is none ', async(() => {
let reader = new FileReader();
- let file = new File(["testing"], "foo", {type: ""});
- let input = {files: [file]};
+ let file = new File(["testing"], "foo", { type: "" });
+ let input = { files: [file] };
component.refObj = true;
component.fileChange(input);
- component.readFile(input.files[0], reader,(res) => {
+ component.readFile(input.files[0], reader, (res) => {
expect(typeof sessionStorage.getItem('fileType')).toEqual('string')
expect(component.selectedUploadType).toEqual('Generated Template');
expect(component.configMappingEditorContent).toEqual(res);
expect(component.artifactRequest.templateContent).toEqual(res);
- });
+ });
}));
it('Should validate if files is false', () => {
let spy = spyOn(NotificationsService.prototype, 'error');
let reader = new FileReader();
- let input = {files: []};
+ let input = { files: [] };
component.refObj = true;
component.fileChange(input);
@@ -433,7 +433,7 @@ describe('GoldenConfigurationComponent', () => {
it('Should validate if refObj is undefined', () => {
let spy = spyOn(NotificationsService.prototype, 'error');
let reader = new FileReader();
- let input = {files: []};
+ let input = { files: [] };
component.refObj = undefined;
component.fileChange(input);
@@ -443,4 +443,14 @@ describe('GoldenConfigurationComponent', () => {
// End fileChange method
+ it('should give the correct template artifact name when multiple template identifiers are provided from reference page', inject([MappingEditorService], (mappingEditorService: MappingEditorService) => {
+ fixture = TestBed.createComponent(GoldenConfigurationComponent);
+ component = fixture.componentInstance;
+ mappingEditorService.identifier = "id1";
+ mappingEditorService.latestAction = { "action": "ConfigScaleOut", "action-level": "vnf", "scope": { "vnf-type": "test", "vnfc-type": "" }, "template": "Y", "vm": [], "device-protocol": "CHEF", "user-name": "", "port-number": "", "artifact-list": [{ "artifact-name": "template_ConfigScaleOut_test_0.0.1V_id1.json", "artifact-type": "config_template" }, { "artifact-name": "pd_ConfigScaleOut_test_0.0.1V_id1.yaml", "artifact-type": "parameter_definitions" }, { "artifact-name": "template_ConfigScaleOut_test_0.0.1V_id2.json", "artifact-type": "config_template" }, { "artifact-name": "pd_ConfigScaleOut_test_0.0.1V_id2.yaml", "artifact-type": "parameter_definitions" }], "template-id-list": ["id1", "id2"], "scopeType": "vnf-type" };
+ component.ngAfterViewInit();
+ expect(component.artifactName).toBe("template_ConfigScaleOut_test_0.0.1V_id1.json");
+ }));
+
+
});