-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(environment-logs): add new version (#1726)
- Loading branch information
1 parent
5ff1a84
commit 3874d32
Showing
99 changed files
with
2,741 additions
and
984 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"presets": [ | ||
[ | ||
"@nx/react/babel", | ||
{ | ||
"runtime": "automatic", | ||
"useBuiltIns": "usage" | ||
} | ||
] | ||
], | ||
"plugins": [] | ||
} |
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,18 @@ | ||
{ | ||
"extends": ["plugin:@nx/react", "../../../../.eslintrc.json"], | ||
"ignorePatterns": ["!**/*"], | ||
"overrides": [ | ||
{ | ||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.ts", "*.tsx"], | ||
"rules": {} | ||
}, | ||
{ | ||
"files": ["*.js", "*.jsx"], | ||
"rules": {} | ||
} | ||
] | ||
} |
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,7 @@ | ||
# feature | ||
|
||
This library was generated with [Nx](https://nx.dev). | ||
|
||
## Running unit tests | ||
|
||
Run `nx test feature` to execute the unit tests via [Jest](https://jestjs.io). |
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,11 @@ | ||
/* eslint-disable */ | ||
export default { | ||
displayName: 'feature', | ||
preset: '../../../../jest.preset.js', | ||
transform: { | ||
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest', | ||
'^.+\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }], | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], | ||
coverageDirectory: '../../../../coverage/libs/domains/environment-logs/feature', | ||
} |
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,9 @@ | ||
{ | ||
"name": "feature", | ||
"$schema": "../../../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "libs/domains/environment-logs/feature/src", | ||
"projectType": "library", | ||
"tags": [], | ||
"// targets": "to see all targets run: nx show project feature --web", | ||
"targets": {} | ||
} |
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,2 @@ | ||
export * from './lib/environment-stages/environment-stages' | ||
export * from './lib/list-pre-check-logs/list-pre-check-logs' |
60 changes: 60 additions & 0 deletions
60
libs/domains/environment-logs/feature/src/lib/environment-stages/environment-stages.spec.tsx
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,60 @@ | ||
import { ENVIRONMENT_LOGS_URL, ENVIRONMENT_PRE_CHECK_LOGS_URL } from '@qovery/shared/routes' | ||
import { renderWithProviders, screen } from '@qovery/shared/util-tests' | ||
import { EnvironmentStages, type EnvironmentStagesProps } from './environment-stages' | ||
|
||
describe('EnvironmentStages', () => { | ||
const defaultProps: EnvironmentStagesProps = { | ||
environment: { | ||
id: 'env-1', | ||
name: 'Test Environment', | ||
organization: { id: 'org-1' }, | ||
project: { id: 'proj-1' }, | ||
cloud_provider: { | ||
provider: 'AWS', | ||
}, | ||
}, | ||
environmentStatus: { | ||
state: 'RUNNING', | ||
}, | ||
hideSkipped: false, | ||
setHideSkipped: jest.fn(), | ||
deploymentStages: [], | ||
preCheckStage: { | ||
status: 'SUCCESS', | ||
total_duration_sec: 120, | ||
}, | ||
} | ||
|
||
it('renders loading spinner when deploymentStages is undefined', () => { | ||
renderWithProviders(<EnvironmentStages {...defaultProps} deploymentStages={undefined} />) | ||
expect(screen.getByTestId('spinner')).toBeInTheDocument() | ||
}) | ||
|
||
it('renders pre-check stage when preCheckStage is provided', () => { | ||
renderWithProviders(<EnvironmentStages {...defaultProps} />) | ||
expect(screen.getByText('Pre-check')).toBeInTheDocument() | ||
}) | ||
|
||
it('renders children when deploymentStages is provided', () => { | ||
renderWithProviders( | ||
<EnvironmentStages {...defaultProps}> | ||
<div data-testid="child-content">Child Content</div> | ||
</EnvironmentStages> | ||
) | ||
expect(screen.getByTestId('child-content')).toBeInTheDocument() | ||
}) | ||
|
||
it('renders the "Hide skipped" checkbox', () => { | ||
renderWithProviders(<EnvironmentStages {...defaultProps} />) | ||
expect(screen.getByLabelText('Hide skipped')).toBeInTheDocument() | ||
}) | ||
|
||
it('renders the correct link for pre-check logs', () => { | ||
renderWithProviders(<EnvironmentStages {...defaultProps} />) | ||
const logLink = screen.getByText('Pre-check logs').closest('a') | ||
expect(logLink).toHaveAttribute( | ||
'href', | ||
ENVIRONMENT_LOGS_URL('org-1', 'proj-1', 'env-1') + ENVIRONMENT_PRE_CHECK_LOGS_URL() | ||
) | ||
}) | ||
}) |
Oops, something went wrong.