15 lines
		
	
	
		
			373 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
		
		
			
		
	
	
			15 lines
		
	
	
		
			373 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| 
								 | 
							
								import { expect } from "chai";
							 | 
						||
| 
								 | 
							
								import { init, Keypair } from "crate";
							 | 
						||
| 
								 | 
							
								init();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								describe("Keypair", function () {
							 | 
						||
| 
								 | 
							
								  it("works", () => {
							 | 
						||
| 
								 | 
							
								    const keypair = new Keypair();
							 | 
						||
| 
								 | 
							
								    let bytes = keypair.toBytes();
							 | 
						||
| 
								 | 
							
								    expect(bytes).to.have.length(64);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    const recoveredKeypair = Keypair.fromBytes(bytes);
							 | 
						||
| 
								 | 
							
								    expect(keypair.pubkey().equals(recoveredKeypair.pubkey()));
							 | 
						||
| 
								 | 
							
								  });
							 | 
						||
| 
								 | 
							
								});
							 |