@@ -8,7 +8,7 @@ import "reflect-metadata";
8
8
9
9
import { suite , test } from "@testdeck/mocha" ;
10
10
import * as chai from "chai" ;
11
- import { EnvVarService } from "./env-var-service " ;
11
+ import { EnvVarResolver } from "./env-var-resolver " ;
12
12
import {
13
13
CommitContext ,
14
14
EnvVarWithValue ,
@@ -79,22 +79,22 @@ const contextEnvVars = {
79
79
} as WithEnvvarsContext ;
80
80
81
81
@suite
82
- class TestEnvVarService {
83
- protected envVarService : EnvVarService ;
82
+ class TestEnvVarResolver {
83
+ protected envVarResolver : EnvVarResolver ;
84
84
85
85
protected init ( userEnvVars : UserEnvVar [ ] , projectEnvVar : ProjectEnvVarWithValue [ ] ) {
86
- this . envVarService = new EnvVarService ( ) ;
87
- this . envVarService [ "userDB" ] = {
86
+ this . envVarResolver = new EnvVarResolver ( ) ;
87
+ this . envVarResolver [ "userDB" ] = {
88
88
getEnvVars : ( _ ) => {
89
89
return Promise . resolve ( userEnvVars ) ;
90
90
} ,
91
91
} as UserDB ;
92
- this . envVarService [ "projectsService" ] = {
92
+ this . envVarResolver [ "projectsService" ] = {
93
93
getProjectEnvironmentVariables : ( userId : string , projectId : string ) => {
94
94
return Promise . resolve ( projectEnvVar as ProjectEnvVar [ ] ) ;
95
95
} ,
96
96
} as ProjectsService ;
97
- this . envVarService [ "projectDB" ] = {
97
+ this . envVarResolver [ "projectDB" ] = {
98
98
getProjectEnvironmentVariableValues : ( envs ) => {
99
99
return Promise . resolve ( envs as ProjectEnvVarWithValue [ ] ) ;
100
100
} ,
@@ -111,7 +111,7 @@ class TestEnvVarService {
111
111
[ fooAnyUserEnvVar , barUserCommitEnvVar , barUserAnotherCommitEnvVar ] ,
112
112
[ barProjectCensoredEnvVar , bazProjectEnvVar ] ,
113
113
) ;
114
- const envVars = await this . envVarService . resolve ( {
114
+ const envVars = await this . envVarResolver . resolve ( {
115
115
ownerId : "1" ,
116
116
type : "regular" ,
117
117
context : commitContext ,
@@ -128,7 +128,7 @@ class TestEnvVarService {
128
128
[ fooAnyUserEnvVar , barUserCommitEnvVar , barUserAnotherCommitEnvVar ] ,
129
129
[ barProjectCensoredEnvVar , bazProjectEnvVar ] ,
130
130
) ;
131
- const envVars = await this . envVarService . resolve ( {
131
+ const envVars = await this . envVarResolver . resolve ( {
132
132
ownerId : "1" ,
133
133
type : "prebuild" ,
134
134
context : commitContext ,
@@ -145,7 +145,7 @@ class TestEnvVarService {
145
145
[ fooAnyUserEnvVar , barUserCommitEnvVar , barUserAnotherCommitEnvVar ] ,
146
146
[ barProjectCensoredEnvVar , bazProjectEnvVar ] ,
147
147
) ;
148
- const envVars = await this . envVarService . resolve ( {
148
+ const envVars = await this . envVarResolver . resolve ( {
149
149
ownerId : "1" ,
150
150
type : "regular" ,
151
151
context : commitContext ,
@@ -163,7 +163,7 @@ class TestEnvVarService {
163
163
[ fooAnyUserEnvVar , barUserCommitEnvVar , barUserAnotherCommitEnvVar ] ,
164
164
[ barProjectCensoredEnvVar , bazProjectEnvVar ] ,
165
165
) ;
166
- const envVars = await this . envVarService . resolve ( {
166
+ const envVars = await this . envVarResolver . resolve ( {
167
167
type : "prebuild" ,
168
168
context : commitContext ,
169
169
projectId : "1" ,
@@ -188,7 +188,7 @@ class TestEnvVarService {
188
188
189
189
this . init ( userEnvVars , [ ] ) ;
190
190
191
- const envVars = await this . envVarService . resolve ( {
191
+ const envVars = await this . envVarResolver . resolve ( {
192
192
ownerId : "1" ,
193
193
type : "regular" ,
194
194
context : commitContext ,
@@ -206,7 +206,7 @@ class TestEnvVarService {
206
206
[ fooAnyUserEnvVar , barUserCommitEnvVar , barUserAnotherCommitEnvVar ] ,
207
207
[ barProjectCensoredEnvVar , bazProjectEnvVar ] ,
208
208
) ;
209
- const envVars = await this . envVarService . resolve ( {
209
+ const envVars = await this . envVarResolver . resolve ( {
210
210
owerId : "1" ,
211
211
type : "regular" ,
212
212
context : { ...commitContext , ...contextEnvVars } ,
@@ -223,7 +223,7 @@ class TestEnvVarService {
223
223
[ fooAnyUserEnvVar , barUserCommitEnvVar , barUserAnotherCommitEnvVar ] ,
224
224
[ barProjectCensoredEnvVar , bazProjectEnvVar ] ,
225
225
) ;
226
- const envVars = await this . envVarService . resolve ( {
226
+ const envVars = await this . envVarResolver . resolve ( {
227
227
owerId : "1" ,
228
228
type : "regular" ,
229
229
context : { ...commitContext , ...contextEnvVars } ,
@@ -274,7 +274,7 @@ class TestEnvVarService {
274
274
const expectedVars = [ inputVars [ 0 ] ] ;
275
275
276
276
this . init ( inputVars , [ ] ) ;
277
- const envVars = await this . envVarService . resolve ( {
277
+ const envVars = await this . envVarResolver . resolve ( {
278
278
owerId : "1" ,
279
279
type : "regular" ,
280
280
context : { ...commitContext } ,
@@ -352,7 +352,7 @@ class TestEnvVarService {
352
352
353
353
this . init ( userEnvVars , [ ] ) ;
354
354
355
- const envVars = await this . envVarService . resolve ( {
355
+ const envVars = await this . envVarResolver . resolve ( {
356
356
owerId : "1" ,
357
357
type : "regular" ,
358
358
context : { ...gitlabSubgroupCommitContext } ,
@@ -365,4 +365,4 @@ class TestEnvVarService {
365
365
}
366
366
}
367
367
368
- module . exports = new TestEnvVarService ( ) ;
368
+ module . exports = new TestEnvVarResolver ( ) ;
0 commit comments