Skip to content

Commit

Permalink
simplify-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shimaore committed Jan 11, 2024
1 parent 45d36a0 commit 9a72958
Show file tree
Hide file tree
Showing 17 changed files with 458 additions and 153 deletions.
2 changes: 1 addition & 1 deletion test/01-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
FreeSwitchResponse
} from 'esl'
import { type Socket } from 'net'
import { responseLogger as logger } from './tools.js'
import { responseLogger as logger } from './utils.js'

const socket = {
once: function () { },
Expand Down
3 changes: 2 additions & 1 deletion test/01-buffer-at-end.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
createServer
} from 'node:net'

import { clientLogger, sleep } from './tools.js'
import { sleep } from './tools.js'
import { clientLogger } from './utils.js'

const client_port = 5621

Expand Down
5 changes: 1 addition & 4 deletions test/02.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@ import {
} from 'esl'

import {
clientLogger,
start,
stop
} from './utils.js'

import {
clientLogger
} from './tools.js'

const client_port = 8024

test.before(start)
Expand Down
7 changes: 2 additions & 5 deletions test/03.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@ import {

import {
start,
stop
} from './utils.js'

import {
stop,
clientLogger,
serverLogger,
DoCatch
} from './tools.js'
} from './utils.js'

const client_port = 8024
const domain = '127.0.0.1:5062'
Expand Down
3 changes: 2 additions & 1 deletion test/10-client-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ import {
} from 'esl'

import {
clientLogger,
start,
stop
} from './utils.js'
import { clientLogger, sleep } from './tools.js'
import { sleep } from './tools.js'

// We start two FreeSwitch docker.io instances, one is used as the "client" (and is basically our SIP test runner), while the other one is the "server" (and is used to test the `server` side of the package).
const client_port = 8024
Expand Down
2 changes: 1 addition & 1 deletion test/10-server-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import {
} from 'esl'

import {
clientLogger,
start_server,
stop
} from './utils.js'
import { clientLogger } from './tools.js'

const server_port = 8022

Expand Down
5 changes: 3 additions & 2 deletions test/10-uuid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ import {

import {
start_server,
stop
stop,
clientLogger, serverLogger
} from './utils.js'
import { clientLogger, serverLogger, second, sleep } from './tools.js'
import { second, sleep } from './tools.js'

// Using UUID (in client mode)
// ---------------------------
Expand Down
3 changes: 2 additions & 1 deletion test/10-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
createServer
} from 'node:net'

import { clientLogger, sleep } from './tools.js'
import { sleep } from './tools.js'
import { clientLogger } from './utils.js'

const client_port = 5624

Expand Down
4 changes: 2 additions & 2 deletions test/14-base-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import {

import {
start,
stop
stop, clientLogger, serverLogger, DoCatch
} from './utils.js'

import {
once,
FreeSwitchEventEmitter
} from 'esl'

import { second, sleep, clientLogger, serverLogger, DoCatch } from './tools.js'
import { second, sleep } from './tools.js'

const domain = '127.0.0.1:5062'

Expand Down
10 changes: 5 additions & 5 deletions test/15-base-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {

import {
start,
stop
stop,
clientLogger as logger,
clientLogger,
DoCatch
} from './utils.js'

import {
Expand All @@ -26,10 +29,7 @@ import {
second,
sleep,
timer,
clientLogger as logger,
options_text,
clientLogger,
DoCatch
options_text
} from './tools.js'

const domain = '127.0.0.1:5062'
Expand Down
3 changes: 2 additions & 1 deletion test/70-reconnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
type Socket,
createServer
} from 'node:net'
import { clientLogger, sleep } from './tools.js'
import { sleep } from './tools.js'
import { clientLogger } from './utils.js'

const client_port = 5623

Expand Down
4 changes: 2 additions & 2 deletions test/80-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import {
} from 'esl'

import {
start,
clientLogger as logger, start,
stop
} from './utils.js'

import {
v4 as uuidv4
} from 'uuid'

import { second, sleep, timer, clientLogger as logger, options_text } from './tools.js'
import { second, sleep, timer, options_text } from './tools.js'

const client_port = 8024

Expand Down
6 changes: 3 additions & 3 deletions test/90-base-server-2cps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import {

import {
start,
stop
stop, clientLogger as logger, clientLogger, DoCatch
} from './utils.js'

import { second, sleep, clientLogger as logger, clientLogger, DoCatch } from './tools.js'
import { second, sleep } from './tools.js'

const domain = '127.0.0.1:5062'

Expand Down Expand Up @@ -117,7 +117,7 @@ test.before(async function (t) {
}
return
}
if (destination.match(/^answer-wait-3000-\d+$/) != null) {
if (destination?.match(/^answer-wait-3000-\d+$/) != null) {
await call.command('hangup', `200 destination ${destination}`)
return
}
Expand Down
Loading

0 comments on commit 9a72958

Please sign in to comment.