@@ -2,61 +2,69 @@ import { describe, test } from "vitest"
2
2
import {
3
3
BITBUCKET_SERVER_TEST_PROJECT_KEY ,
4
4
BITBUCKET_SERVER_TEST_PROJECT_NAME ,
5
+ SKIP_BITBUCKET_SERVER ,
5
6
} from "../env.ts"
6
7
import { client } from "./client.ts"
7
8
8
- describe ( "Repositories" , { concurrent : false , sequential : true } , ( ) => {
9
- const projectKey = BITBUCKET_SERVER_TEST_PROJECT_KEY
10
- const projectName = BITBUCKET_SERVER_TEST_PROJECT_NAME
11
- const slug = "test-repository"
12
- const name = "Test Repository"
9
+ describe . skipIf ( SKIP_BITBUCKET_SERVER ) (
10
+ "Repositories" ,
11
+ { concurrent : false , sequential : true } ,
12
+ ( ) => {
13
+ const projectKey = BITBUCKET_SERVER_TEST_PROJECT_KEY
14
+ const projectName = BITBUCKET_SERVER_TEST_PROJECT_NAME
15
+ const slug = "test-repository"
16
+ const name = "Test Repository"
13
17
14
- test ( "Create repository" , async ( { expect } ) => {
15
- const created = await client . POST (
16
- "/api/latest/projects/{projectKey}/repos" ,
17
- { params : { path : { projectKey } } , body : { name, scmId : "git" , slug } } ,
18
- )
18
+ test ( "Create repository" , async ( { expect } ) => {
19
+ const created = await client . POST (
20
+ "/api/latest/projects/{projectKey}/repos" ,
21
+ {
22
+ params : { path : { projectKey } } ,
23
+ body : { name, scmId : "git" , slug } ,
24
+ } ,
25
+ )
19
26
20
- if ( created . error )
21
- console . error ( "Failed to create a repository" , created . error )
27
+ if ( created . error )
28
+ console . error ( "Failed to create a repository" , created . error )
22
29
23
- expect ( created ) . toMatchObject ( {
24
- data : {
30
+ expect ( created ) . toMatchObject ( {
31
+ data : {
32
+ slug,
33
+ name,
34
+ project : { key : projectKey , name : projectName } ,
35
+ scmId : "git" ,
36
+ } ,
37
+ response : { status : 201 } ,
38
+ } )
39
+ } )
40
+
41
+ test ( "Get a repository" , async ( { expect } ) => {
42
+ const repository = await client . GET (
43
+ "/api/latest/projects/{projectKey}/repos/{repositorySlug}" ,
44
+ { params : { path : { projectKey, repositorySlug : slug } } } ,
45
+ )
46
+
47
+ if ( repository . error )
48
+ console . error ( "Failed to get a repository" , repository . error )
49
+
50
+ expect ( repository . data ) . toMatchObject ( {
25
51
slug,
26
52
name,
27
53
project : { key : projectKey , name : projectName } ,
28
54
scmId : "git" ,
29
- } ,
30
- response : { status : 201 } ,
31
- } )
32
- } )
33
-
34
- test ( "Get a repository" , async ( { expect } ) => {
35
- const repository = await client . GET (
36
- "/api/latest/projects/{projectKey}/repos/{repositorySlug}" ,
37
- { params : { path : { projectKey, repositorySlug : slug } } } ,
38
- )
39
-
40
- if ( repository . error )
41
- console . error ( "Failed to get a repository" , repository . error )
42
-
43
- expect ( repository . data ) . toMatchObject ( {
44
- slug,
45
- name,
46
- project : { key : projectKey , name : projectName } ,
47
- scmId : "git" ,
55
+ } )
48
56
} )
49
- } )
50
57
51
- test ( "Delete a repository" , async ( { expect } ) => {
52
- const deleted = await client . DELETE (
53
- "/api/latest/projects/{projectKey}/repos/{repositorySlug}" ,
54
- { params : { path : { projectKey, repositorySlug : slug } } } ,
55
- )
58
+ test ( "Delete a repository" , async ( { expect } ) => {
59
+ const deleted = await client . DELETE (
60
+ "/api/latest/projects/{projectKey}/repos/{repositorySlug}" ,
61
+ { params : { path : { projectKey, repositorySlug : slug } } } ,
62
+ )
56
63
57
- if ( deleted . error )
58
- console . error ( "Failed to delete a repository" , deleted . error )
64
+ if ( deleted . error )
65
+ console . error ( "Failed to delete a repository" , deleted . error )
59
66
60
- expect ( deleted . response . status ) . toBe ( 202 )
61
- } )
62
- } )
67
+ expect ( deleted . response . status ) . toBe ( 202 )
68
+ } )
69
+ } ,
70
+ )
0 commit comments