mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	
		
			
	
	
		
			28 lines
		
	
	
		
			740 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			28 lines
		
	
	
		
			740 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
|  | import etapi = require("../support/etapi"); | ||
|  | import fs = require("fs"); | ||
|  | import path = require("path"); | ||
|  | 
 | ||
|  | etapi.describeEtapi("import", () => { | ||
|  |   it("import", async () => { | ||
|  |     const zipFileBuffer = fs.readFileSync( | ||
|  |       path.resolve(__dirname, "test-export.zip") | ||
|  |     ); | ||
|  | 
 | ||
|  |     const response = await etapi.postEtapiContent( | ||
|  |       "notes/root/import", | ||
|  |       zipFileBuffer | ||
|  |     ); | ||
|  |     expect(response.status).toEqual(201); | ||
|  | 
 | ||
|  |     const { note, branch } = await response.json(); | ||
|  | 
 | ||
|  |     expect(note.title).toEqual("test-export"); | ||
|  |     expect(branch.parentNoteId).toEqual("root"); | ||
|  | 
 | ||
|  |     const content = await ( | ||
|  |       await etapi.getEtapiContent(`notes/${note.noteId}/content`) | ||
|  |     ).text(); | ||
|  |     expect(content).toContain("test export content"); | ||
|  |   }); | ||
|  | }); |