Skip to content

Commit 0f561e4

Browse files
committed
Add block test to map command
1 parent 11fe360 commit 0f561e4

File tree

5 files changed

+14
-0
lines changed

5 files changed

+14
-0
lines changed

test/commands/theme/component/map.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,18 @@ describe('theme component map', () => {
9696
expect(data.files.snippets['child.liquid']).to.equal('@archetype-themes/test-collection')
9797
})
9898

99+
it('adds entries for blocks', async () => {
100+
const beforeData = JSON.parse(fs.readFileSync(path.join(testThemePath, 'component.manifest.json'), 'utf8'))
101+
expect(beforeData.files.snippets['section-with-block-snippet.liquid']).to.be.undefined
102+
expect(beforeData.files.snippets['section-with-block-snippet.block.liquid']).to.be.undefined
103+
104+
await runCommand(['theme', 'component', 'map', testThemePath])
105+
106+
const data = JSON.parse(fs.readFileSync(path.join(testThemePath, 'component.manifest.json'), 'utf8'))
107+
expect(data.files.snippets['section-with-block-snippet.liquid']).to.equal('@archetype-themes/test-collection')
108+
expect(data.files.snippets['section-with-block-snippet.block.liquid']).to.equal('@archetype-themes/test-collection')
109+
})
110+
99111
it('throws a warning if there is a potential conflict with an entry in the current collection', async () => {
100112
const {stdout} = await runCommand(['theme', 'component', 'map', testThemePath])
101113
const data = JSON.parse(fs.readFileSync(path.join(testThemePath, 'component.manifest.json'), 'utf8'))

test/fixtures/collection/components/section-with-block-snippet/section-with-block-snippet.liquid

Whitespace-only changes.

test/fixtures/collection/components/section-with-block-snippet/snippets/section-with-block-snippet.block.liquid

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{% render 'section-with-block-snippet.block' %}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{% render 'section-with-block-snippet' %}

0 commit comments

Comments
 (0)