diff --git a/packages/core/tests/pattern-draft.test.mjs b/packages/core/tests/pattern-draft.test.mjs index 009f9581dfa..cf00be74f35 100644 --- a/packages/core/tests/pattern-draft.test.mjs +++ b/packages/core/tests/pattern-draft.test.mjs @@ -174,6 +174,40 @@ describe('Pattern', () => { 'Could not inject part `otherPart` into part `front`' ) }) + + describe('Pattern.__pack()', () => { + it('should get a part stack name from a function', () => { + const expectedName = 'namedStack' + const front = { + name: 'front', + stack: function (settings, partName) { + return settings.options.stackName + }, + options: { + stackName: { + dflt: expectedName, + list: [expectedName, 'otherStack'], + }, + }, + draft: function ({ part }) { + return part + }, + } + + const Test = new Design({ + name: 'test', + parts: [front], + }) + + const pattern = new Test() + pattern.draft() + pattern.__pack() + + const stackNames = Object.keys(pattern.stacks) + expect(stackNames).to.include(expectedName) + expect(stackNames).not.to.include('front') + }) + }) /* it('Should return all render props', () => {