chocolatey / ChocoCCM

PowerShell module for interacting with Chocolatey Central Management
Apache License 2.0
9 stars 8 forks source link

(#66) Adding Tests to ChocoCCM #79

Open JPRuskin opened 1 year ago

JPRuskin commented 1 year ago

Description Of Changes

This PR adds a few tests to the module.

Motivation and Context

I wanted to refactor something, but without tests to show that my changes didn't actually change the resulting operations (beyond a few fixes), I was unlikely to be able to convince folk to look at it.

image

Ideally, we will add some integration tests that can work against a running instance, but this is (hopefully) a great start for unit testing that can be run quickly at dev and build time!

Most missed testing is now in Set-CCMDeploymentStep (which is non-functional but lengthy, and has a bug open around fixing it - #68), Import-PDQDeployPackage (which I didn't have data to test against), the if not $script:session throw blocks, and argument completers.

There are a number of currently skipped tests that could do with a chat.

Testing

No changes to operational code were made, except for those that fixed bugs in functions. These should now work!

Operating Systems Testing

Change Types Made

...technically I suppose the changes to fix functions are breaking changes, but in a good way? I'd argue there are no truly breaking changes in here. There is a change to make a name match more exact that may break usage, but does not break what we say should happen. Happy to chat about that.

Change Checklist

Related Issue

Fixes #66

JPRuskin commented 1 year ago

A few PSSA rules I need to follow in the tests before merging, it seems.

Edit: Sorted, though I couldn't make things pretty and follow the rules. A true conundrum!