mirror of
https://github.com/morten-olsen/mini-loader.git
synced 2026-02-08 01:36:26 +01:00
qa: add e2e tests
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
import { Command } from 'commander';
|
||||
import { createClient } from '../../client/client.js';
|
||||
import { step } from '../../utils/step.js';
|
||||
import { Context } from '../../context/context.js';
|
||||
import { Config } from '../../config/config.js';
|
||||
import { getApi } from '../../utils/command.js';
|
||||
|
||||
const list = new Command('list');
|
||||
|
||||
@@ -15,16 +12,12 @@ const toInt = (value?: string) => {
|
||||
|
||||
list
|
||||
.alias('ls')
|
||||
.description('List logs')
|
||||
.description('List secrets')
|
||||
.option('-o, --offset <offset>', 'Offset')
|
||||
.option('-a, --limit <limit>', 'Limit', '1000')
|
||||
.action(async () => {
|
||||
const { step, client } = getApi(list);
|
||||
const { offset, limit } = list.opts();
|
||||
const config = new Config();
|
||||
const context = new Context(config.context);
|
||||
const client = await step('Connecting to server', async () => {
|
||||
return createClient(context);
|
||||
});
|
||||
const secrets = await step('Getting secrets', async () => {
|
||||
return await client.secrets.find.query({
|
||||
offset: toInt(offset),
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { Command } from 'commander';
|
||||
import { createClient } from '../../client/client.js';
|
||||
import { step } from '../../utils/step.js';
|
||||
import { Context } from '../../context/context.js';
|
||||
import { Config } from '../../config/config.js';
|
||||
import { getApi } from '../../utils/command.js';
|
||||
|
||||
const remove = new Command('remove');
|
||||
|
||||
@@ -10,11 +7,7 @@ remove
|
||||
.alias('rm')
|
||||
.argument('<id>')
|
||||
.action(async (id) => {
|
||||
const config = new Config();
|
||||
const context = new Context(config.context);
|
||||
const client = await step('Connecting to server', async () => {
|
||||
return createClient(context);
|
||||
});
|
||||
const { step, client } = getApi(remove);
|
||||
await step('Removing', async () => {
|
||||
await client.secrets.remove.mutate({
|
||||
id,
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import { Command } from 'commander';
|
||||
import { createClient } from '../../client/client.js';
|
||||
import { step } from '../../utils/step.js';
|
||||
import { Context } from '../../context/context.js';
|
||||
import { Config } from '../../config/config.js';
|
||||
import { getApi } from '../../utils/command.js';
|
||||
|
||||
const set = new Command('set');
|
||||
|
||||
@@ -10,11 +7,7 @@ set
|
||||
.argument('<id>')
|
||||
.argument('[value]')
|
||||
.action(async (id, value) => {
|
||||
const config = new Config();
|
||||
const context = new Context(config.context);
|
||||
const client = await step('Connecting to server', async () => {
|
||||
return createClient(context);
|
||||
});
|
||||
const { step, client } = getApi(set);
|
||||
await step('Setting secret', async () => {
|
||||
await client.secrets.set.mutate({
|
||||
id,
|
||||
|
||||
Reference in New Issue
Block a user