Skip to content

Commit

Permalink
chore: for ci
Browse files Browse the repository at this point in the history
  • Loading branch information
npmstudy committed Dec 13, 2023
1 parent 81fa349 commit 5d545a0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
5 changes: 4 additions & 1 deletion packages/app/src/__tests__/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import supertest from 'supertest';
import { describe, expect, it } from 'vitest';

import { createApp, AppServer } from '../index';
const from = 15000;
const range = 100;
const port = from + ~~(Math.random() * range);

describe('app', async () => {
const rpc: AppServer = createApp({
Expand Down Expand Up @@ -88,7 +91,7 @@ describe('app', async () => {
const request = supertest(rpc.callback());

it('should start === rpc.callback', async () => {
const request2 = supertest(rpc.start(30001));
const request2 = supertest(rpc.start(port));
const res = await request2.get('/api/a?$p=["hello"]');
expect(res.type).toEqual('application/json');
expect(res.status).toEqual(200);
Expand Down
10 changes: 7 additions & 3 deletions packages/client/src/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import { describe, expect, it } from 'vitest';

import { createClient } from '..';

const from = 15000;
const range = 100;
const port = from + ~~(Math.random() * range);

describe('lib', () => {
const rpc = createServer({
fn: {
Expand Down Expand Up @@ -42,11 +46,11 @@ describe('lib', () => {
});

it('should GET return json', async () => {
rpc.start(30001);
rpc.start(port);

const client = createClient({
host: '127.0.0.1',
port: 30001,
port: port,
});

// console.dir(client);
Expand All @@ -55,7 +59,7 @@ describe('lib', () => {

expect(res1['a']).toBe('hello');

const res = await fetch('http://127.0.0.1:30001/api/a?$p=["hello"]');
const res = await fetch(`http://127.0.0.1:${port}/api/a?$p=["hello"]`);
const s = await res.json();
// console.dir(s);
expect(s['a']).toBe('hello');
Expand Down
6 changes: 5 additions & 1 deletion packages/core/src/__tests__/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { describe, expect, it } from 'vitest';

import { createServer } from '../index';

const from = 15000;
const range = 100;
const port = from + ~~(Math.random() * range);

describe('app', async () => {
const rpc = createServer({
fn: {
Expand Down Expand Up @@ -40,7 +44,7 @@ describe('app', async () => {
const request = supertest(rpc.callback());

it('should start === rpc.callback', async () => {
const request2 = supertest(rpc.start(30001));
const request2 = supertest(rpc.start(port));
const res = await request2.get('/api/a?$p=["hello"]');
expect(res.type).toEqual('application/json');
expect(res.status).toEqual(200);
Expand Down

0 comments on commit 5d545a0

Please sign in to comment.