diff --git a/.vscode/launch.json b/.vscode/launch.json index c58579c..065910d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,11 +13,10 @@ "create", "-s", ".", - "-v", "-x", "*", "*/", - "!test" + "!test/fixtures" ], "preLaunchTask": "npm: build - dev", "stopOnEntry": false, diff --git a/README.md b/README.md index d7754b6..ee40874 100644 --- a/README.md +++ b/README.md @@ -56,11 +56,12 @@ Contents: The file names (and their data contents) and subdirectories names (wit **Hashes are the same when:** -- Directory names and contents are the same +- Directory names and contents are the same `(strict: true)` +- Only root directory names are different and subdirectory names and all contents are the same `(strict: false)` **Hashes are different when:** -- Directory names are different and contents are the same +- Directory names are different and contents are the same `(strict: true)` - Directory contents are different and names are the same ## Usage diff --git a/docs/api.md b/docs/api.md index 61c221e..ba99e11 100644 --- a/docs/api.md +++ b/docs/api.md @@ -233,7 +233,8 @@ All `API` calls are `static` members of the `Integrity` class. |Name|Type|Attribute|Default|Description| |:---:|:---:|:---:|:---:|:---:| |cryptoOptions|ICryptoOptions|optional|see `ICryptoOptions` |the `crypto` options to use| -|verbose|boolean|optional|true|whether the computed hashes are returned in a verbosely or non-verbosely structure| +|strict|boolean|optional|false|whether the computed hashes are strictly using the directory name| +|verbose|boolean|optional|false|whether the computed hashes are returned in a verbosely or non-verbosely structure| |exclude|string[]|optional|[]|the paths to be excluded, supports also `glob` expressions (positive & negative)| ### ICryptoOptions diff --git a/src/app/integrity.ts b/src/app/integrity.ts index 829e95f..22183ab 100644 --- a/src/app/integrity.ts +++ b/src/app/integrity.ts @@ -31,13 +31,15 @@ export class Integrity { } const exclude = options ? options.exclude : undefined; const verbose = options ? options.verbose : undefined; + const strict = options ? options.strict : undefined; if (!options || !options.cryptoOptions || !options.cryptoOptions.fileAlgorithm || !options.cryptoOptions.dirAlgorithm || !options.cryptoOptions.encoding ) { - options = await this._detectOptions(fileOrDirPath, integrity); + options = await this._detectOptions(fileOrDirPath, integrity, strict); options.exclude = exclude; + options.strict = strict || options.strict; options.verbose = verbose || options.verbose; } const _intObj = await Integrity.create(fileOrDirPath, options); @@ -55,7 +57,7 @@ export class Integrity { // 'integrity' is a hash if (!_integrityObj) { const _ls = await pfs.lstatAsync(fileOrDirPath); - const _basename = _ls.isFile() ? path.basename(fileOrDirPath) : '.'; + const _basename = _ls.isFile() || options.strict ? path.basename(fileOrDirPath) : '.'; _integrityObj = { hashes: { [_basename]: integrity, @@ -93,7 +95,8 @@ export class Integrity { ? await this._computeHashVerbosely(_options, dirPath) : await this._computeHash(_options, dirPath); const _hasHashes = typeof _hashes === 'string' ? !!_hashes : !!_hashes.hash; - return _hasHashes ? { ['.']: _hashes } : {}; + const _dirName = options && options.strict ? path.basename(dirPath) : '.'; + return _hasHashes ? { [_dirName]: _hashes } : {}; } public static async createFileHash(filePath: string, options?: ICryptoOptions): Promise { @@ -193,11 +196,15 @@ export class Integrity { } /** @internal */ - private static async _detectOptions(inPath: string, integrity: string): Promise { + private static async _detectOptions( + inPath: string, + integrity: string, + strict: boolean | undefined, + ): Promise { const _ls = await pfs.lstatAsync(inPath); - const _basename = _ls.isFile() ? path.basename(inPath) : '.'; // get the integrity object let _integrityObj: IntegrityObject; + const _basename = _ls.isFile() || strict ? path.basename(inPath) : '.'; // 'integrity' is a file or directory path if (await pfs.existsAsync(integrity)) { integrity = await this._pathCheck(integrity); @@ -225,6 +232,8 @@ export class Integrity { if (!_first) { return _options; } + // detect strict + _options.strict = _basename !== '.'; // detect verbosity _options.verbose = typeof _first !== 'string'; // detect options @@ -348,10 +357,14 @@ export class Integrity { const _verbose = options && options.verbose !== undefined ? options.verbose : false; + const _strict = options && options.strict !== undefined + ? options.strict + : false; return { cryptoOptions: _cryptoOptions, exclude, include, + strict: _strict, verbose: _verbose, }; } @@ -391,8 +404,8 @@ export class Integrity { if (!sourceDirPath || !integrityDirPath) { return false; } - const _getNodeOrDefault = (_obj: IHashObject, l: string): string | IVerboseHashObject => - _obj[l] || _obj[Object.keys(_obj)[0]] || ''; + const _getNodeOrDefault = (_obj: IHashObject, el: string): string | IVerboseHashObject => + _obj[el] || _obj[Object.keys(_obj)[0]] || ''; const _findHash = (_array: string[], _hashObj: IHashObject): boolean => { if (_array.length === 1) { const _integrityHash: string | IVerboseHashObject = _getNodeOrDefault(_hashObj, _array[0]); @@ -494,7 +507,8 @@ export class Integrity { return; } _hash = _hash || createHash(dirAlgorithm); - _hash.update(path.basename(_dirPath)); + const _dirName = options.strict || this._rootDirPath !== _dirPath ? path.basename(_dirPath) : '.'; + _hash.update(_dirName); const _files = await pfs.readdirAsync(_dirPath); for (const file of _files) { await _callback(file); diff --git a/src/cli/index.ts b/src/cli/index.ts index 33436bc..332af31 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -29,6 +29,7 @@ export = (async (): Promise => { fileAlgorithm: pargs.fileAlgorithm, }, exclude: exclusions, + strict: pargs.strict, verbose: pargs.verbose, }; command = pargs.command; diff --git a/src/common/yargsParser.ts b/src/common/yargsParser.ts index 922bd93..6783ad7 100644 --- a/src/common/yargsParser.ts +++ b/src/common/yargsParser.ts @@ -44,6 +44,12 @@ export class YargsParser { description: 'The path to the file or directory to hash', type: 'string', }, + strict: { + alias: 'st', + default: false, + description: 'Use directory name in root hash', + type: 'boolean', + }, verbose: { alias: 'v', default: false, @@ -124,6 +130,7 @@ export class YargsParser { manifest: _pargs.manifest as boolean, outPath: _pargs.output as string, pretty: _pargs.pretty as boolean, + strict: _pargs.strict as boolean, verbose: _pargs.verbose as boolean, }; } diff --git a/src/interfaces/integrityOptions.ts b/src/interfaces/integrityOptions.ts index 6a14b08..5a9a3a1 100644 --- a/src/interfaces/integrityOptions.ts +++ b/src/interfaces/integrityOptions.ts @@ -3,5 +3,6 @@ import { ICryptoOptions } from './cryptoOptions'; export interface IntegrityOptions { cryptoOptions?: ICryptoOptions; verbose?: boolean; + strict?: boolean; exclude?: string[]; } diff --git a/src/interfaces/normalizedIntegrityOptions.ts b/src/interfaces/normalizedIntegrityOptions.ts index 96a4d9d..2f592bf 100644 --- a/src/interfaces/normalizedIntegrityOptions.ts +++ b/src/interfaces/normalizedIntegrityOptions.ts @@ -4,6 +4,7 @@ import { ICryptoOptions } from './cryptoOptions'; export interface INormalizedIntegrityOptions { cryptoOptions: ICryptoOptions; verbose: boolean; + strict: boolean; exclude: string[]; include: string[]; } diff --git a/src/interfaces/parsedArgs.ts b/src/interfaces/parsedArgs.ts index 1608a0e..a2b0729 100644 --- a/src/interfaces/parsedArgs.ts +++ b/src/interfaces/parsedArgs.ts @@ -10,5 +10,6 @@ export interface IParsedArgs { manifest: boolean; outPath: string; pretty: boolean; + strict: boolean; verbose: boolean; } diff --git a/test/api/behavior.test.ts b/test/api/behavior.test.ts index bf2c11f..9e36535 100644 --- a/test/api/behavior.test.ts +++ b/test/api/behavior.test.ts @@ -49,6 +49,15 @@ describe('Integrity: behavior tests', function (): void { expect(sut).to.be.a('boolean').and.to.be.true; }); + it('directories have the same content but different names', + async function (): Promise { + const sutDirPath = path.resolve(fixturesDirPath, './directory.1'); + const hash = await Integrity.create(sutDirPath, { strict: false }); + const sut = await Integrity.check(directoryDirPath, JSON.stringify(hash)); + expect(hash.hashes).to.haveOwnProperty('.'); + expect(sut).to.be.a('boolean').and.to.be.true; + }); + }); context('to fail integrity check when', function (): void { @@ -80,12 +89,12 @@ describe('Integrity: behavior tests', function (): void { expect(sut).to.be.a('boolean').and.to.be.false; }); - it('directories have the same content but different names', + it(`directories have the same content but different names in 'strict' mode`, async function (): Promise { const sutDirPath = path.resolve(fixturesDirPath, './directory.1'); - const hash = await Integrity.create(sutDirPath); + const hash = await Integrity.create(sutDirPath, { strict: true }); const sut = await Integrity.check(directoryDirPath, JSON.stringify(hash)); - expect(hash.hashes).to.haveOwnProperty('.'); + expect(hash.hashes).to.haveOwnProperty('directory.1'); expect(sut).to.be.a('boolean').and.to.be.false; }); diff --git a/test/api/check.test.ts b/test/api/check.test.ts index 8041b21..95d9c9f 100644 --- a/test/api/check.test.ts +++ b/test/api/check.test.ts @@ -40,6 +40,7 @@ describe(`Integrity: function 'check' tests`, function (): void { options = { cryptoOptions: undefined, exclude: undefined, + strict: true, verbose: undefined, }; }); @@ -541,7 +542,7 @@ describe(`Integrity: function 'check' tests`, function (): void { it('provided a file path', async function (): Promise { - const sut = await Integrity.check(fixturesDirPath, integrityTestFilePath); + const sut = await Integrity.check(fixturesDirPath, integrityTestFilePath, options); expect(sut).to.be.a('boolean').and.to.be.true; }); @@ -554,14 +555,14 @@ describe(`Integrity: function 'check' tests`, function (): void { it('provided a directory path', async function (): Promise { - const sut = await Integrity.check(fixturesDirPath, fixturesDirPath); + const sut = await Integrity.check(fixturesDirPath, fixturesDirPath, options); expect(sut).to.be.a('boolean').and.to.be.true; }); it('provided a non-verbosely hash object (JSON)', async function (): Promise { options.verbose = false; - const hashObj = '{"version":"1","hashes":{".":"sha512-' + + const hashObj = '{"version":"1","hashes":{"fixtures":"sha512-' + 'WlFP+kAPdHyGd9E8SgkFfxuGvz9l/cqjt8gAhrHDdWLBIkkZGxgxxgpWZuARLVD7ACCxq8rVeNbwNL7NKyeWsA=="}}'; const sut = await Integrity.check(fixturesDirPath, hashObj, options); expect(sut).to.be.a('boolean').and.to.be.true; @@ -616,7 +617,7 @@ describe(`Integrity: function 'check' tests`, function (): void { it('provided a file path', async function (): Promise { - const sut = await Integrity.check(fixturesSubDirPath, integrityTestFilePath); + const sut = await Integrity.check(fixturesSubDirPath, integrityTestFilePath, options); expect(sut).to.be.a('boolean').and.to.be.true; }); @@ -624,20 +625,20 @@ describe(`Integrity: function 'check' tests`, function (): void { async function (): Promise { const directorySubDirPath = path.join(fixturesSubDirPath, 'directory'); integrityTestFilePath = path.resolve(directorySubDirPath, integrityTestFilename); - const sut = await Integrity.check(directorySubDirPath, integrityTestFilePath); + const sut = await Integrity.check(directorySubDirPath, integrityTestFilePath, options); expect(sut).to.be.a('boolean').and.to.be.true; }); it('provided a directory path', async function (): Promise { - const sut = await Integrity.check(fixturesSubDirPath, fixturesSubDirPath); + const sut = await Integrity.check(fixturesSubDirPath, fixturesSubDirPath, options); expect(sut).to.be.a('boolean').and.to.be.true; }); it('provided a non-verbosely hash object (JSON)', async function (): Promise { options.verbose = false; - const hashObj = '{"version":"1","hashes":{".":"sha512-' + + const hashObj = '{"version":"1","hashes":{"fixtures":"sha512-' + 'rDNKFYBCOuaCzpomiZEGyRLAmc3+IU/HoNj7NiKXqLG90rNko74LwpZ1DYKx+/aJptGTKCr/9mP8ggnl4QVNNw=="}}'; const sut = await Integrity.check(fixturesSubDirPath, hashObj, options); expect(sut).to.be.a('boolean').and.to.be.true; @@ -691,7 +692,7 @@ describe(`Integrity: function 'check' tests`, function (): void { it('provided a file path', async function (): Promise { - const sut = await Integrity.check(fixturesSubDirPath, integrityTestFilePath); + const sut = await Integrity.check(fixturesSubDirPath, integrityTestFilePath, options); expect(sut).to.be.a('boolean').and.to.be.true; }); @@ -706,14 +707,14 @@ describe(`Integrity: function 'check' tests`, function (): void { it('provided a directory path', async function (): Promise { - const sut = await Integrity.check(fixturesSubDirPath, fixturesDirPath); + const sut = await Integrity.check(fixturesSubDirPath, fixturesDirPath, options); expect(sut).to.be.a('boolean').and.to.be.true; }); it('provided a non-verbosely hash object (JSON)', async function (): Promise { options.verbose = false; - const hashObj = '{"version":"1","hashes":{".":"sha512-' + + const hashObj = '{"version":"1","hashes":{"fixtures":"sha512-' + 'rDNKFYBCOuaCzpomiZEGyRLAmc3+IU/HoNj7NiKXqLG90rNko74LwpZ1DYKx+/aJptGTKCr/9mP8ggnl4QVNNw=="}}'; const sut = await Integrity.check(fixturesSubDirPath, hashObj, options); expect(sut).to.be.a('boolean').and.to.be.true; @@ -777,7 +778,7 @@ describe(`Integrity: function 'check' tests`, function (): void { it('the options when NOT provided', async function (): Promise { - const sut = await Integrity.check(fixturesDirPath, integrityTestFilePath); + const sut = await Integrity.check(fixturesDirPath, integrityTestFilePath, options); expect(sut).to.be.a('boolean').and.to.be.true; }); @@ -994,57 +995,57 @@ describe(`Integrity: function 'check' tests`, function (): void { it('non-verbose creation', async function (): Promise { - const hashObj = '{"version":"1","hashes":{".":"sha512-' + + const hashObj = '{"version":"1","hashes":{"fixtures":"sha512-' + 'WlFP+kAPdHyGd9E8SgkFfxuGvz9l/cqjt8gAhrHDdWLBIkkZGxgxxgpWZuARLVD7ACCxq8rVeNbwNL7NKyeWsA=="}}'; - const sut = await Integrity.check(fixturesDirPath, hashObj); + const sut = await Integrity.check(fixturesDirPath, hashObj, options); expect(sut).to.be.a('boolean').and.to.be.true; }); it('verbose creation', async function (): Promise { - const sut = await Integrity.check(fixturesDirPath, integrityTestFilePath); + const sut = await Integrity.check(fixturesDirPath, integrityTestFilePath, options); expect(sut).to.be.a('boolean').and.to.be.true; }); it(`'md5' algorithm`, async function (): Promise { - const hashObj = '{"version":"1","hashes":{".":"md5-03a3d76b2c52d62ce63502b85100575f"}}'; - const sut = await Integrity.check(fixturesDirPath, hashObj); + const hashObj = '{"version":"1","hashes":{"fixtures":"md5-03a3d76b2c52d62ce63502b85100575f"}}'; + const sut = await Integrity.check(fixturesDirPath, hashObj, options); expect(sut).to.be.a('boolean').and.to.be.true; }); it(`'RSA-SHA1-2' algorithm`, async function (): Promise { - const hashObj = '{"version":"1","hashes":{".":"RSA-SHA1-2-DIjHOBHMnvpJxM4onkxvXbmcdME="}}'; - const sut = await Integrity.check(fixturesDirPath, hashObj); + const hashObj = '{"version":"1","hashes":{"fixtures":"RSA-SHA1-2-DIjHOBHMnvpJxM4onkxvXbmcdME="}}'; + const sut = await Integrity.check(fixturesDirPath, hashObj, options); expect(sut).to.be.a('boolean').and.to.be.true; }); it(`'sha1' algorithm`, async function (): Promise { - const hashObj = '{"version":"1","hashes":{".":"sha1-0c88c73811cc9efa49c4ce289e4c6f5db99c74c1"}}'; - const sut = await Integrity.check(fixturesDirPath, hashObj); + const hashObj = '{"version":"1","hashes":{"fixtures":"sha1-0c88c73811cc9efa49c4ce289e4c6f5db99c74c1"}}'; + const sut = await Integrity.check(fixturesDirPath, hashObj, options); expect(sut).to.be.a('boolean').and.to.be.true; }); it(`'hex' encoding`, async function (): Promise { - const hashObj = '{"version":"1","hashes":{".":"sha1-0c88c73811cc9efa49c4ce289e4c6f5db99c74c1"}}'; - const sut = await Integrity.check(fixturesDirPath, hashObj); + const hashObj = '{"version":"1","hashes":{"fixtures":"sha1-0c88c73811cc9efa49c4ce289e4c6f5db99c74c1"}}'; + const sut = await Integrity.check(fixturesDirPath, hashObj, options); expect(sut).to.be.a('boolean').and.to.be.true; }); it(`'base64' encoding`, async function (): Promise { - const hashObj = '{"version":"1","hashes":{".":"sha1-DIjHOBHMnvpJxM4onkxvXbmcdME="}}'; - const sut = await Integrity.check(fixturesDirPath, hashObj); + const hashObj = '{"version":"1","hashes":{"fixtures":"sha1-DIjHOBHMnvpJxM4onkxvXbmcdME="}}'; + const sut = await Integrity.check(fixturesDirPath, hashObj, options); expect(sut).to.be.a('boolean').and.to.be.true; }); it(`'latin1' encoding`, async function (): Promise { - const hashObj = '{"version":"1","hashes":{".":"sha1-\\fˆÇ8\\u0011̞úIÄÎ(žLo]¹œtÁ"}}'; - const sut = await Integrity.check(fixturesDirPath, hashObj); + const hashObj = '{"version":"1","hashes":{"fixtures":"sha1-\\fˆÇ8\\u0011̞úIÄÎ(žLo]¹œtÁ"}}'; + const sut = await Integrity.check(fixturesDirPath, hashObj, options); expect(sut).to.be.a('boolean').and.to.be.true; }); @@ -1074,34 +1075,34 @@ describe(`Integrity: function 'check' tests`, function (): void { async function (): Promise { const hash = 'sha512-' + 'WlFP+kAPdHyGd9E8SgkFfxuGvz9l/cqjt8gAhrHDdWLBIkkZGxgxxgpWZuARLVD7ACCxq8rVeNbwNL7NKyeWsA=='; - const sut = await Integrity.check(fixturesDirPath, hash); + const sut = await Integrity.check(fixturesDirPath, hash, {strict: true}); expect(sut).to.be.a('boolean').and.to.be.true; }); it('verbose hash', async function (): Promise { - const sut = await Integrity.check(fixturesDirPath, integrityTestFilePath); + const sut = await Integrity.check(fixturesDirPath, integrityTestFilePath, {strict: true}); expect(sut).to.be.a('boolean').and.to.be.true; }); it(`md5' algorithm`, async function (): Promise { const hash = 'md5-03a3d76b2c52d62ce63502b85100575f'; - const sut = await Integrity.check(fixturesDirPath, hash); + const sut = await Integrity.check(fixturesDirPath, hash, {strict: true}); expect(sut).to.be.a('boolean').and.to.be.true; }); it(`sha1' algorithm`, async function (): Promise { const hashObj = 'sha1-0c88c73811cc9efa49c4ce289e4c6f5db99c74c1'; - const sut = await Integrity.check(fixturesDirPath, hashObj); + const sut = await Integrity.check(fixturesDirPath, hashObj, {strict: true}); expect(sut).to.be.a('boolean').and.to.be.true; }); it(`hex' encoding`, async function (): Promise { const hash = 'sha1-0c88c73811cc9efa49c4ce289e4c6f5db99c74c1'; - const sut = await Integrity.check(fixturesDirPath, hash); + const sut = await Integrity.check(fixturesDirPath, hash, {strict: true}); expect(sut).to.be.a('boolean').and.to.be.true; }); @@ -1109,14 +1110,14 @@ describe(`Integrity: function 'check' tests`, function (): void { async function (): Promise { const hash = 'sha512-' + 'WlFP+kAPdHyGd9E8SgkFfxuGvz9l/cqjt8gAhrHDdWLBIkkZGxgxxgpWZuARLVD7ACCxq8rVeNbwNL7NKyeWsA=='; - const sut = await Integrity.check(fixturesDirPath, hash); + const sut = await Integrity.check(fixturesDirPath, hash, {strict: true}); expect(sut).to.be.a('boolean').and.to.be.true; }); it(`latin1' encoding`, async function (): Promise { const hash = 'sha1-\fˆÇ8\u0011̞úIÄÎ(žLo]¹œtÁ'; - const sut = await Integrity.check(fixturesDirPath, hash); + const sut = await Integrity.check(fixturesDirPath, hash, {strict: true}); expect(sut).to.be.a('boolean').and.to.be.true; }); diff --git a/test/api/createDirHash.test.ts b/test/api/createDirHash.test.ts index 218da6b..96a9a36 100644 --- a/test/api/createDirHash.test.ts +++ b/test/api/createDirHash.test.ts @@ -42,6 +42,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options = { cryptoOptions: undefined, exclude: undefined, + strict: true, verbose: undefined, }; }); @@ -104,7 +105,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'WlFP+kAPdHyGd9E8SgkFfxuGvz9l/cqjt8gAhrHDdWLB' + @@ -118,7 +119,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.hexRegexPattern, '5a514ffa400f747c8677d13c4a09057f1b86bf3f65fdcaa3b7c80086b1c37562' + @@ -132,7 +133,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.latin1RegexPattern, // tslint:disable-next-line:max-line-length @@ -147,7 +148,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'A6PXayxS1izmNQK4UQBXXw==', @@ -160,7 +161,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.hexRegexPattern, '03a3d76b2c52d62ce63502b85100575f', @@ -177,7 +178,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { async function (): Promise { const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.haveOwnProperty(fileToHashFilename) .and.to.satisfy((hash: string) => @@ -189,9 +190,9 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.cryptoOptions = { encoding: 'hex' }; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .to.haveOwnProperty('.') + .to.haveOwnProperty('fixtures') .and.to.haveOwnProperty('contents'); - const fixtures = sut['.'] as IVerboseHashObject; + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.haveOwnProperty(fileToHashFilename) .and.to.satisfy((hash: string) => checker(hash, utils.hexRegexPattern, @@ -204,9 +205,9 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.cryptoOptions = { encoding: 'latin1' }; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .to.haveOwnProperty('.') + .to.haveOwnProperty('fixtures') .and.to.haveOwnProperty('contents'); - const fixtures = sut['.'] as IVerboseHashObject; + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.haveOwnProperty(fileToHashFilename) .and.to.satisfy((hash: string) => checker(hash, utils.latin1RegexPattern, '\u001fŸ&`ØÛ0”äˆÛï5øö`©wrM')); @@ -216,8 +217,9 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { async function (): Promise { options.cryptoOptions = { fileAlgorithm: 'md5' }; const sut = await Integrity.createDirHash(fixturesDirPath, options); - expect(sut).to.be.an('object').and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + expect(sut).to.be.an('object') + .and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures).to.haveOwnProperty('contents'); expect(fixtures.contents).to.haveOwnProperty(fileToHashFilename) .and.to.satisfy((hash: string) => @@ -230,8 +232,9 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { async function (): Promise { options.cryptoOptions = { fileAlgorithm: 'md5', encoding: 'hex' }; const sut = await Integrity.createDirHash(fixturesDirPath, options); - expect(sut).to.be.an('object').and.to.haveOwnProperty('.'); - expect(sut['.']) + expect(sut).to.be.an('object') + .and.to.haveOwnProperty('fixtures'); + expect(sut.fixtures) .to.haveOwnProperty('contents') .and.that.to.haveOwnProperty(fileToHashFilename) .and.to.satisfy((hash: string) => @@ -252,7 +255,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'yTngky0kneOY4JOKvrbfRDk3VNWhDs90Gp7rlNpbQPy0' + @@ -266,7 +269,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'Sh3ed4hhzI8eSodzoJphpTle3D9uimG+srSpn0g8OLqW' + @@ -280,7 +283,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'Wk6BW5uO0UZfXTgY7wLqoY9bNzA+PyyE9j6n63QpXu9J' + @@ -294,7 +297,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'D5JDvAmGPhnjGqzANq7d1PyuAcamcOUeZnTW8ziOQ8YI' + @@ -308,7 +311,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'VegLTUIJV6ET06h8wMXtf+VF2BDVEHd8n2NngoubqzhR' + @@ -330,7 +333,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'VegLTUIJV6ET06h8wMXtf+VF2BDVEHd8n2NngoubqzhR' + @@ -344,7 +347,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'YO+lMzZetbscCuJcmQ+Gvawbkm2qb4AXPxYXge62cSZB' + @@ -390,7 +393,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'l+RFq7YS2sKbzyhXAzmpiKF3YdDLkORqI3YQiFZzcPN8' + @@ -404,7 +407,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'l+RFq7YS2sKbzyhXAzmpiKF3YdDLkORqI3YQiFZzcPN8' + @@ -418,7 +421,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'l+RFq7YS2sKbzyhXAzmpiKF3YdDLkORqI3YQiFZzcPN8' + @@ -432,7 +435,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'l+RFq7YS2sKbzyhXAzmpiKF3YdDLkORqI3YQiFZzcPN8' + @@ -446,7 +449,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'l+RFq7YS2sKbzyhXAzmpiKF3YdDLkORqI3YQiFZzcPN8' + @@ -460,7 +463,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'dI656yTlMZ7dYYmsYo4m6P+xxPsNHhMHANEupJhy61i6' + @@ -474,7 +477,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'Mxema7+o7uDni/0O3OCjsr+CeG05csSon2FK8yYVJkaM' + @@ -488,7 +491,7 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.verbose = false; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'Mxema7+o7uDni/0O3OCjsr+CeG05csSon2FK8yYVJkaM' + @@ -509,8 +512,9 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { const sut = await Integrity.createDirHash('./test', options); - expect(sut).to.be.an('object').and.to.haveOwnProperty('.'); - const root = sut['.'] as IVerboseHashObject; + expect(sut).to.be.an('object') + .and.to.haveOwnProperty('test'); + const root = sut.test as IVerboseHashObject; expect(root.hash).to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, 'sH3FNHzynm2mQIN1RxoJ1RdKgJvZhyEjJ9amF4sO24mh' + @@ -522,8 +526,8 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { async function (): Promise { options.exclude = [fileToHashFilename]; const sut = await Integrity.createDirHash(fixturesDirPath, options); - expect(sut).to.be.an('object').and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + expect(sut).to.be.an('object').and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.not.haveOwnProperty(fileToHashFilename); const fcfixtures = fixtures.contents.fixtures as IVerboseHashObject; expect(fcfixtures.contents).to.haveOwnProperty(fileToHashFilename); @@ -539,8 +543,8 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { async function (): Promise { options.exclude = [`**/${fileToHashFilename}`]; const sut = await Integrity.createDirHash(fixturesDirPath, options); - expect(sut).to.be.an('object').and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + expect(sut).to.be.an('object').and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.not.haveOwnProperty(fileToHashFilename); const fcfixtures = fixtures.contents.fixtures as IVerboseHashObject; expect(fcfixtures.contents).to.not.haveOwnProperty(fileToHashFilename); @@ -556,8 +560,8 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { async function (): Promise { options.exclude = [fileToHashFilename, `**/${otherFileToHashFilename}`]; const sut = await Integrity.createDirHash(fixturesDirPath, options); - expect(sut).to.be.an('object').and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + expect(sut).to.be.an('object').and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.not.haveOwnProperty(fileToHashFilename); const fcdirectorydot1 = fixtures.contents['directory.1'] as IVerboseHashObject; expect(fcdirectorydot1.contents).to.not.haveOwnProperty(otherFileToHashFilename); @@ -581,8 +585,8 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { async function (): Promise { options.exclude = [`**/${fileToHashFilename}`, `**/${otherFileToHashFilename}`]; const sut = await Integrity.createDirHash(fixturesDirPath, options); - expect(sut).to.be.an('object').and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + expect(sut).to.be.an('object').and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.not.haveOwnProperty(fileToHashFilename); const fcfixtures = fixtures.contents.fixtures as IVerboseHashObject; expect(fcfixtures.contents).to.not.haveOwnProperty(fileToHashFilename); @@ -598,8 +602,8 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { async function (): Promise { options.exclude = ['*.txt']; const sut = await Integrity.createDirHash(fixturesDirPath, options); - expect(sut).to.be.an('object').and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + expect(sut).to.be.an('object').and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.not.haveOwnProperty(fileToHashFilename); expect(fixtures.contents).to.not.haveOwnProperty('sameContentWithFileToHash.txt'); const fcfixtures = fixtures.contents.fixtures as IVerboseHashObject; @@ -624,8 +628,8 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.exclude = ['*.*']; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + .and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.not.haveOwnProperty(fileToHashFilename); expect(fixtures.contents).to.not.haveOwnProperty('sameContentWithFileToHash.txt'); expect(fixtures.contents).to.haveOwnProperty('directory.1'); @@ -644,8 +648,8 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.exclude = ['*.*/']; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + .and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.haveOwnProperty(fileToHashFilename); expect(fixtures.contents).to.haveOwnProperty('sameContentWithFileToHash.txt'); expect(fixtures.contents).to.not.haveOwnProperty('directory.1'); @@ -694,8 +698,8 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.exclude = ['fixtures']; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + .and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.haveOwnProperty(fileToHashFilename); expect(fixtures.contents).to.haveOwnProperty('sameContentWithFileToHash.txt'); expect(fixtures.contents).to.haveOwnProperty('directory'); @@ -714,8 +718,8 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.exclude = ['**/fixtures']; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + .and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.haveOwnProperty(fileToHashFilename); expect(fixtures.contents).to.haveOwnProperty('sameContentWithFileToHash.txt'); expect(fixtures.contents).to.haveOwnProperty('directory'); @@ -734,8 +738,8 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.exclude = ['fixtures/']; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + .and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.haveOwnProperty(fileToHashFilename); expect(fixtures.contents).to.haveOwnProperty('sameContentWithFileToHash.txt'); expect(fixtures.contents).to.haveOwnProperty('directory'); @@ -754,8 +758,8 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.exclude = ['**/fixtures/**']; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + .and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.haveOwnProperty(fileToHashFilename); expect(fixtures.contents).to.haveOwnProperty('sameContentWithFileToHash.txt'); expect(fixtures.contents).to.haveOwnProperty('directory'); @@ -775,16 +779,16 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object'); expect(sut) - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.not.haveOwnProperty('directory'); expect(sut) - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.haveOwnProperty('directory'); - const fixtures = sut['.'] as IVerboseHashObject; + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.hash) .to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, @@ -799,16 +803,16 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object'); expect(sut) - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.not.haveOwnProperty('directory'); expect(sut) - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.not.haveOwnProperty('directory'); - const fixtures = sut['.'] as IVerboseHashObject; + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.hash) .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, @@ -823,16 +827,16 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object'); expect(sut) - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.not.haveOwnProperty('directory'); expect(sut) - .and.to.haveOwnProperty('.') + .and.to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.not.haveOwnProperty('directory'); - const fixtures = sut['.'] as IVerboseHashObject; + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.hash) .and.to.satisfy((hash: string) => checker(hash, utils.base64RegexPattern, @@ -858,8 +862,8 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { options.exclude = ['*', '*/', '!fileToHash.txt']; const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object') - .and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + .and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures).and.that.to.haveOwnProperty('contents'); expect(fixtures.contents) .to.haveOwnProperty(fileToHashFilename) @@ -879,9 +883,9 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object'); expect(sut) - .to.haveOwnProperty('.') + .to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents'); - const fixtures = sut['.'] as IVerboseHashObject; + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).to.haveOwnProperty('fixtures'); expect(fixtures.contents).to.not.haveOwnProperty('directory'); expect(fixtures.contents).to.not.haveOwnProperty('directory.1'); @@ -910,14 +914,14 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { async function (): Promise { options.exclude = ['*', '*/', '!**/fixtures/fileToHash.txt']; const sut = await Integrity.createDirHash(fixturesDirPath, options); - expect(sut).to.be.an('object').and.to.haveOwnProperty('.'); - const fixtures = sut['.'] as IVerboseHashObject; + expect(sut).to.be.an('object').and.to.haveOwnProperty('fixtures'); + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).not.to.haveOwnProperty('directory'); expect(fixtures.contents).not.to.haveOwnProperty('directory.1'); expect(fixtures.contents).not.to.haveOwnProperty(fileToHashFilename); expect(fixtures.contents).not.to.haveOwnProperty('sameContentWithFileToHash.txt'); expect(sut) - .to.haveOwnProperty('.') + .to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') @@ -945,9 +949,9 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object'); expect(sut) - .to.haveOwnProperty('.') + .to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents'); - const fixtures = sut['.'] as IVerboseHashObject; + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).not.to.haveOwnProperty('fixtures'); expect(fixtures.contents).not.to.haveOwnProperty('directory'); expect(fixtures.contents).not.to.haveOwnProperty('directory.1'); @@ -973,11 +977,11 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object'); expect(sut) - .to.haveOwnProperty('.') + .to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.haveOwnProperty('directory') .and.that.to.haveOwnProperty('contents'); - const fixtures = sut['.'] as IVerboseHashObject; + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).not.to.haveOwnProperty('fixtures'); expect(fixtures.contents).not.to.haveOwnProperty('directory.1'); expect(fixtures.contents).not.to.haveOwnProperty(fileToHashFilename); @@ -1011,13 +1015,13 @@ describe(`Integrity: function 'createDirHash' tests`, function (): void { const sut = await Integrity.createDirHash(fixturesDirPath, options); expect(sut).to.be.an('object'); expect(sut) - .to.haveOwnProperty('.') + .to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.haveOwnProperty('fixtures') .and.that.to.haveOwnProperty('contents') .and.that.to.haveOwnProperty('directory') .and.that.to.haveOwnProperty('contents'); - const fixtures = sut['.'] as IVerboseHashObject; + const fixtures = sut.fixtures as IVerboseHashObject; expect(fixtures.contents).not.to.haveOwnProperty('directory'); expect(fixtures.contents).not.to.haveOwnProperty('directory.1'); expect(fixtures.contents).not.to.haveOwnProperty(fileToHashFilename); diff --git a/test/cli/index.test.ts b/test/cli/index.test.ts index 2242458..685871d 100644 --- a/test/cli/index.test.ts +++ b/test/cli/index.test.ts @@ -35,6 +35,7 @@ describe('CLI: tests', function (): void { manifest: false, outPath: './', pretty: false, + strict: false, verbose: false, }; sandbox = sinon.createSandbox(); diff --git a/test/common/yargsParser.test.ts b/test/common/yargsParser.test.ts index 9a54aeb..b40bd2c 100644 --- a/test/common/yargsParser.test.ts +++ b/test/common/yargsParser.test.ts @@ -31,7 +31,8 @@ describe('YargsParser: tests', function (): void { argv.value([...args]); const sut = parser.parse(); const props = ['dirAlgorithm', 'fileAlgorithm', 'command', 'encoding', - 'exclude', 'inPath', 'integrity', 'manifest', 'outPath', 'pretty', 'verbose']; + 'exclude', 'inPath', 'integrity', 'manifest', 'outPath', 'pretty', + 'strict', 'verbose']; expect(sut).to.be.an('object'); props.forEach(prop => expect(sut).to.be.haveOwnProperty(prop)); expect(Object.keys(sut)).with.length(props.length);