@@ -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 (
28+ runWrangler ( "d1 export db --local --remote --output test-local.sql" )
29+ ) . rejects . toThrowError ( "Arguments local and remote are mutually exclusive" ) ;
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;" ,
@@ -76,27 +82,21 @@ describe("export", () => {
7682 ) ;
7783
7884 // Schema only
79- await runWrangler (
80- "d1 export db --local --output test-schema.sql --no-data"
81- ) ;
85+ await runWrangler ( "d1 export db --output test-schema.sql --no-data" ) ;
8286 expect ( fs . readFileSync ( "test-schema.sql" , "utf8" ) ) . toBe (
8387 [ "PRAGMA defer_foreign_keys=TRUE;" , create_foo , create_bar ] . join ( "\n" )
8488 ) ;
8589
8690 // Data only
87- await runWrangler (
88- "d1 export db --local --output test-data.sql --no-schema"
89- ) ;
91+ await runWrangler ( "d1 export db --output test-data.sql --no-schema" ) ;
9092 expect ( fs . readFileSync ( "test-data.sql" , "utf8" ) ) . toBe (
9193 [ "PRAGMA defer_foreign_keys=TRUE;" , ...insert_foo , ...insert_bar ] . join (
9294 "\n"
9395 )
9496 ) ;
9597
9698 // Foo only
97- await runWrangler (
98- "d1 export db --local --output test-data.sql --table foo"
99- ) ;
99+ await runWrangler ( "d1 export db --output test-data.sql --table foo" ) ;
100100 expect ( fs . readFileSync ( "test-data.sql" , "utf8" ) ) . toBe (
101101 [ "PRAGMA defer_foreign_keys=TRUE;" , create_foo , ...insert_foo ] . join ( "\n" )
102102 ) ;
0 commit comments