-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: enable help for category statuses (#12216)
* fix: enable help for category statuses * test: add e2e test for status with help
- Loading branch information
Showing
5 changed files
with
127 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { getCLIPath, nspawn as spawn } from '..'; | ||
|
||
export const statusWithHelp = async (cwd: string, expectedContents: Array<string>): Promise<void> => { | ||
const chain = spawn(getCLIPath(), ['status', '-h'], { cwd, stripColors: true }); | ||
for (const expectedLine of expectedContents) { | ||
chain.wait(expectedLine); | ||
} | ||
await chain.runAsync(); | ||
}; | ||
|
||
export const statusForCategoryWithHelp = async (cwd: string, category: string, expectedContents: Array<string>): Promise<void> => { | ||
const chain = spawn(getCLIPath(), ['status', category, '-h'], { cwd, stripColors: true }); | ||
for (const expectedLine of expectedContents) { | ||
chain.wait(expectedLine); | ||
} | ||
await chain.runAsync(); | ||
}; |
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,33 @@ | ||
import { | ||
createNewProjectDir, | ||
initJSProjectWithProfile, | ||
deleteProject, | ||
deleteProjectDir, | ||
statusWithHelp, | ||
statusForCategoryWithHelp, | ||
addS3AndAuthWithAuthOnlyAccess, | ||
amplifyPushAuth, | ||
} from '@aws-amplify/amplify-e2e-core'; | ||
|
||
describe('help happy paths', () => { | ||
let projRoot: string; | ||
beforeAll(async () => { | ||
projRoot = await createNewProjectDir('help-happy-paths'); | ||
await initJSProjectWithProfile(projRoot, {}); | ||
await addS3AndAuthWithAuthOnlyAccess(projRoot); | ||
await amplifyPushAuth(projRoot); | ||
}); | ||
|
||
afterAll(async () => { | ||
await deleteProject(projRoot); | ||
deleteProjectDir(projRoot); | ||
}); | ||
|
||
test('amplify status', async () => { | ||
await statusWithHelp(projRoot, ['USAGE', 'amplify status [-v | --verbose]']); | ||
}); | ||
|
||
test('amplify status storage', async () => { | ||
await statusForCategoryWithHelp(projRoot, 'storage', ['USAGE', 'amplify storage status']); | ||
}); | ||
}); |