11import { CREDENTIALS , PACKAGE , WRONG_CREDENTIALS } from '../config.functional' ;
22import { HTTP_STATUS } from '../../lib/constants' ;
3+ import fixturePkg from '../fixtures/package' ;
34
45export default ( server : any , gitlab : any ) => {
56 describe ( 'package publish tests' , ( ) => {
@@ -10,7 +11,7 @@ export default (server: any, gitlab: any) => {
1011 test ( 'should deny publish of package when unauthenticated' , ( ) => {
1112 return server . auth ( WRONG_CREDENTIALS . user , CREDENTIALS . password ) . then ( ( ) => {
1213 return server
13- . putPackage ( PACKAGE . NAME , require ( '../fixtures/package' ) ( PACKAGE . NAME ) )
14+ . putPackage ( PACKAGE . NAME , fixturePkg ( PACKAGE . NAME ) )
1415 . status ( HTTP_STATUS . FORBIDDEN )
1516 . then ( body => {
1617 expect ( body ) . toHaveProperty ( 'error' ) ;
@@ -20,7 +21,7 @@ export default (server: any, gitlab: any) => {
2021
2122 test ( 'should allow publish of package when gitlab groups match' , ( ) => {
2223 return server
23- . putPackage ( PACKAGE . GROUP_NAME , require ( '../fixtures/package' ) ( PACKAGE . GROUP_NAME ) )
24+ . putPackage ( PACKAGE . GROUP_NAME , fixturePkg ( PACKAGE . GROUP_NAME ) )
2425 . status ( HTTP_STATUS . CREATED )
2526 . body_ok ( / c r e a t e d n e w p a c k a g e / )
2627 . then ( body => {
@@ -33,7 +34,7 @@ export default (server: any, gitlab: any) => {
3334
3435 test ( 'should allow publish of scoped package when gitlab groups match' , ( ) => {
3536 return server
36- . putPackage ( PACKAGE . SCOPED_GROUP_NAME , require ( '../fixtures/package' ) ( PACKAGE . SCOPED_GROUP_NAME ) )
37+ . putPackage ( PACKAGE . SCOPED_GROUP_NAME , fixturePkg ( PACKAGE . SCOPED_GROUP_NAME ) )
3738 . status ( HTTP_STATUS . CREATED )
3839 . body_ok ( / c r e a t e d n e w p a c k a g e / )
3940 . then ( body => {
@@ -46,7 +47,7 @@ export default (server: any, gitlab: any) => {
4647
4748 test ( 'should allow publish of scoped package when gitlab projects match' , ( ) => {
4849 return server
49- . putPackage ( PACKAGE . SCOPED_PROJECT_NAME , require ( '../fixtures/package' ) ( PACKAGE . SCOPED_PROJECT_NAME ) )
50+ . putPackage ( PACKAGE . SCOPED_PROJECT_NAME , fixturePkg ( PACKAGE . SCOPED_PROJECT_NAME ) )
5051 . status ( HTTP_STATUS . CREATED )
5152 . body_ok ( / c r e a t e d n e w p a c k a g e / )
5253 . then ( body => {
0 commit comments