Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SfHelper.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Description = 'Powershell module to help query Salesforce'
# ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @(@{ModuleName="InvokeHelper"; ModuleVersion="1.2.1"})
RequiredModules = @(@{ModuleName="InvokeHelper"; ModuleVersion="1.2.2"})

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
Expand Down
15 changes: 14 additions & 1 deletion Test/include/config.mock.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@

$CONFIG_INVOKE_GET_ROOT_PATH_CMD = "Invoke-SfGetConfigRootPath"
# CONFIG MOCK
#
# This file is used to mock the config path and the config file
# for the tests. It creates a mock config path and a mock config file
# and sets the config path to the mock config path.
# We need to define varaibles for this include to work
# $MOCK_CONFIG_PATH : The path use as the mock config folder
# $CONFIG_INVOKE_GET_ROOT_PATH_CMD : Invoke comand that is needed to be mocked
#
# Sample file
# # CONFIG MOCK VARIABLES
# # This file is required for CONFIF MOCK to work
# $CONFIG_INVOKE_GET_ROOT_PATH_CMD = "Invoke-SfGetConfigRootPath"
# $MOCK_CONFIG_PATH = "test_config_path"

function Mock_Config{
param(
Expand Down
31 changes: 29 additions & 2 deletions Test/include/database.mock.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@

$DB_INVOKE_GET_ROOT_PATH_CMD = "Invoke-SfGetDbRootPath"
# DATABASE MOCK
#
# This file is used to mock the database path and the database file
# for the tests. It creates a mock database path and a mock database file
# and sets the database path to the mock database path.
# We need to define variables for this include to work
# $MOCK_DATABASE_PATH : The path used as the mock database folder
# $DB_INVOKE_GET_ROOT_PATH_CMD : Invoke command that is needed to be mocked
# $DB_INVOKE_GET_ROOT_PATH_ALIAS : Invoke function to retreive the root path of the database
#
# Sample file
# # DATABASE MOCK VARIABLES
# # This file is required for DATABASE MOCK to work
# $DB_INVOKE_GET_ROOT_PATH_CMD = "Invoke-SfGetDbRootPath"
# $DB_INVOKE_GET_ROOT_PATH_ALIAS = "SfGetDbRootPath"
#
# $MOCK_DATABASE_PATH = "test_database_path"

function Mock_Database([switch]$ResetDatabase){

Expand All @@ -17,4 +32,16 @@
function Get-Mock_DatabaseStore{
$dbstore = Invoke-MyCommand -Command $DB_INVOKE_GET_ROOT_PATH_CMD
return $dbstore
}

function Reset-DatabaseStore{

Check warning

Code scanning / PSScriptAnalyzer

Function 'Reset-DatabaseStore' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'. Warning

Function 'Reset-DatabaseStore' has verb that could change system state. Therefore, the function has to support 'ShouldProcess'.
[CmdletBinding()]
param()

$databaseRoot = Invoke-MyCommand -Command $DB_INVOKE_GET_ROOT_PATH_ALIAS

Remove-Item -Path $databaseRoot -Recurse -Force -ErrorAction SilentlyContinue

New-Item -Path $databaseRoot -ItemType Directory

}
5 changes: 5 additions & 0 deletions Test/private/include.config.mock.sf.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CONFIG MOCK VARIABLES
# This file is required for CONFIF MOCK to work

$MOCK_CONFIG_PATH = "test_config_path"

Check warning

Code scanning / PSScriptAnalyzer

The variable 'MOCK_CONFIG_PATH' is assigned but never used. Warning

The variable 'MOCK_CONFIG_PATH' is assigned but never used.
$CONFIG_INVOKE_GET_ROOT_PATH_CMD = "Invoke-SfGetConfigRootPath"

Check warning

Code scanning / PSScriptAnalyzer

The variable 'CONFIG_INVOKE_GET_ROOT_PATH_CMD' is assigned but never used. Warning

The variable 'CONFIG_INVOKE_GET_ROOT_PATH_CMD' is assigned but never used.
7 changes: 7 additions & 0 deletions Test/private/include.databasev2.mock.sf.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# DATABASEV2 MOCK VARIABLES
# This file is required for DATABASEV2 MOCK to work

$DB_INVOKE_GET_ROOT_PATH_ALIAS = "SfGetDbRootPath"

Check warning

Code scanning / PSScriptAnalyzer

The variable 'DB_INVOKE_GET_ROOT_PATH_ALIAS' is assigned but never used. Warning

The variable 'DB_INVOKE_GET_ROOT_PATH_ALIAS' is assigned but never used.
$DB_INVOKE_GET_ROOT_PATH_CMD = "Invoke-SfGetDbRootPath"

Check warning

Code scanning / PSScriptAnalyzer

The variable 'DB_INVOKE_GET_ROOT_PATH_CMD' is assigned but never used. Warning

The variable 'DB_INVOKE_GET_ROOT_PATH_CMD' is assigned but never used.
$MOCK_DATABASE_PATH = "test_database_path"

Check warning

Code scanning / PSScriptAnalyzer

The variable 'MOCK_DATABASE_PATH' is assigned but never used. Warning

The variable 'MOCK_DATABASE_PATH' is assigned but never used.

2 changes: 2 additions & 0 deletions Test/private/mock_variables.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@

$MODULE_INVOKATION_TAG = "SfHelperModule"
$MODULE_INVOKATION_TAG_MOCK = "SfHelperModule-Mock"

# SetMockPath
$MOCK_PATH = $PSScriptRoot | Split-Path -Parent | Join-Path -ChildPath 'private' -AdditionalChildPath 'mocks'
File renamed without changes.
15 changes: 15 additions & 0 deletions public/include.databasev2.sf.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This file is required for INCLUDE DATABASE V2

$DB_INVOKE_GET_ROOT_PATH_ALIAS = "SfGetDbRootPath"
$DB_INVOKE_GET_ROOT_PATH_CMD = "Invoke-SfGetDbRootPath"

Set-MyInvokeCommandAlias -Alias $DB_INVOKE_GET_ROOT_PATH_ALIAS -Command $DB_INVOKE_GET_ROOT_PATH_CMD

function Invoke-SfGetDbRootPath{

Check notice

Code scanning / PSScriptAnalyzer

The cmdlet 'Invoke-SfGetDbRootPath' does not have a help comment. Note

The cmdlet 'Invoke-SfGetDbRootPath' does not have a help comment.
[CmdletBinding()]
param()

$databaseRoot = GetDatabaseRootPath
return $databaseRoot

} Export-ModuleMember -Function Invoke-SfGetDbRootPath
29 changes: 0 additions & 29 deletions public/sfDatabase.ps1

This file was deleted.

Loading