fixing tests

This commit is contained in:
balzack 2024-08-19 07:33:57 -07:00
parent 72f51d00e4
commit b3b9688dfa
5 changed files with 4662 additions and 3016 deletions

View File

@ -4,7 +4,7 @@ export async function clearLogin(node: string, secure: boolean, token: string, a
const param = all ? '&all=true' : ''
const endpoint = `http${secure ? 's' : ''}://${node}/account/apps?agent=${token}${param}`;
const response = await axios.delete(endpoint);
if (response.status >= 400 && response.stateus < 600) {
if (response.status >= 400 && response.status < 600) {
throw new Error('clearLogin failed');
}
}

View File

@ -1,6 +1,6 @@
import axios from 'redaxios';
export async function getAvailable(node: string, secure: boolean): number {
export async function getAvailable(node: string, secure: boolean): Promise<number> {
const endpoint = `http${secure ? 's' : ''}://${node}/account/available`;
const response = await axios.get(endpoint);
if (response.status >= 400 && response.status < 600) {

View File

@ -1,6 +1,6 @@
import axios from 'redaxios';
export async function getUsername(name: string, token: string, node: string, secure: boolean): boolean {
export async function getUsername(name: string, token: string, node: string, secure: boolean): Promise<boolean> {
const param = token ? `&token=${token}` : '';
const username = encodeURIComponent(name)
const endpoint = `http${secure ? 's' : ''}://${node}/account/username?name=${username}${param}`;

View File

@ -9,7 +9,7 @@ export async function setLogin(node: string, secure: boolean, username: string,
const response = await axios.post(endpoint, notifications, { auth: `Basic ${auth}` });
return response.data;
}
catch(err) {
catch(err: any) {
throw new Error(err.status);
}
}

File diff suppressed because it is too large Load Diff