-
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.
[CORE-175] use getStorageCostEstimateV2 instead of v2 and getBucketUs…
…age (#5249)
- Loading branch information
1 parent
8040da1
commit 0f75d5d
Showing
12 changed files
with
62 additions
and
156 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
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ import { act } from '@testing-library/react'; | |
import { generateTestApp } from 'src/analysis/_testData/testData'; | ||
import { Apps, AppsAjaxContract } from 'src/libs/ajax/leonardo/Apps'; | ||
import { Runtimes, RuntimesAjaxContract } from 'src/libs/ajax/leonardo/Runtimes'; | ||
import { BucketUsageResponse, RawAccessEntry } from 'src/libs/ajax/workspaces/workspace-models'; | ||
import { RawAccessEntry, StorageCostEstimate } from 'src/libs/ajax/workspaces/workspace-models'; | ||
import { | ||
WorkspaceContract, | ||
Workspaces, | ||
|
@@ -73,12 +73,13 @@ describe('useDeleteWorkspaceState', () => { | |
|
||
const getAcl: WorkspaceContract['getAcl'] = jest.fn(); | ||
asMockedFn(getAcl).mockResolvedValue({ acl: { '[email protected]': partial<RawAccessEntry>({}) } }); | ||
const bucketUsage: WorkspaceContract['bucketUsage'] = jest.fn(); | ||
asMockedFn(bucketUsage).mockResolvedValue({ usageInBytes: 1234 }); | ||
|
||
const storageCostEstimateV2: WorkspaceContract['storageCostEstimateV2'] = jest.fn(); | ||
asMockedFn(storageCostEstimateV2).mockResolvedValue({ estimate: 0.02, usageInBytes: 1234 }); | ||
|
||
asMockedFn(Workspaces).mockReturnValue( | ||
partial<WorkspacesAjaxContract>({ | ||
workspace: () => partial<WorkspaceContract>({ getAcl, bucketUsage }), | ||
workspace: () => partial<WorkspaceContract>({ getAcl, storageCostEstimateV2 }), | ||
}) | ||
); | ||
asMockedFn(Apps).mockReturnValue(partial<AppsAjaxContract>({ listWithoutProject })); | ||
|
@@ -99,7 +100,7 @@ describe('useDeleteWorkspaceState', () => { | |
saturnWorkspaceName: googleWorkspace.workspace.name, | ||
}); | ||
expect(getAcl).toHaveBeenCalledTimes(1); | ||
expect(bucketUsage).toHaveBeenCalledTimes(1); | ||
expect(storageCostEstimateV2).toHaveBeenCalledTimes(1); | ||
}); | ||
|
||
it('can initialize state for an azure workspace', async () => { | ||
|
@@ -191,7 +192,7 @@ describe('useDeleteWorkspaceState', () => { | |
workspace: () => | ||
partial<WorkspaceContract>({ | ||
getAcl: async () => ({ acl: {} }), | ||
bucketUsage: async () => partial<BucketUsageResponse>({}), | ||
storageCostEstimateV2: async () => partial<StorageCostEstimate>({}), | ||
}), | ||
workspaceV2: () => | ||
partial<WorkspaceV2Contract>({ | ||
|
@@ -227,7 +228,7 @@ describe('useDeleteWorkspaceState', () => { | |
workspace: () => | ||
partial<WorkspaceContract>({ | ||
getAcl: async () => ({ acl: {} }), | ||
bucketUsage: async () => partial<BucketUsageResponse>({}), | ||
storageCostEstimateV2: async () => partial<StorageCostEstimate>({}), | ||
}), | ||
workspaceV2: () => | ||
partial<WorkspaceV2Contract>({ | ||
|
@@ -263,7 +264,7 @@ describe('useDeleteWorkspaceState', () => { | |
workspace: () => | ||
partial<WorkspaceContract>({ | ||
getAcl: async () => ({ acl: {} }), | ||
bucketUsage: async () => { | ||
storageCostEstimateV2: async () => { | ||
throw new Error('no project!'); | ||
}, | ||
}), | ||
|
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
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
Oops, something went wrong.