File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { describe , expect , it } from "bun:test" ;
2+ import { createBeeClient } from "@/lib" ;
3+ import { existsSync } from "node:fs" ;
4+ import { resolve } from "node:path" ;
5+
6+ const SHOULD_RUN = process . env [ "BEE_CLI_E2E" ] === "1" ;
7+ const e2e = SHOULD_RUN ? it : it . skip ;
8+ const TIMEOUT_MS = 20000 ;
9+
10+ const binaryPath = resolve ( process . cwd ( ) , "dist" , "bee" ) ;
11+
12+ describe ( "bee cli e2e" , ( ) => {
13+ e2e (
14+ "runs against real bee binary" ,
15+ async ( ) => {
16+ if ( ! existsSync ( binaryPath ) ) {
17+ throw new Error (
18+ `Bee binary not found at ${ binaryPath } . Run bun run build first.`
19+ ) ;
20+ }
21+
22+ const bee = createBeeClient ( { command : binaryPath } ) ;
23+ const version = await bee . api . version < { name ?: string ; version ?: string } > ( ) ;
24+
25+ expect ( typeof version ) . toBe ( "object" ) ;
26+ expect ( typeof version ?. version ) . toBe ( "string" ) ;
27+
28+ const status = await bee . run ( [ "status" ] ) ;
29+ expect ( status . exitCode ) . toBe ( 0 ) ;
30+ expect ( status . stdout ) . toContain ( "API:" ) ;
31+ expect (
32+ status . stdout . includes ( "Not logged in." ) ||
33+ status . stdout . includes ( "Verified as" )
34+ ) . toBe ( true ) ;
35+ } ,
36+ TIMEOUT_MS
37+ ) ;
38+ } ) ;
You can’t perform that action at this time.
0 commit comments