-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add --dev-preview flag to theme init for framework theme support
- Loading branch information
1 parent
39e1017
commit 4ed31c8
Showing
6 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import Init from './init.js' | ||
import {cloneRepo, cloneRepoAndCheckoutLatestTag} from '../../services/init.js' | ||
import {describe, expect, vi, test} from 'vitest' | ||
import {Config} from '@oclif/core' | ||
|
||
vi.mock('../../services/init.js') | ||
vi.mock('@shopify/cli-kit/node/ui') | ||
|
||
const CommandConfig = new Config({root: './'}) | ||
|
||
describe('Init', () => { | ||
const path = '.' | ||
|
||
async function run(argv: string[]) { | ||
await CommandConfig.load() | ||
const init = new Init([`--path=${path}`, ...argv], CommandConfig) | ||
return init.run() | ||
} | ||
|
||
describe('dev-preview flag', () => { | ||
test('uses framework theme when dev-preview flag is true and default clone-url is not provided', async () => { | ||
// Given | ||
const flags = ['--dev-preview'] | ||
|
||
// When | ||
await run(flags) | ||
|
||
// Then | ||
expect(cloneRepo).toHaveBeenCalledWith('https://github.com/Shopify/framework-theme.git', expect.any(String)) | ||
}) | ||
|
||
test('uses provided clone-url when custom url is provided, regardless of dev-preview flag', async () => { | ||
// Given | ||
const flags = ['--dev-preview', '--clone-url=https://github.com/org/theme.git'] | ||
|
||
// When | ||
await run(flags) | ||
|
||
// Then | ||
expect(cloneRepo).toHaveBeenCalledWith('https://github.com/org/theme.git', expect.any(String)) | ||
}) | ||
}) | ||
|
||
describe('latest flag', () => { | ||
test('uses cloneRepoAndCheckoutLatestTag when latest flag is true', async () => { | ||
// Given | ||
const flags = ['--latest'] | ||
|
||
// When | ||
await run(flags) | ||
|
||
// Then | ||
expect(cloneRepoAndCheckoutLatestTag).toHaveBeenCalledWith( | ||
'https://github.com/Shopify/dawn.git', | ||
expect.any(String), | ||
) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters