11import test from 'node:test' ;
22import assert from 'node:assert' ;
3- import { getAxiosInstance , getConfig } from './helpers.js' ;
3+ import { getAxiosInstance } from './helpers.js' ;
44import dotenv from 'dotenv' ;
55import Ajv from 'ajv' ;
66
@@ -59,7 +59,7 @@ function runTests(groupSchema, groupSchemaExtensions = [], configuration) {
5959 } ) ;
6060
6161 test ( 'Retrieves a list of groups' , async ( t ) => {
62- const testAxios = getAxiosInstance ( getConfig ( ) , t ) ;
62+ const testAxios = getAxiosInstance ( configuration , t ) ;
6363 const response = await testAxios . get ( '/Groups' ) ;
6464 assert . strictEqual ( response . status , 200 , 'GET /Groups should return status code 200' ) ;
6565 assert . strictEqual ( response . data . schemas [ 0 ] , 'urn:ietf:params:scim:api:messages:2.0:ListResponse' , 'Response should contain the correct schema' ) ;
@@ -77,7 +77,7 @@ function runTests(groupSchema, groupSchemaExtensions = [], configuration) {
7777 } ) ;
7878
7979 test ( 'Retrieves a single group' , async ( t ) => {
80- const testAxios = getAxiosInstance ( getConfig ( ) , t ) ;
80+ const testAxios = getAxiosInstance ( configuration , t ) ;
8181 if ( ! sharedState . groups || sharedState . groups . length === 0 ) {
8282 t . skip ( 'Previous test failed or no groups found in shared state' ) ;
8383 return ;
@@ -96,14 +96,14 @@ function runTests(groupSchema, groupSchemaExtensions = [], configuration) {
9696 } ) ;
9797
9898 test ( 'Handles retrieval of a non-existing group' , async ( t ) => {
99- const testAxios = getAxiosInstance ( getConfig ( ) , t ) ;
99+ const testAxios = getAxiosInstance ( configuration , t ) ;
100100 const response = await testAxios . get ( '/Groups/9876543210123456' ) ;
101101 assert . strictEqual ( response . status , 404 , 'A non-existing group should return 404' ) ;
102102 assert . strictEqual ( response . data . schemas [ 0 ] , 'urn:ietf:params:scim:api:messages:2.0:Error' , 'Error response should contain the correct error schema' ) ;
103103 } ) ;
104104
105105 test ( 'Paginates groups using startIndex' , async ( t ) => {
106- const testAxios = getAxiosInstance ( getConfig ( ) , t ) ;
106+ const testAxios = getAxiosInstance ( configuration , t ) ;
107107 const startIndex = 20 ;
108108 const count = 5 ;
109109 const response = await testAxios . get ( `/Groups?startIndex=${ startIndex } &count=${ count } ` ) ;
@@ -114,7 +114,7 @@ function runTests(groupSchema, groupSchemaExtensions = [], configuration) {
114114 } ) ;
115115
116116 test ( 'Sorts groups by displayName' , async ( t ) => {
117- const testAxios = getAxiosInstance ( getConfig ( ) , t ) ;
117+ const testAxios = getAxiosInstance ( configuration , t ) ;
118118 const response = await testAxios . get ( '/Groups?sortBy=displayName' ) ;
119119 assert . strictEqual ( response . status , 200 , 'Sort request should return 200 OK' ) ;
120120 assert . strictEqual ( response . data . schemas [ 0 ] , 'urn:ietf:params:scim:api:messages:2.0:ListResponse' , 'Response should use the correct SCIM list response schema' ) ;
@@ -127,7 +127,7 @@ function runTests(groupSchema, groupSchemaExtensions = [], configuration) {
127127 if ( configuration ?. groups ?. operations ?. includes ( 'POST' ) ) {
128128 for ( const [ index , creation ] of ( configuration . groups . post_tests || [ ] ) . entries ( ) ) {
129129 test ( `Creates a new group - Alternative ${ index + 1 } ` , async ( t ) => {
130- const testAxios = getAxiosInstance ( getConfig ( ) , t ) ;
130+ const testAxios = getAxiosInstance ( configuration , t ) ;
131131
132132 creation . request = await populateUserIds ( creation . request , configuration , t ) ;
133133
@@ -147,7 +147,7 @@ function runTests(groupSchema, groupSchemaExtensions = [], configuration) {
147147 }
148148
149149 test ( 'Returns errors when creating an invalid group' , async ( t ) => {
150- const testAxios = getAxiosInstance ( getConfig ( ) , t ) ;
150+ const testAxios = getAxiosInstance ( configuration , t ) ;
151151 // displayName is always required
152152 const newGroup = {
153153 schemas : [ 'urn:ietf:params:scim:schemas:core:2.0:Group' ] ,
@@ -164,7 +164,7 @@ function runTests(groupSchema, groupSchemaExtensions = [], configuration) {
164164 if ( configuration ?. groups ?. operations ?. includes ( 'PUT' ) ) {
165165 for ( const [ index , update ] of ( configuration . groups . put_tests || [ ] ) . entries ( ) ) {
166166 test ( `Updates a group using PUT - Alternative ${ index + 1 } ` , async ( t ) => {
167- const testAxios = getAxiosInstance ( getConfig ( ) , t ) ;
167+ const testAxios = getAxiosInstance ( configuration , t ) ;
168168
169169 const replaceId = ! update . id || update . id === 'AUTO' ? sharedState . groups ?. [ 0 ] ?. id : update . id ;
170170
@@ -191,7 +191,7 @@ function runTests(groupSchema, groupSchemaExtensions = [], configuration) {
191191 if ( configuration ?. groups ?. operations ?. includes ( 'PATCH' ) ) {
192192 for ( const [ index , patch ] of ( configuration . groups . patch_tests || [ ] ) . entries ( ) ) {
193193 test ( `Updates a group using PATCH - Alternative ${ index + 1 } ` , async ( t ) => {
194- const testAxios = getAxiosInstance ( getConfig ( ) , t ) ;
194+ const testAxios = getAxiosInstance ( configuration , t ) ;
195195
196196 const replaceId = ! patch . id || patch . id === 'AUTO' ? sharedState . groups ?. [ 0 ] ?. id : patch . id ;
197197
@@ -215,7 +215,7 @@ function runTests(groupSchema, groupSchemaExtensions = [], configuration) {
215215 }
216216
217217 test ( 'Assigns a user to a group' , async ( t ) => {
218- const testAxios = getAxiosInstance ( getConfig ( ) , t ) ;
218+ const testAxios = getAxiosInstance ( configuration , t ) ;
219219 // Retrieve a user
220220 const userResponse = await testAxios . get ( '/Users' ) ;
221221 assert . strictEqual ( userResponse . status , 200 , 'GET /Users should return status code 200' ) ;
@@ -251,7 +251,7 @@ function runTests(groupSchema, groupSchemaExtensions = [], configuration) {
251251 if ( configuration ?. groups ?. operations ?. includes ( 'DELETE' ) ) {
252252 for ( const [ index , deletion ] of ( configuration . groups . delete_tests || [ ] ) . entries ( ) ) {
253253 test ( `Deletes a group - Alternative ${ index + 1 } ` , async ( t ) => {
254- const testAxios = getAxiosInstance ( getConfig ( ) , t ) ;
254+ const testAxios = getAxiosInstance ( configuration , t ) ;
255255
256256 const deleteId = ! deletion . id || deletion . id === 'AUTO' ? sharedState . createdGroup ?. id : deletion . id ;
257257
0 commit comments