|
| 1 | +import * as assert from "assert"; |
| 2 | +import {Uri} from "vscode"; |
| 3 | +import {PathMapper} from "../configuration/PathMapper"; |
| 4 | + |
| 5 | +import {CliWrapper} from "./CliWrapper"; |
| 6 | + |
| 7 | +describe(__filename, () => { |
| 8 | + it("should create sync command", () => { |
| 9 | + const cli = new CliWrapper(); |
| 10 | + const mapper = new PathMapper( |
| 11 | + Uri.file( |
| 12 | + "/Workspace/Repos/fabian.jakobs@databricks.com/notebook-best-practices" |
| 13 | + ), |
| 14 | + Uri.file("/Users/fabian.jakobs/Desktop/notebook-best-practices") |
| 15 | + ); |
| 16 | + |
| 17 | + const {command, args} = cli.getSyncCommand( |
| 18 | + "DEFAULT", |
| 19 | + "fabian@databricks.com", |
| 20 | + mapper, |
| 21 | + "incremental" |
| 22 | + ); |
| 23 | + |
| 24 | + assert.equal( |
| 25 | + [command, ...args].join(" "), |
| 26 | + "dbx sync repo --profile DEFAULT --user fabian@databricks.com --dest-repo notebook-best-practices" |
| 27 | + ); |
| 28 | + }); |
| 29 | + |
| 30 | + it("should create full sync command", () => { |
| 31 | + const cli = new CliWrapper(); |
| 32 | + const mapper = new PathMapper( |
| 33 | + Uri.file( |
| 34 | + "/Workspace/Repos/fabian.jakobs@databricks.com/notebook-best-practices" |
| 35 | + ), |
| 36 | + Uri.file("/Users/fabian.jakobs/Desktop/notebook-best-practices") |
| 37 | + ); |
| 38 | + |
| 39 | + const {command, args} = cli.getSyncCommand( |
| 40 | + "DEFAULT", |
| 41 | + "fabian@databricks.com", |
| 42 | + mapper, |
| 43 | + "full" |
| 44 | + ); |
| 45 | + |
| 46 | + assert.equal( |
| 47 | + [command, ...args].join(" "), |
| 48 | + "dbx sync repo --profile DEFAULT --user fabian@databricks.com --dest-repo notebook-best-practices --full-sync" |
| 49 | + ); |
| 50 | + }); |
| 51 | + |
| 52 | + it("should create an 'add profile' command", () => { |
| 53 | + const cli = new CliWrapper(); |
| 54 | + |
| 55 | + const {command, args} = cli.getAddProfileCommand( |
| 56 | + "DEFAULT", |
| 57 | + new URL("https://databricks.com") |
| 58 | + ); |
| 59 | + |
| 60 | + assert.equal( |
| 61 | + [command, ...args].join(" "), |
| 62 | + "databricks configure --profile DEFAULT --host https://databricks.com/ --token" |
| 63 | + ); |
| 64 | + }); |
| 65 | +}); |
0 commit comments