Skip to content

Commit

Permalink
ci: move and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xCykrix committed Oct 12, 2024
1 parent afd1510 commit 6f0febe
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions example/example-ledger.ts → test/helper/test-ledger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Ledger } from '../mod.ts';
import { delay } from '../deps.ts';
import { Ledger } from '../../mod.ts';
import { delay } from '../../deps.ts';

const ledger = new Ledger()
.addTransportWorker('jsr:@ledger/console-transport', {});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Level } from '../lib/interface/level.ts';
import { TransportOp } from '../lib/interface/op.ts';
import { Transport } from '../test/test-transport.ts';
import { Level } from '../../lib/interface/level.ts';
import { TransportOp } from '../../lib/interface/op.ts';
import { Transport } from './transport.ts';

const transport = new Transport({});
await transport.consume({
Expand Down
5 changes: 3 additions & 2 deletions test/test-transport.ts → test/helper/transport.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { LedgerTransportOptions, TransportHandleMessage } from '../lib/interface/struct.ts';
import { LedgerTransport } from '../lib/transport.ts';
import type { LedgerTransportOptions, TransportHandleMessage } from '../../lib/interface/struct.ts';
import { LedgerTransport } from '../../lib/transport.ts';

export class Transport extends LedgerTransport {
public constructor(options: LedgerTransportOptions) {
super(options);
}

// deno-lint-ignore require-await
public override async consume(payload: TransportHandleMessage): Promise<void> {
// deno-lint-ignore no-console
console.info('consume', payload.op, payload.message);
Expand Down
4 changes: 1 addition & 3 deletions test/mod.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Deno.test('mod.ts production', async (t) => {
name: 'create',
fn: async () => {
const proc = await new Deno.Command('deno', {
args: ['run', '--allow-read', '--allow-net', './example/example-ledger.ts'],
args: ['run', '--allow-read', '--allow-net', './test/helper/test-ledger.ts'],
});
const output = await proc.output();
stdout = stripAnsiCode(decoder.decode(output.stdout).trim());
Expand All @@ -29,5 +29,3 @@ Deno.test('mod.ts production', async (t) => {
},
});
});

// Test Example Transport
2 changes: 1 addition & 1 deletion test/transport.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Deno.test('transport.ts', async (t) => {
name: 'create',
fn: async () => {
const proc = await new Deno.Command('deno', {
args: ['run', '--allow-read', '--allow-net', './example/example-transport.ts'],
args: ['run', '--allow-read', '--allow-net', './test/helper/test-transport.ts'],
});
const output = await proc.output();
stdout = stripAnsiCode(decoder.decode(output.stdout).trim());
Expand Down
2 changes: 1 addition & 1 deletion test/worker-controller.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { assertEquals } from 'jsr:@std/assert';
Deno.test({
name: 'worker-controller.ts',
fn: async () => {
const controller = new TransportWorkerController(new URL('./test-transport.ts', import.meta.url).toString(), {
const controller = new TransportWorkerController(new URL('./helper/transport.ts', import.meta.url).toString(), {
developerMode: true,
});
await controller.await(1000);
Expand Down

0 comments on commit 6f0febe

Please sign in to comment.