fix method type check
This commit is contained in:
parent
c898eae296
commit
8481aadfd9
@ -40,7 +40,11 @@ export const NewProvider = createExample(TestedComponent, {
|
|||||||
...reducerStatesExample.authEditing,
|
...reducerStatesExample.authEditing,
|
||||||
} as ReducerState);
|
} as ReducerState);
|
||||||
|
|
||||||
export const NewSMSProvider = createExample(TestedComponent, {
|
export const NewVideoProvider = createExample(TestedComponent, {
|
||||||
|
...reducerStatesExample.authEditing,
|
||||||
|
} as ReducerState, { providerType: 'video'});
|
||||||
|
|
||||||
|
export const NewSmsProvider = createExample(TestedComponent, {
|
||||||
...reducerStatesExample.authEditing,
|
...reducerStatesExample.authEditing,
|
||||||
} as ReducerState, { providerType: 'sms'});
|
} as ReducerState, { providerType: 'sms'});
|
||||||
|
|
||||||
|
@ -19,12 +19,13 @@ async function testProvider(url: string, expectedMethodType?: string): Promise<v
|
|||||||
if (!("methods" in json) || !Array.isArray(json.methods)) {
|
if (!("methods" in json) || !Array.isArray(json.methods)) {
|
||||||
throw Error("This provider doesn't have authentication method. Check the provider URL")
|
throw Error("This provider doesn't have authentication method. Check the provider URL")
|
||||||
}
|
}
|
||||||
|
console.log("expected", expectedMethodType)
|
||||||
if (!expectedMethodType) {
|
if (!expectedMethodType) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let found = false
|
let found = false
|
||||||
for (let i = 0; i < json.methods.length && !found; i++) {
|
for (let i = 0; i < json.methods.length && !found; i++) {
|
||||||
found = json.methods[i].type !== expectedMethodType
|
found = json.methods[i].type === expectedMethodType
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
throw Error(`This provider does not support authentication method ${expectedMethodType}`)
|
throw Error(`This provider does not support authentication method ${expectedMethodType}`)
|
||||||
|
Loading…
Reference in New Issue
Block a user