11import * as assert from "assert" ;
22import * as fs from "fs" ;
33import * as mocha from "mocha" ;
4+ import * as uuid from "uuid" ;
5+ import { isUUID } from "validator" ;
46import * as manifestInfo from "../src/manifestInfo" ;
5- const uuid = require ( 'uuid' ) ;
6- const validator = require ( "validator" ) ;
77const manifestOriginalFolder = process . cwd ( ) + "/test/manifests" ;
88const manifestTestFolder = process . cwd ( ) + "\\testExecution\\testManifests" ;
99const testManifest = manifestTestFolder + "\\manifest.xml" ;
@@ -70,9 +70,9 @@ describe("Manifest", function() {
7070 const updatedInfo = await manifestInfo . modifyManifestFile ( testManifest , "random" , undefined ) ;
7171
7272 // verify guid updated, that it"s a valid guid and that the displayName is not updated
73- assert . notStrictEqual ( originalInfo . id , updatedInfo . id ) ;
74- assert . equal ( true , validator . isUUID ( updatedInfo . id ) ) ;
75- assert . strictEqual ( originalInfo . displayName , updatedInfo . displayName ) ;
73+ assert . notStrictEqual ( updatedInfo . id , originalInfo . id ) ;
74+ assert . strictEqual ( updatedInfo . id && isUUID ( updatedInfo . id ) , true ) ;
75+ assert . strictEqual ( updatedInfo . displayName , originalInfo . displayName ) ;
7676 } ) ;
7777 it ( "should handle specifying displayName only" , async function ( ) {
7878 // get original manifest info and create copy of manifest that we can overwrite in this test
@@ -83,18 +83,18 @@ describe("Manifest", function() {
8383 const updatedInfo = await manifestInfo . modifyManifestFile ( testManifest , undefined , testDisplayName ) ;
8484
8585 // verify displayName updated and guid not updated
86- assert . notStrictEqual ( originalInfo . displayName , updatedInfo . displayName ) ;
86+ assert . notStrictEqual ( updatedInfo . displayName , originalInfo . displayName ) ;
8787 assert . strictEqual ( updatedInfo . displayName , testDisplayName ) ;
88- assert . strictEqual ( originalInfo . id , updatedInfo . id ) ;
88+ assert . strictEqual ( updatedInfo . id , originalInfo . id ) ;
8989 } ) ;
9090 it ( "should handle not specifying either a guid or displayName" , async function ( ) {
9191 let result ;
9292 try {
93- await manifestInfo . modifyManifestFile ( testManifest , undefined , undefined ) ;
93+ await manifestInfo . modifyManifestFile ( testManifest ) ;
9494 } catch ( err ) {
95- result = err ;
95+ result = err . message ;
9696 }
97- assert . equal ( result , "Error: You need to specify something to change in the manifest." ) ;
97+ assert . strictEqual ( result , ` You need to specify something to change in the manifest.` ) ;
9898 } ) ;
9999 it ( "should handle an invalid manifest file path" , async function ( ) {
100100 // call modify, specifying an invalid manifest path with a valid guid and displayName
@@ -108,7 +108,7 @@ describe("Manifest", function() {
108108 result = err . message ;
109109 }
110110
111- assert . equal ( result , `Unable to modify xml data for manifest file: ${ invalidManifest } . \nError: ENOENT: no such file or directory, open '${ invalidManifest } '` ) ;
111+ assert . strictEqual ( result , `Unable to modify xml data for manifest file: ${ invalidManifest } . \nError: ENOENT: no such file or directory, open '${ invalidManifest } '` ) ;
112112 } ) ;
113113 } ) ;
114114} ) ;
0 commit comments