-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(misc): only create one commit with cloud onboard URL on cnw
- Loading branch information
Showing
4 changed files
with
98 additions
and
52 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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { extractConnectUrl } from './create-workspace'; | ||
|
||
describe('extractConnectUrl', () => { | ||
test('should extract the correct URL from the given string', () => { | ||
const inputString = ` | ||
NX Your Nx Cloud workspace is ready. | ||
To claim it, connect it to your Nx Cloud account: | ||
- Push your repository to your git hosting provider. | ||
- Go to the following URL to connect your workspace to Nx Cloud: | ||
https://staging.nx.app/connect/O8dfB0jYgvd | ||
`; | ||
const expectedUrl = 'https://staging.nx.app/connect/O8dfB0jYgvd'; | ||
expect(extractConnectUrl(inputString)).toBe(expectedUrl); | ||
}); | ||
|
||
test('should return null if no URL is present', () => { | ||
const inputString = ` | ||
NX Your Nx Cloud workspace is ready. | ||
To claim it, connect it to your Nx Cloud account: | ||
- Push your repository to your git hosting provider. | ||
- Go to the following URL to connect your workspace to Nx Cloud: | ||
No URL here. | ||
`; | ||
expect(extractConnectUrl(inputString)).toBeNull(); | ||
}); | ||
|
||
test('should handle URLs with different domains and paths', () => { | ||
const inputString = ` | ||
NX Your Nx Cloud workspace is ready. | ||
To claim it, connect it to your Nx Cloud account: | ||
- Push your repository to your git hosting provider. | ||
- Go to the following URL to connect your workspace to Nx Cloud: | ||
https://example.com/connect/abcd1234 | ||
`; | ||
const expectedUrl = 'https://example.com/connect/abcd1234'; | ||
expect(extractConnectUrl(inputString)).toBe(expectedUrl); | ||
}); | ||
|
||
test('should handle URLs with query parameters and fragments', () => { | ||
const inputString = ` | ||
NX Your Nx Cloud workspace is ready. | ||
To claim it, connect it to your Nx Cloud account: | ||
- Push your repository to your git hosting provider. | ||
- Go to the following URL to connect your workspace to Nx Cloud: | ||
https://example.com/connect/abcd1234?query=param#fragment | ||
`; | ||
const expectedUrl = | ||
'https://example.com/connect/abcd1234?query=param#fragment'; | ||
expect(extractConnectUrl(inputString)).toBe(expectedUrl); | ||
}); | ||
}); |
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