@@ -2,61 +2,69 @@ import { describe, test } from "vitest"
22import {
33 BITBUCKET_SERVER_TEST_PROJECT_KEY ,
44 BITBUCKET_SERVER_TEST_PROJECT_NAME ,
5+ SKIP_BITBUCKET_SERVER ,
56} from "../env.ts"
67import { client } from "./client.ts"
78
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"
1317
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+ )
1926
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 )
2229
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 ( {
2551 slug,
2652 name,
2753 project : { key : projectKey , name : projectName } ,
2854 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+ } )
4856 } )
49- } )
5057
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+ )
5663
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 )
5966
60- expect ( deleted . response . status ) . toBe ( 202 )
61- } )
62- } )
67+ expect ( deleted . response . status ) . toBe ( 202 )
68+ } )
69+ } ,
70+ )
0 commit comments