Skip to content

Expand-Archive Tests #129

@ayousuf23

Description

@ayousuf23

This is a mega-issue that divides the tests to be added to Expand-Archive. This list is not complete, and more tests will be added over time.

[x] indicates the test has been added to Expand-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

  • Validate errors with NULL & EMPTY values for Path, LiteralPath, and DestinationPath
  • Throws when invalid path non-existing path is supplied for Path or LiteralPath parameters
  • Throws when invalid path non-filesystem path is supplied for Path or LiteralPath parameters
  • Throws an error when multiple paths are supplied as input to Path parameter
  • Throws an error when multiple paths are supplied as input to LiteralPath parameter
  • Throws an error when Path and DestinationPath are the same and -WriteMode Overwrite is specified
  • Throws an error when LiteralPath and DestinationPath are the same and WriteMode -Overwrite is specified
  • Throws an error when an invalid path is supplied to DestinationPath

-DestinationPath parameter tests

  • Throws an error when DestinationPath is an existing file
  • Does not throw an error when a directory in the archive has the same destination path as an existing directory
  • Writes a non-terminating error when a file in the archive has a destination path that already exists
  • Writes a non-terminating error when a file in the archive has a destination path that is an existing directory containing at least 1 item and -WriteMode Overwrite is specified
  • Writes a non-terminating error when a file in the archive has a destination path that is the working directory and -WriteMode Overwrite is specified
  • Overwrites a file when it is DestinationPath and -WriteMode Overwrite is specified
  • Overwrites a file whose path is the same as the destination path of a file in the archive when -WriteMode Overwrite is specified
  • Overwrites a directory whose path is the same as the destination path of a file in the archive when -WriteMode Overwrite is specified
  • Overwrites a file whose path is the same as the destination path of a directory in the archive when -WriteMode Overwrite is specified

Relative paths

  • Expands an archive when -Path is a relative path
  • Expands an archive when -LiteralPath is a relative path
  • Expands an archive when -DestinationPath is a relative path

Special and Wildcard Characters

  • Expands an archive when -Path contains wildcard character and resolves to 1 path
  • Throws a terminating error when archive when -Path contains wildcard character and resolves to multiple paths
  • Expands an archive when -LiteralPath contains [ but no matching ]
  • Expands an archive when -DestinationPath contains [ but no matching ]

Basic functional tests

  • Expands an archive when a non-existent directory is specified as -DestinationPath
  • Expands an archive when DestinationPath is an existing directory
  • Expands an archive to the working directory when it is specified as -DestinationPath
  • Expands an archive to a directory with that archive's name when -DestinationPath is not specified
  • Expands an archive containing multiple files, non-empty directories, and empty directories
  • Expands an archive containing a file whose LastWriteTime is in the past
  • Expands an archive containing a directory whose LastWriteTime is in the past
  • Throws an error when expanding an archive whose name does not have an extension and -DestinationPath is not specified

-PassThru parameter

  • Returns a System.IO.DirectoryInfo object when PassThru is specified

  • Does not return an object when PassThru is not specified

  • Does not return an object when PassThru is false

File permissions, locked files, hidden files, symbolic links, etc.

  • Expands a read-only archive
  • Expands an archive in-use
  • Expands an archive containing an entry with non-latin characters

Pipelining

  • Expands an archive when -Path is passed by pipeline
  • Expands an archive when -Path is passed by pipeline by name
  • Throws an error when multiple paths are passed by pipeline

Large file tests

  • Expands an archive whose size is > 4GB
  • Expands an entry whose size is > 4GB

Archive formats and -Format parameter

  • Throws an error when an invalid value is supplied to -Format

Module

  • Validate module can be imported when current language is not en-US (1247)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions