Closed ayousuf23 closed 2 years ago
This is a mega-issue that divides the tests to be added to Compress-Archive. This list is not complete, and more tests will be added over time.
[x] indicates the test has been added to Compress-Archive.Tests.ps1. [ ] indices the test has not yet been added.
Compress-Archive.Tests.ps1
All tests will be written in Pester 5. Old tests will be updated.
[x] Validate errors from empty or null -Path and -DestinationPath parameters
-Path
-DestinationPath
[x] Validate errors from non-existent -Path
[x] Validate errors from non-existent -LiteralPath
-LiteralPath
[x] Validate error when duplicate paths are supplied to -Path
[x] Validate error when duplicate paths are supplied to -LiteralPath
[x] Validate source path can be at SystemDrive location
[x] Validate error when -Path contains duplicate paths [Duplicate Paths]
[x] Validate error when -LiteralPath contains duplicate paths [Duplicate Paths]
[x] Throws an error when Path and DestinationPath are the same and -Update is specified
[x] Throws an error when Path and DestinationPath are the same and -Overwrite is specified
[x] Throws an error when LiteralPath and DestinationPath are the same and -Update is specified
[x] Throws an error when LiteralPath and DestinationPath are the same and -Overwrite is specified
Can't be tested:
[x] Throws a terminating error when archive file already exists and -Update and -Overwrite parameters are not specified
[x] Throws a terminating error when archive file exists and -Update is specified but the archive is read-only
[x] Throws a terminating error when archive already exists as a directory and -Update and -Overwrite parameters are not specified
[x] Throws a terminating error when DestinationPath is a directory and -Update is specified
[x] Throws a terminating error when DestinationPath is a folder containing at least 1 item and Overwrite is specified
[x] Throws a terminating error when archive does not exist and -Update mode is specified
[x] Overwrites a directory containing no items when -Overwrite is specified
[x] Overwrites an archive that already exists
[x] Throws a terminating error when trying to overwrite DestinationPath which is the empty working directory
Not needed:
[x] Accepts DestinationPath parameter with wildcard characters that resolves to one path
[x] Accepts LiteralPath parameter for a directory with wildcard characters in the directory name
[x] [NEEDED] Accepts DestinationPath parameter with [ but no matching ]
[x] Accepts LiteralPath parameter for a file with wildcards in the filename
-PassThru
-Update
Notes:
-CompressionLevel
[x] Skips archiving a file in use
[x] Compresses a read-only file
[x] Compresses a hidden file
[x] Compresses a hidden directory
[x] Compresses a directory containing a hidden file and directory
-Format
-DestinatonPath
This is a mega-issue that divides the tests to be added to Compress-Archive. This list is not complete, and more tests will be added over time.
[x] indicates the test has been added to
Compress-Archive.Tests.ps1
. [ ] indices the test has not yet been added.All tests will be written in Pester 5. Old tests will be updated.
Parameter set validation tests
[x] Validate errors from empty or null
-Path
and-DestinationPath
parameters[x] Validate errors from non-existent
-Path
[x] Validate errors from non-existent
-LiteralPath
[x] Validate error when duplicate paths are supplied to
-Path
[x] Validate error when duplicate paths are supplied to
-LiteralPath
[x] Validate source path can be at SystemDrive location
[x] Validate error when
-Path
contains duplicate paths [Duplicate Paths][x] Validate error when
-LiteralPath
contains duplicate paths [Duplicate Paths][x] Throws an error when Path and DestinationPath are the same and -Update is specified
[x] Throws an error when Path and DestinationPath are the same and -Overwrite is specified
[x] Throws an error when LiteralPath and DestinationPath are the same and -Update is specified
[x] Throws an error when LiteralPath and DestinationPath are the same and -Overwrite is specified
Can't be tested:
-DestinationPath and -WriteMode Overwrite Tests
[x] Throws a terminating error when archive file already exists and -Update and -Overwrite parameters are not specified
[x] Throws a terminating error when archive file exists and -Update is specified but the archive is read-only
[x] Throws a terminating error when archive already exists as a directory and -Update and -Overwrite parameters are not specified
[x] Throws a terminating error when DestinationPath is a directory and -Update is specified
[x] Throws a terminating error when DestinationPath is a folder containing at least 1 item and Overwrite is specified
[x] Throws a terminating error when archive does not exist and -Update mode is specified
[x] Overwrites a directory containing no items when -Overwrite is specified
[x] Overwrites an archive that already exists
[x] Throws a terminating error when trying to overwrite DestinationPath which is the empty working directory
-Action tests
Not needed:
Special and Wildcard Characters
[x] Accepts DestinationPath parameter with wildcard characters that resolves to one path
[x] Accepts LiteralPath parameter for a directory with wildcard characters in the directory name
[x] [NEEDED] Accepts DestinationPath parameter with [ but no matching ]
[x] Accepts LiteralPath parameter for a file with wildcards in the filename
Basic functional tests
Zip-specific tests
-PassThru
parameter-Update
parameterNotes:
-CompressionLevel
parameterFile permissions, locked files, hidden files, symbolic links, etc.
[x] Skips archiving a file in use
[x] Compresses a read-only file
[x] Compresses a hidden file
[x] Compresses a hidden directory
[x] Compresses a directory containing a hidden file and directory
Pipelining
Archive formats and
-Format
parameterPath Structure Preservation Tests
-Path
can be a relative path-LiteralPath
can be a relative path-DestinatonPath
can be a relative path