mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
fix: tests and validate token clears screen
This commit is contained in:
@@ -15,7 +15,9 @@ test('it creates a FLASH config with NO OPTIONAL values', () => {
|
||||
"extraOrigins": "",
|
||||
"version": "",
|
||||
},
|
||||
"local": {},
|
||||
"local": {
|
||||
"sandbox": "no",
|
||||
},
|
||||
"remote": {
|
||||
"accesstoken": "",
|
||||
"apikey": "",
|
||||
@@ -49,7 +51,9 @@ test('it creates a MEMORY config with NO OPTIONAL values', () => {
|
||||
"minigraph": "PRE_INIT",
|
||||
"upnpStatus": "",
|
||||
},
|
||||
"local": {},
|
||||
"local": {
|
||||
"sandbox": "no",
|
||||
},
|
||||
"remote": {
|
||||
"accesstoken": "",
|
||||
"allowedOrigins": "/var/run/unraid-notifications.sock, /var/run/unraid-php.sock, /var/run/unraid-cli.sock, https://connect.myunraid.net, https://connect-staging.myunraid.net, https://dev-my.myunraid.net:4000",
|
||||
@@ -88,7 +92,9 @@ test('it creates a FLASH config with OPTIONAL values', () => {
|
||||
"extraOrigins": "myextra.origins",
|
||||
"version": "",
|
||||
},
|
||||
"local": {},
|
||||
"local": {
|
||||
"sandbox": "no",
|
||||
},
|
||||
"remote": {
|
||||
"accesstoken": "",
|
||||
"apikey": "",
|
||||
@@ -129,7 +135,9 @@ test('it creates a MEMORY config with OPTIONAL values', () => {
|
||||
"minigraph": "PRE_INIT",
|
||||
"upnpStatus": "Turned On",
|
||||
},
|
||||
"local": {},
|
||||
"local": {
|
||||
"sandbox": "no",
|
||||
},
|
||||
"remote": {
|
||||
"accesstoken": "",
|
||||
"allowedOrigins": "/var/run/unraid-notifications.sock, /var/run/unraid-php.sock, /var/run/unraid-cli.sock, https://connect.myunraid.net, https://connect-staging.myunraid.net, https://dev-my.myunraid.net:4000",
|
||||
|
||||
@@ -10,7 +10,9 @@ exports[`Before init returns default values for all fields 1`] = `
|
||||
"minigraph": "PRE_INIT",
|
||||
"upnpStatus": "",
|
||||
},
|
||||
"local": {},
|
||||
"local": {
|
||||
"sandbox": "no",
|
||||
},
|
||||
"nodeEnv": "test",
|
||||
"remote": {
|
||||
"accesstoken": "",
|
||||
|
||||
@@ -26,7 +26,9 @@ test('After init returns values from cfg file for all fields', async () => {
|
||||
minigraph: 'PRE_INIT',
|
||||
upnpStatus: '',
|
||||
},
|
||||
local: {},
|
||||
local: {
|
||||
sandbox: 'no'
|
||||
},
|
||||
nodeEnv: 'test',
|
||||
remote: {
|
||||
accesstoken: '',
|
||||
@@ -74,7 +76,9 @@ test('updateUserConfig merges in changes to current state', async () => {
|
||||
minigraph: 'PRE_INIT',
|
||||
upnpStatus: '',
|
||||
},
|
||||
local: {},
|
||||
local: {
|
||||
sandbox: 'no'
|
||||
},
|
||||
nodeEnv: 'test',
|
||||
remote: {
|
||||
accesstoken: '',
|
||||
|
||||
@@ -6,6 +6,7 @@ import { loadConfigFile, updateUserConfig } from '@app/store/modules/config';
|
||||
import { writeConfigSync } from '@app/store/sync/config-disk-sync';
|
||||
import { DeveloperQuestions } from '@app/unraid-api/cli/developer/developer.questions';
|
||||
import { LogService } from '@app/unraid-api/cli/log.service';
|
||||
import { RestartCommand } from '@app/unraid-api/cli/restart.command';
|
||||
|
||||
interface DeveloperOptions {
|
||||
disclaimer: boolean;
|
||||
@@ -19,7 +20,8 @@ interface DeveloperOptions {
|
||||
export class DeveloperCommand extends CommandRunner {
|
||||
constructor(
|
||||
private logger: LogService,
|
||||
private readonly inquirerService: InquirerService
|
||||
private readonly inquirerService: InquirerService,
|
||||
private readonly restartCommand: RestartCommand
|
||||
) {
|
||||
super();
|
||||
}
|
||||
@@ -34,6 +36,10 @@ export class DeveloperCommand extends CommandRunner {
|
||||
store.dispatch(updateUserConfig({ local: { sandbox: options.sandbox ? 'yes' : 'no' } }));
|
||||
writeConfigSync('flash');
|
||||
|
||||
this.logger.info('Updated Developer Configuration');
|
||||
this.logger.info(
|
||||
'Updated Developer Configuration - restart the API in 5 seconds to apply them...'
|
||||
);
|
||||
await new Promise((resolve) => setTimeout(resolve, 5000));
|
||||
await this.restartCommand.run([]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,7 @@ export class ValidateTokenCommand extends CommandRunner {
|
||||
}
|
||||
const possibleUserIds = configFile.remote.ssoSubIds.split(',');
|
||||
if (possibleUserIds.includes(username)) {
|
||||
this.logger.clear();
|
||||
this.logger.info(JSON.stringify({ error: null, valid: true, username }));
|
||||
process.exit(0);
|
||||
} else {
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`FileModificationService > should apply modifications 1`] = `[Error: Application not implemented.]`;
|
||||
Reference in New Issue
Block a user