Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-09 00:15:10 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-09 00:15:10 +0300
commit7db94a9807df03ce7a4f210b513816a47f34e15b (patch)
treea20574d4297ba13e3340bfae217e3035e77d6423 /spec/frontend/ci/artifacts/components
parent3a563d7c1e15023f205d2a357e5d8a38a3b53ecc (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/ci/artifacts/components')
-rw-r--r--spec/frontend/ci/artifacts/components/app_spec.js67
1 files changed, 38 insertions, 29 deletions
diff --git a/spec/frontend/ci/artifacts/components/app_spec.js b/spec/frontend/ci/artifacts/components/app_spec.js
index 435b03e82ab..c6874428e2a 100644
--- a/spec/frontend/ci/artifacts/components/app_spec.js
+++ b/spec/frontend/ci/artifacts/components/app_spec.js
@@ -14,15 +14,20 @@ const TEST_BUILD_ARTIFACTS_SIZE = 1024;
const TEST_PROJECT_PATH = 'project/path';
const TEST_PROJECT_ID = 'gid://gitlab/Project/22';
-const createBuildArtifactsSizeResponse = (buildArtifactsSize) => ({
+const createBuildArtifactsSizeResponse = ({
+ buildArtifactsSize = TEST_BUILD_ARTIFACTS_SIZE,
+ nullStatistics = false,
+}) => ({
data: {
project: {
__typename: 'Project',
id: TEST_PROJECT_ID,
- statistics: {
- __typename: 'ProjectStatistics',
- buildArtifactsSize,
- },
+ statistics: nullStatistics
+ ? null
+ : {
+ __typename: 'ProjectStatistics',
+ buildArtifactsSize,
+ },
},
},
});
@@ -82,28 +87,32 @@ describe('ArtifactsApp component', () => {
});
describe.each`
- buildArtifactsSize | expectedText
- ${TEST_BUILD_ARTIFACTS_SIZE} | ${numberToHumanSize(TEST_BUILD_ARTIFACTS_SIZE)}
- ${null} | ${SIZE_UNKNOWN}
- `('when buildArtifactsSize is $buildArtifactsSize', ({ buildArtifactsSize, expectedText }) => {
- beforeEach(async () => {
- getBuildArtifactsSizeSpy.mockResolvedValue(
- createBuildArtifactsSizeResponse(buildArtifactsSize),
- );
-
- createComponent();
-
- await waitForPromises();
- });
-
- it('hides loader', () => {
- expect(findSkeletonLoader().exists()).toBe(false);
- });
-
- it('shows the size', () => {
- expect(findBuildArtifactsSize().text()).toMatchInterpolatedText(
- `${TOTAL_ARTIFACTS_SIZE} ${expectedText}`,
- );
- });
- });
+ buildArtifactsSize | nullStatistics | expectedText
+ ${TEST_BUILD_ARTIFACTS_SIZE} | ${false} | ${numberToHumanSize(TEST_BUILD_ARTIFACTS_SIZE)}
+ ${null} | ${false} | ${SIZE_UNKNOWN}
+ ${null} | ${true} | ${SIZE_UNKNOWN}
+ `(
+ 'when buildArtifactsSize is $buildArtifactsSize',
+ ({ buildArtifactsSize, nullStatistics, expectedText }) => {
+ beforeEach(async () => {
+ getBuildArtifactsSizeSpy.mockResolvedValue(
+ createBuildArtifactsSizeResponse({ buildArtifactsSize, nullStatistics }),
+ );
+
+ createComponent();
+
+ await waitForPromises();
+ });
+
+ it('hides loader', () => {
+ expect(findSkeletonLoader().exists()).toBe(false);
+ });
+
+ it('shows the size', () => {
+ expect(findBuildArtifactsSize().text()).toMatchInterpolatedText(
+ `${TOTAL_ARTIFACTS_SIZE} ${expectedText}`,
+ );
+ });
+ },
+ );
});