Skip to content

Commit 2a3cbb4

Browse files
committed
add test
1 parent 4030a24 commit 2a3cbb4

File tree

2 files changed

+57
-13
lines changed

2 files changed

+57
-13
lines changed

dsc/tests/dsc_metadata.tests.ps1

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,56 @@
22
# Licensed under the MIT License.
33

44
Describe 'metadata tests' {
5+
It 'resource can provide high-level metadata for <operation>' -TestCases @(
6+
@{ operation = 'get' }
7+
@{ operation = 'set' }
8+
@{ operation = 'test' }
9+
) {
10+
param($operation)
11+
12+
$configYaml = @'
13+
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
14+
resources:
15+
- name: test
16+
type: Test/Metadata
17+
metadata:
18+
hello: world
19+
myNumber: 42
20+
properties:
21+
'@
22+
23+
$out = dsc config $operation -i $configYaml 2>$TestDrive/error.log | ConvertFrom-Json
24+
$LASTEXITCODE | Should -Be 0
25+
$out.results.count | Should -Be 1
26+
$out.results[0].metadata.hello | Should -BeExactly 'world'
27+
$out.results[0].metadata.myNumber | Should -Be 42
28+
}
29+
30+
It 'resource can provide high-level metadata for export' {
31+
$configYaml = @'
32+
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
33+
resources:
34+
- name: test
35+
type: Test/Metadata
36+
metadata:
37+
hello: There
38+
myNumber: 16
39+
properties:
40+
'@
41+
$out = dsc config export -i $configYaml 2>$TestDrive/error.log | ConvertFrom-Json
42+
$LASTEXITCODE | Should -Be 0
43+
$out.resources.count | Should -Be 3
44+
$out.resources[0].metadata.hello | Should -BeExactly 'There'
45+
$out.resources[0].metadata.myNumber | Should -Be 16
46+
$out.resources[0].name | Should -BeExactly 'Metadata example 1'
47+
$out.resources[1].metadata.hello | Should -BeExactly 'There'
48+
$out.resources[1].metadata.myNumber | Should -Be 16
49+
$out.resources[1].name | Should -BeExactly 'Metadata example 2'
50+
$out.resources[2].metadata.hello | Should -BeExactly 'There'
51+
$out.resources[2].metadata.myNumber | Should -Be 16
52+
$out.resources[2].name | Should -BeExactly 'Metadata example 3'
53+
}
54+
555
It 'resource can provide metadata for <operation>' -TestCases @(
656
@{ operation = 'get' }
757
@{ operation = 'set' }

tree-sitter-dscexpression/.gitignore

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,23 @@ target/
55
build/
66
prebuilds/
77
node_modules/
8-
package-lock.json
8+
*.tgz
99

1010
# Swift artifacts
1111
.build/
12-
Package.resolved
12+
Package.swift
1313

1414
# Go artifacts
15+
go.sum
1516
_obj/
1617

1718
# Python artifacts
1819
.venv/
1920
dist/
2021
*.egg-info
2122
*.whl
23+
pyproject.toml
24+
setup.py
2225

2326
# C artifacts
2427
*.a
@@ -27,13 +30,7 @@ dist/
2730
*.dylib
2831
*.dll
2932
*.pc
30-
*.exp
31-
*.lib
32-
33-
# Zig artifacts
34-
.zig-cache/
35-
zig-cache/
36-
zig-out/
33+
Makefile
3734

3835
# Example dirs
3936
/examples/*/
@@ -43,7 +40,4 @@ zig-out/
4340
*.obj
4441
*.o
4542

46-
# Archives
47-
*.tar.gz
48-
*.tgz
49-
*.zip
43+
.editorconfig

0 commit comments

Comments
 (0)