@@ -15,6 +15,7 @@ import manifestData from "../../../../src/config/manifest.json";
1515import orgManifestData from "../../../unit/config/org_manifest.json" ;
1616import { getDeveloperHubUrl } from "../../../../src/util/inquirer" ;
1717import axios from "axios" ;
18+ import { stubAuthentication } from "../../helpers/auth-stub-helper" ;
1819
1920const { origin, pathname } = new URL ( config . appBoilerplateGithubUrl ) ;
2021const zipPath = join ( process . cwd ( ) , "test" , "unit" , "mock" , "boilerplate.zip" ) ;
@@ -36,30 +37,8 @@ describe("app:create", () => {
3637 sandbox = sinon . createSandbox ( ) ;
3738 axios . defaults . adapter = "http" ;
3839
39- // Stub authentication
40- sandbox . stub ( configHandler , "get" ) . callsFake ( ( key : string ) => {
41- if ( key === "region" ) {
42- return {
43- cma : "https://api.contentstack.io" ,
44- cda : "https://cdn.contentstack.io" ,
45- region : "us" ,
46- } ;
47- }
48- if ( key === "authtoken" ) {
49- return "mock-auth-token" ;
50- }
51- if ( key === "authorisationType" ) {
52- return "BASIC" ;
53- }
54- return undefined ;
55- } ) ;
56-
57- sandbox
58- . stub (
59- require ( "../../../../src/base-command" ) . BaseCommand . prototype ,
60- "validateRegionAndAuth"
61- )
62- . callsFake ( ( ) => { } ) ;
40+ // Stub authentication using shared helper
41+ stubAuthentication ( sandbox ) ;
6342
6443 writeStreamMock = new MockWriteStream ( ) ;
6544 sandbox . stub ( fs , "renameSync" ) . callsFake ( ( ) => { } ) ;
0 commit comments