mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-30 18:12:45 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			16 lines
		
	
	
	
		
			387 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
	
		
			387 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| test("basic functionality", () => {
 | |
|     expect(typeof this).toBe("object");
 | |
|     expect(this).toBe(globalThis);
 | |
| });
 | |
| 
 | |
| test("this inside instantiated functions is not globalThis", () => {
 | |
|     let functionThis;
 | |
|     function Foo() {
 | |
|         this.x = 5;
 | |
|         functionThis = this;
 | |
|     }
 | |
| 
 | |
|     new Foo();
 | |
|     expect(typeof functionThis).toBe("object");
 | |
|     expect(functionThis.x).toBe(5);
 | |
| });
 | 
