Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions asyncapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
asyncapi: 3.1.0
info:
title: Account Service
version: 1.0.0
description: This service is in charge of processing user signups
channels:
userSignedUp:
address: user/signedup
messages:
UserSignedUp:
$ref: '#/components/messages/UserSignedUp'
operations:
onUserSignUp:
action: receive
channel:
$ref: '#/channels/userSignedUp'
messages:
- $ref: '#/channels/userSignedUp/messages/UserSignedUp'
components:
messages:
UserSignedUp:
payload:
type: object
properties:
displayName:
type: string
description: Name of the user
email:
type: string
format: email
description: Email of the user
142 changes: 107 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
"@types/js-yaml": "^4.0.9",
"@types/mocha": "^10.0.10",
"@types/node": "^25.0.3",
"@types/sinon": "^22.0.0",
"@types/supertest": "^6.0.3",
"@types/ws": "^8.18.1",
"@typescript-eslint/eslint-plugin": "^8.50.0",
Expand All @@ -85,12 +86,14 @@
"eslint-plugin-github": "^6.0.0",
"eslint-plugin-security": "^3.0.1",
"eslint-plugin-sonarjs": "^3.0.5",
"esmock": "^2.7.6",
"markdown-toc": "^1.2.0",
"mocha": "^11.7.5",
"nodemon": "^3.1.11",
"puppeteer": "^24.33.0",
"rimraf": "^6.1.2",
"simple-git": "^3.30.0",
"sinon": "^22.0.0",
"supertest": "^7.1.4",
"ts-node": "^10.9.2",
"tsc-alias": "^1.8.16",
Expand Down
55 changes: 55 additions & 0 deletions test/integration/config/auth/add.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { expect, test } from '@oclif/test';

describe('config:auth:add', () => {
describe('with valid arguments', () => {
test
.stdout()
.stderr()
.command(['config:auth:add', 'https://github.com/org/**', 'my-token'])
.it('should add auth config with raw token', (ctx) => {
expect(ctx.stdout).to.include('Auth config added');
expect(ctx.stdout).to.include('raw token');
expect(ctx.stdout).to.include('https://github.com/org/**');
});

test
.stdout()
.stderr()
.command(['config:auth:add', 'https://github.com/**', '$GITHUB_TOKEN'])
.it('should detect env var reference (token starting with $)', (ctx) => {
expect(ctx.stdout).to.include('env var');
expect(ctx.stdout).to.include('GITHUB_TOKEN');
});

test
.stdout()
.stderr()
.command(['config:auth:add', 'https://api.com/**', 'tok', '-a', 'token'])
.it('should use custom auth-type', (ctx) => {
expect(ctx.stdout).to.include('token');
});

test
.stdout()
.stderr()
.command([
'config:auth:add', 'https://api.com/**', 'tok',
'-h', 'X-Custom=value1',
'-h', 'Accept=application/json',
])
.it('should parse multiple headers', (ctx) => {
expect(ctx.stdout).to.include('Headers');
expect(ctx.stdout).to.include('X-Custom');
});
});

describe('with invalid header format', () => {
test
.stdout()
.stderr()
.command(['config:auth:add', 'https://api.com/**', 'tok', '-h', 'invalid-no-equals'])
.it('should warn about invalid header format', (ctx) => {
expect(ctx.stderr).to.include('Ignored invalid header format');
});
});
});
45 changes: 45 additions & 0 deletions test/integration/new/file-interactive.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { expect, test } from '@oclif/test';
import inquirer from 'inquirer';
import path from 'path';
import { promises as fs } from 'fs';

describe('new:file - interactive mode', () => {
const uniqueTestFile = `test-new-file-interactive-${Date.now()}.yaml`;
const testFilePath = path.resolve(process.cwd(), uniqueTestFile);

afterEach(async () => {
try { await fs.unlink(testFilePath); } catch { /* ignore */ }
});

describe('interactive prompts with inquirer stub', () => {
let originalIsTTY: boolean | undefined;

beforeEach(() => {
originalIsTTY = process.stdout.isTTY;
Object.defineProperty(process.stdout, 'isTTY', { value: true, writable: true, configurable: true });
});

afterEach(() => {
if (originalIsTTY === undefined) {
delete (process.stdout as any).isTTY;
} else {
Object.defineProperty(process.stdout, 'isTTY', { value: originalIsTTY, writable: true, configurable: true });
}
});

test
.stub(inquirer, 'prompt', (stub: any) =>
stub.resolves({
filename: uniqueTestFile,
'use-example': false,
studio: false,
})
)
.stdout()
.stderr()
.command(['new:file'])
.it('should create file with interactive filename prompt', (ctx) => {
expect(ctx.stdout).to.include('successfully created');
});
});
});
Loading
Loading