forked from dfinke/PowerShellNotebook
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNewCodeCell.tests.ps1
More file actions
27 lines (22 loc) · 800 Bytes
/
Copy pathNewCodeCell.tests.ps1
File metadata and controls
27 lines (22 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Import-Module $PSScriptRoot\..\PowerShellNotebook.psd1 -Force
Describe "Test New-CodeCell" -Tag 'New-CodeCell' {
It "Should have New-CodeCell" {
$actual = Get-Command New-CodeCell -ErrorAction SilentlyContinue
$actual | Should -Not -Be $Null
}
It "Test source" {
$vars = @'
$a=1
$b=3
'@
$json = New-CodeCell -Source $vars
$actual = $json | ConvertFrom-Json
$actual.cell_type | Should -BeExactly "code"
$actual.execution_count | Should -Be 0
$actual.outputs | Should -Be $null
$actual.metadata.tags | Should -Be "injected-parameters"
$actual.source.count | Should -Be 2
$actual.source[0].Trim() | Should -BeExactly '$a=1'
$actual.source[1] | Should -BeExactly '$b=3'
}
}