Skip to content

Commit 4e06c8d

Browse files
committed
test: adjust test to match schema and tighten schema slightly
1 parent 1eee9db commit 4e06c8d

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

config.schema.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,12 @@
2727
"https://somedomain.com/some/path/checkUserGroups?domain=<domain>&name=<name>&id=<id>"
2828
]
2929
}
30-
}
30+
},
31+
"additionalProperties": false
3132
},
3233
"github": {
3334
"type": "object",
35+
"description": "Deprecated: Defunct property that was used to provide the API URL for GitHub. No longer referenced in the codebase.",
3436
"properties": {
3537
"baseUrl": {
3638
"type": "string",
@@ -41,7 +43,8 @@
4143
},
4244
"additionalProperties": false
4345
}
44-
}
46+
},
47+
"additionalProperties": false
4548
},
4649
"commitConfig": {
4750
"description": "Enforce rules and patterns on commits including e-mail and message",

src/config/generated/config.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,23 @@ export interface GitProxyConfig {
108108
* Third party APIs
109109
*/
110110
export interface API {
111+
/**
112+
* Deprecated: Defunct property that was used to provide the API URL for GitHub. No longer
113+
* referenced in the codebase.
114+
*/
111115
github?: Github;
112116
/**
113117
* Configuration used in conjunction with ActiveDirectory auth, which relates to a REST API
114118
* used to check user group membership, as opposed to direct querying via LDAP.<br />If this
115119
* configuration is set direct querying of group membership via LDAP will be disabled.
116120
*/
117121
ls?: Ls;
118-
[property: string]: any;
119122
}
120123

124+
/**
125+
* Deprecated: Defunct property that was used to provide the API URL for GitHub. No longer
126+
* referenced in the codebase.
127+
*/
121128
export interface Github {
122129
baseUrl?: string;
123130
}
@@ -138,7 +145,6 @@ export interface Ls {
138145
* membership of.</li><li>"&lt;id&gt;": The username to check group membership for.</li></ul>
139146
*/
140147
userInADGroup?: string;
141-
[property: string]: any;
142148
}
143149

144150
/**
@@ -531,10 +537,10 @@ const typeMap: any = {
531537
{ json: 'github', js: 'github', typ: u(undefined, r('Github')) },
532538
{ json: 'ls', js: 'ls', typ: u(undefined, r('Ls')) },
533539
],
534-
'any',
540+
false,
535541
),
536542
Github: o([{ json: 'baseUrl', js: 'baseUrl', typ: u(undefined, '') }], false),
537-
Ls: o([{ json: 'userInADGroup', js: 'userInADGroup', typ: u(undefined, '') }], 'any'),
543+
Ls: o([{ json: 'userInADGroup', js: 'userInADGroup', typ: u(undefined, '') }], false),
538544
Authentication: o(
539545
[
540546
{ json: 'enabled', js: 'enabled', typ: true },

test/generated-config.test.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const chai = require('chai');
22
const { Convert } = require('../src/config/generated/config');
33
const defaultSettings = require('../proxy.config.json');
4+
const { isUserInAdGroup } = require('../src/service/passport/ldaphelper');
45

56
const { expect } = chai;
67

@@ -207,11 +208,12 @@ describe('Generated Config (QuickType)', () => {
207208
sink: [{ type: 'fs', params: { filepath: './.' }, enabled: true }],
208209

209210
api: {
211+
ls: {
212+
userInADGroup:
213+
'https://somedomain.com/some/path/checkUserGroups?domain=<domain>&name=<name>&id=<id>',
214+
},
210215
github: {
211216
baseUrl: 'https://api.github.com',
212-
token: 'secret-token',
213-
rateLimit: 100,
214-
enabled: true,
215217
},
216218
},
217219

0 commit comments

Comments
 (0)