-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: improved the coverage of the githubComponent
Signed-off-by: Abinand P <[email protected]>
- Loading branch information
1 parent
f7560d6
commit acc865b
Showing
2 changed files
with
77 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -385,4 +385,81 @@ describe('GiHub Complete Flow', () => { | |
const frameString = lastFrame()?.toString() ?? ''; | ||
expect(frameString).toMatch(/GitOps Configuration Wizard - GitHub/); | ||
}); | ||
it('should display Error message for invalid status of the repo', async () => { | ||
(configurePermit as any).mockResolvedValueOnce({ | ||
id: '1', | ||
status: 'invalid', | ||
key: 'repo3', | ||
}); | ||
const { stdin, lastFrame } = render( | ||
<GitHub options={{ key: demoPermitKey }} />, | ||
); | ||
const frameString = lastFrame()?.toString() ?? ''; | ||
expect(frameString).toMatch(/Loading Token/); | ||
await delay(50); | ||
expect(lastFrame()?.toString()).toMatch( | ||
/GitOps Configuration Wizard - GitHub/, | ||
); | ||
await delay(50); | ||
stdin.write(arrowDown); | ||
await delay(50); | ||
stdin.write(enter); | ||
await delay(50); | ||
expect(lastFrame()?.toString()).toMatch(/Enter Your RepositoryKey :/); | ||
await delay(50); | ||
stdin.write('repo3'); | ||
await delay(50); | ||
stdin.write(enter); | ||
await delay(50); | ||
expect(lastFrame()?.toString()).toMatch(/SSH Key Generated./); | ||
await delay(50); | ||
stdin.write('[email protected]:user/repository.git'); | ||
await delay(50); | ||
stdin.write(enter); | ||
expect(lastFrame()?.toString()).toMatch(/Enter the Branch Name:/); | ||
await delay(50); | ||
stdin.write('main'); | ||
await delay(50); | ||
stdin.write(enter); | ||
await delay(50); | ||
expect(lastFrame()?.toString()).toMatch( | ||
'Invalid configuration. Please check the configuration and try again.', | ||
); | ||
}); | ||
it('should work with inactive argument', async () => { | ||
const { stdin, lastFrame } = render( | ||
<GitHub options={{ key: demoPermitKey, inactive: true }} />, | ||
); | ||
const frameString = lastFrame()?.toString() ?? ''; | ||
expect(frameString).toMatch(/Loading Token/); | ||
await delay(100); | ||
expect(lastFrame()?.toString()).toMatch( | ||
/GitOps Configuration Wizard - GitHub/, | ||
); | ||
await delay(50); | ||
stdin.write(arrowDown); | ||
await delay(50); | ||
stdin.write(enter); | ||
await delay(50); | ||
expect(lastFrame()?.toString()).toMatch(/Enter Your RepositoryKey :/); | ||
await delay(50); | ||
stdin.write('repo3'); | ||
await delay(50); | ||
stdin.write(enter); | ||
await delay(50); | ||
expect(lastFrame()?.toString()).toMatch(/SSH Key Generated./); | ||
await delay(50); | ||
stdin.write('[email protected]:user/repository.git'); | ||
await delay(50); | ||
stdin.write(enter); | ||
expect(lastFrame()?.toString()).toMatch(/Enter the Branch Name:/); | ||
await delay(50); | ||
stdin.write('main'); | ||
await delay(50); | ||
stdin.write(enter); | ||
await delay(50); | ||
expect(lastFrame()?.toString()).toMatch( | ||
/Your GitOps is configured succesffuly. To complete the setup, remember to activate it later/, | ||
); | ||
}); | ||
}); |
Empty file.