@@ -18,11 +18,17 @@ describe("export", () => {
1818 const { setIsTTY } = useMockIsTTY ( ) ;
1919
2020 it ( "should throw if output is missing" , async ( ) => {
21- await expect ( runWrangler ( "d1 export db --local " ) ) . rejects . toThrowError (
21+ await expect ( runWrangler ( "d1 export db" ) ) . rejects . toThrowError (
2222 `Missing required argument: output`
2323 ) ;
2424 } ) ;
2525
26+ it ( "should throw if local and remote are both set" , async ( ) => {
27+ await expect ( runWrangler ( "d1 export db --local --remote --output test-local.sql" ) ) . rejects . toThrowError (
28+ "Arguments local and remote are mutually exclusive"
29+ ) ;
30+ } ) ;
31+
2632 it ( "should handle local" , async ( ) => {
2733 setIsTTY ( false ) ;
2834 writeWranglerConfig ( {
@@ -32,7 +38,7 @@ describe("export", () => {
3238 } ) ;
3339
3440 // Verify the basic command works with an empty DB
35- await runWrangler ( "d1 export db --local -- output test-local.sql" ) ;
41+ await runWrangler ( "d1 export db --output test-local.sql" ) ;
3642 expect ( fs . readFileSync ( "test-local.sql" , "utf8" ) ) . toBe (
3743 "PRAGMA defer_foreign_keys=TRUE;"
3844 ) ;
@@ -47,7 +53,7 @@ describe("export", () => {
4753 INSERT INTO bar (value) VALUES ('aaa'),('bbb'),('ccc');
4854 `
4955 ) ;
50- await runWrangler ( "d1 execute db --local -- file data.sql" ) ;
56+ await runWrangler ( "d1 execute db --file data.sql" ) ;
5157
5258 // SQL output expectations
5359 const create_foo = "CREATE TABLE foo(id INTEGER PRIMARY KEY, value TEXT);" ;
@@ -64,7 +70,7 @@ describe("export", () => {
6470 ] ;
6571
6672 // Full export
67- await runWrangler ( "d1 export db --local -- output test-full.sql" ) ;
73+ await runWrangler ( "d1 export db --output test-full.sql" ) ;
6874 expect ( fs . readFileSync ( "test-full.sql" , "utf8" ) ) . toBe (
6975 [
7076 "PRAGMA defer_foreign_keys=TRUE;" ,
@@ -77,15 +83,15 @@ describe("export", () => {
7783
7884 // Schema only
7985 await runWrangler (
80- "d1 export db --local -- output test-schema.sql --no-data"
86+ "d1 export db --output test-schema.sql --no-data"
8187 ) ;
8288 expect ( fs . readFileSync ( "test-schema.sql" , "utf8" ) ) . toBe (
8389 [ "PRAGMA defer_foreign_keys=TRUE;" , create_foo , create_bar ] . join ( "\n" )
8490 ) ;
8591
8692 // Data only
8793 await runWrangler (
88- "d1 export db --local -- output test-data.sql --no-schema"
94+ "d1 export db --output test-data.sql --no-schema"
8995 ) ;
9096 expect ( fs . readFileSync ( "test-data.sql" , "utf8" ) ) . toBe (
9197 [ "PRAGMA defer_foreign_keys=TRUE;" , ...insert_foo , ...insert_bar ] . join (
@@ -95,7 +101,7 @@ describe("export", () => {
95101
96102 // Foo only
97103 await runWrangler (
98- "d1 export db --local -- output test-data.sql --table foo"
104+ "d1 export db --output test-data.sql --table foo"
99105 ) ;
100106 expect ( fs . readFileSync ( "test-data.sql" , "utf8" ) ) . toBe (
101107 [ "PRAGMA defer_foreign_keys=TRUE;" , create_foo , ...insert_foo ] . join ( "\n" )
0 commit comments