-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(manager-pci-common): add containers test
ref: DTCORE-2868 Signed-off-by: Florian Renaut <[email protected]>
- Loading branch information
Showing
2 changed files
with
56 additions
and
1 deletion.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
packages/manager/apps/pci-object-storage/src/api/data/container.spec.ts
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,56 @@ | ||
import { describe, it, expect, vi } from 'vitest'; | ||
import { v6 } from '@ovh-ux/manager-core-api'; | ||
import { getServerContainer, TServerContainer } from './container'; | ||
|
||
describe('getServerContainer', () => { | ||
const mockContainer: TServerContainer = { | ||
createdAt: '2023-01-01T00:00:00Z', | ||
encryption: { sseAlgorithm: 'AES256' }, | ||
id: 'containerId', | ||
name: 'containerName', | ||
objects: [], | ||
objectsCount: 0, | ||
objectsSize: 0, | ||
ownerId: 123, | ||
region: 'region', | ||
s3StorageType: 'STANDARD', | ||
storedBytes: 0, | ||
storedObjects: 0, | ||
versioning: { status: 'enabled' }, | ||
virtualHost: 'virtualHost', | ||
staticUrl: 'staticUrl', | ||
replication: { rules: [{ status: 'enabled' }] }, | ||
}; | ||
|
||
it('should get server container by id', async () => { | ||
vi.mocked(v6.get).mockResolvedValue({ data: mockContainer }); | ||
|
||
const result = await getServerContainer( | ||
'projectId', | ||
'region', | ||
'name', | ||
'containerId', | ||
); | ||
|
||
expect(v6.get).toHaveBeenCalledWith( | ||
'/cloud/project/projectId/storage/containerId', | ||
); | ||
expect(result).toEqual(mockContainer); | ||
}); | ||
|
||
it('should get server container by name and region', async () => { | ||
vi.mocked(v6.get).mockResolvedValue({ data: mockContainer }); | ||
|
||
const result = await getServerContainer( | ||
'projectId', | ||
'region', | ||
'containerName', | ||
'', | ||
); | ||
|
||
expect(v6.get).toHaveBeenCalledWith( | ||
'/cloud/project/projectId/region/region/storage/containerName', | ||
); | ||
expect(result).toEqual(mockContainer); | ||
}); | ||
}); |
1 change: 0 additions & 1 deletion
1
packages/manager/apps/pci-object-storage/src/components/FileInput.component.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