-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve create-solana-dapp args handling
- Loading branch information
Showing
5 changed files
with
104 additions
and
14 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
71 changes: 71 additions & 0 deletions
71
packages/create-solana-dapp/lib/__snapshots__/get-args.spec.ts.snap
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,71 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`get-args should get args with minimal parameters 1`] = ` | ||
{ | ||
"anchor": true, | ||
"anchorName": "anchor", | ||
"anchorTemplate": "counter", | ||
"appName": "web", | ||
"dryRun": false, | ||
"name": "my-app", | ||
"package": "@solana-developers/[email protected]", | ||
"packageManager": "npm", | ||
"preset": "next", | ||
} | ||
`; | ||
|
||
exports[`get-args should get args with preset: --preset next 1`] = ` | ||
{ | ||
"anchor": true, | ||
"anchorName": "anchor", | ||
"anchorTemplate": "counter", | ||
"appName": "web", | ||
"dryRun": false, | ||
"name": "my-app", | ||
"package": "@solana-developers/[email protected]", | ||
"packageManager": "npm", | ||
"preset": "next", | ||
} | ||
`; | ||
|
||
exports[`get-args should get args with preset: --preset react --anchor false 1`] = ` | ||
{ | ||
"anchor": false, | ||
"anchorName": undefined, | ||
"anchorTemplate": undefined, | ||
"appName": "web", | ||
"dryRun": false, | ||
"name": "my-app", | ||
"package": "@solana-developers/[email protected]", | ||
"packageManager": "npm", | ||
"preset": "react", | ||
} | ||
`; | ||
|
||
exports[`get-args should get args with preset: --preset react --anchor-template hello-world --anchor-name program 1`] = ` | ||
{ | ||
"anchor": true, | ||
"anchorName": "program", | ||
"anchorTemplate": "hello-world", | ||
"appName": "web", | ||
"dryRun": false, | ||
"name": "my-app", | ||
"package": "@solana-developers/[email protected]", | ||
"packageManager": "npm", | ||
"preset": "react", | ||
} | ||
`; | ||
|
||
exports[`get-args should get args with preset: --preset react 1`] = ` | ||
{ | ||
"anchor": true, | ||
"anchorName": "anchor", | ||
"anchorTemplate": "counter", | ||
"appName": "web", | ||
"dryRun": false, | ||
"name": "my-app", | ||
"package": "@solana-developers/[email protected]", | ||
"packageManager": "npm", | ||
"preset": "react", | ||
} | ||
`; |
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,19 @@ | ||
import { getArgs } from './get-args' | ||
|
||
describe('get-args', () => { | ||
it('should get args with minimal parameters', async () => { | ||
const result = await getArgs(['', '', 'my-app', '--preset', 'next']) | ||
expect(result).toMatchSnapshot() | ||
}) | ||
|
||
it.each([ | ||
'--preset next', | ||
'--preset react', | ||
'--preset react --anchor false', | ||
'--preset react --anchor-template hello-world --anchor-name program', | ||
])('should get args with preset: %s', async (preset: string) => { | ||
const result = await getArgs(['', '', 'my-app', ...preset.split(' ')]) | ||
|
||
expect(result).toMatchSnapshot() | ||
}) | ||
}) |
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