Skip to content

Commit 8352e16

Browse files
authored
Merge pull request #2112 from cjihrig/mv-test-dir
src: move test directory under `src/`
2 parents 980765f + e508774 commit 8352e16

15 files changed

+101
-98
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"exclude": [
3838
"src/gen/*/**.ts",
3939
"src/index.ts",
40-
"src/*_test.ts"
40+
"src/*_test.ts",
41+
"src/test"
4142
],
4243
"extension": [
4344
".ts"

src/attach_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import WebSocket from 'isomorphic-ws';
33
import { ReadableStreamBuffer, WritableStreamBuffer } from 'stream-buffers';
44
import { anyFunction, anything, capture, instance, mock, verify, when } from 'ts-mockito';
55

6-
import { CallAwaiter, matchBuffer, ResizableWriteableStreamBuffer } from '../test';
6+
import { CallAwaiter, matchBuffer, ResizableWriteableStreamBuffer } from './test';
77
import { Attach } from './attach.js';
88
import { KubeConfig } from './config.js';
99
import { TerminalSize } from './terminal-size-queue.js';

src/azure_auth_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ describe('AzureAuth', () => {
297297
authProvider: {
298298
name: 'azure',
299299
config: {
300-
'cmd-path': join(__dirname, '..', 'test', 'echo space.js'),
300+
'cmd-path': join(__dirname, 'test', 'echo space.js'),
301301
'cmd-args': `'${responseStr}'`,
302302
'token-key': '{.token.accessToken}',
303303
'expiry-key': '{.token.token_expiry}',

src/config_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import mockfs from 'mock-fs';
1010

1111
import { Headers } from 'node-fetch';
1212
import { HttpMethod } from './index.js';
13-
import { assertRequestAgentsEqual, assertRequestOptionsEqual } from '../test/match-buffer';
13+
import { assertRequestAgentsEqual, assertRequestOptionsEqual } from './test/match-buffer';
1414
import { CoreV1Api, RequestContext } from './api.js';
1515
import { bufferFromFileOrString, findHomeDir, findObject, KubeConfig, makeAbsolutePath } from './config.js';
1616
import { ActionOnInvalid, Cluster, newClusters, newContexts, newUsers, User } from './config_types.js';
@@ -1067,7 +1067,7 @@ describe('KubeConfig', () => {
10671067
authProvider: {
10681068
name: 'azure', // applies to gcp too as they are both handled by CloudAuth class
10691069
config: {
1070-
'cmd-path': path.join(__dirname, '..', 'test', 'echo space.js'),
1070+
'cmd-path': path.join(__dirname, 'test', 'echo space.js'),
10711071
'cmd-args': `'${responseStr}'`,
10721072
'token-key': '{.token.accessToken}',
10731073
'expiry-key': '{.token.token_expiry}',

src/cp_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { anything, anyFunction, instance, mock, verify, when } from 'ts-mockito'
22
import querystring from 'node:querystring';
33
import WebSocket from 'isomorphic-ws';
44

5-
import { CallAwaiter } from '../test';
5+
import { CallAwaiter } from './test';
66
import { KubeConfig } from './config.js';
77
import { Exec } from './exec.js';
88
import { Cp } from './cp.js';

src/exec_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import WebSocket from 'isomorphic-ws';
33
import { ReadableStreamBuffer, WritableStreamBuffer } from 'stream-buffers';
44
import { anyFunction, anything, capture, instance, mock, verify, when } from 'ts-mockito';
55

6-
import { CallAwaiter, matchBuffer, ResizableWriteableStreamBuffer } from '../test';
6+
import { CallAwaiter, matchBuffer, ResizableWriteableStreamBuffer } from './test';
77
import { V1Status } from './api.js';
88
import { KubeConfig } from './config.js';
99
import { Exec } from './exec.js';

src/gcp_auth_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ describe('GoogleCloudPlatformAuth', () => {
282282
authProvider: {
283283
name: 'gcp',
284284
config: {
285-
'cmd-path': join(__dirname, '..', 'test', 'echo space.js'),
285+
'cmd-path': join(__dirname, 'test', 'echo space.js'),
286286
'cmd-args': `'${responseStr}'`,
287287
'token-key': '{.token.accessToken}',
288288
'expiry-key': '{.token.token_expiry}',

src/test/call-awaiter.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { EventEmitter } from 'node:events';
2+
3+
export class CallAwaiter extends EventEmitter {
4+
public awaitCall(event: string) {
5+
return new Promise<any[]>((resolve) => {
6+
this.once(event, resolve);
7+
});
8+
}
9+
10+
public resolveCall(event: string) {
11+
return (...args: any[]) => this.emit(event, ...args);
12+
}
13+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env node
22

33
// Just echo back all the args
4-
console.log(process.argv.slice(2).join(' '))
4+
console.log(process.argv.slice(2).join(' '));
File renamed without changes.

0 commit comments

Comments
 (0)