@api-client/core 0.18.37 → 0.18.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/sdk/SdkMock.ts
CHANGED
|
@@ -375,29 +375,6 @@ export class SdkMock {
|
|
|
375
375
|
},
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
/**
|
|
379
|
-
* Auth API mocks.
|
|
380
|
-
*/
|
|
381
|
-
auth = {
|
|
382
|
-
/**
|
|
383
|
-
* Mocks the `auth.oauthRedirect()` method.
|
|
384
|
-
* This method returns `null` by default as it performs window navigation.
|
|
385
|
-
* @param options Optional response customization.
|
|
386
|
-
* @returns A stub reference that can be used to restore the original behavior.
|
|
387
|
-
*/
|
|
388
|
-
oauthRedirect: (options?: MockResponseOptions): StubReference => {
|
|
389
|
-
return this.createStub(
|
|
390
|
-
'auth',
|
|
391
|
-
'oauthRedirect',
|
|
392
|
-
() => {
|
|
393
|
-
const defaultData = options?.data ?? null
|
|
394
|
-
return defaultData
|
|
395
|
-
},
|
|
396
|
-
true
|
|
397
|
-
)
|
|
398
|
-
},
|
|
399
|
-
}
|
|
400
|
-
|
|
401
378
|
/**
|
|
402
379
|
* Files API mocks.
|
|
403
380
|
*/
|
|
@@ -723,8 +700,7 @@ export class SdkMock {
|
|
|
723
700
|
| 'organizations.invitations'
|
|
724
701
|
| 'organizations.users',
|
|
725
702
|
method: string,
|
|
726
|
-
implementation: () => unknown
|
|
727
|
-
sync?: boolean
|
|
703
|
+
implementation: () => unknown
|
|
728
704
|
): StubReference {
|
|
729
705
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
730
706
|
let target: any = this.sdk
|
|
@@ -741,10 +717,8 @@ export class SdkMock {
|
|
|
741
717
|
throw new Error(`Method '${method}' not found in ${api} API`)
|
|
742
718
|
}
|
|
743
719
|
|
|
744
|
-
//
|
|
745
|
-
const stub =
|
|
746
|
-
? sinon.stub(target, method).callsFake(() => implementation())
|
|
747
|
-
: sinon.stub(target, method).callsFake(async () => implementation())
|
|
720
|
+
// Create stub using sinon
|
|
721
|
+
const stub = sinon.stub(target, method).callsFake(async () => implementation())
|
|
748
722
|
|
|
749
723
|
const stubRef: StubReference = {
|
|
750
724
|
restore: () => {
|
|
@@ -762,19 +736,6 @@ export class SdkMock {
|
|
|
762
736
|
return stubRef
|
|
763
737
|
}
|
|
764
738
|
|
|
765
|
-
/**
|
|
766
|
-
* Creates a response object from data and options.
|
|
767
|
-
* @param defaultData Default data to return if not overridden.
|
|
768
|
-
* @param options Response options.
|
|
769
|
-
* @returns The final data to return (for non-HTTP responses) or IStoreResponse (for HTTP responses).
|
|
770
|
-
*/
|
|
771
|
-
private createResponse(defaultData: unknown, options?: MockResponseOptions): unknown {
|
|
772
|
-
// For SDK-level stubs we return plain data. Status and headers are
|
|
773
|
-
// accepted but not propagated, since high-level SDK methods return data.
|
|
774
|
-
const data = options?.data !== undefined ? options.data : defaultData
|
|
775
|
-
return data
|
|
776
|
-
}
|
|
777
|
-
|
|
778
739
|
/**
|
|
779
740
|
* Generates a random organization object.
|
|
780
741
|
*/
|