-
Notifications
You must be signed in to change notification settings - Fork 185
Expand file tree
/
Copy pathbaseWebGlObject.test.ts
More file actions
27 lines (24 loc) · 938 Bytes
/
baseWebGlObject.test.ts
File metadata and controls
27 lines (24 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { BaseWebGlObject } from "../../../../src/backend/webGlObjects/baseWebGlObject";
class ConcreteWebGlObject extends BaseWebGlObject {
get typeName(): string {
return "WebGLTexture";
}
}
describe('BaseWebGlObject', () => {
it('type getter returns the global constructor when it exists', () => {
const obj = new ConcreteWebGlObject();
// WebGLTexture may or may not exist in jsdom; just verify no crash
const type = obj.type;
// Should return a function or null, never throw
expect(type === null || typeof type === 'function').toBe(true);
});
it('type getter returns null for unknown type names', () => {
class UnknownObject extends BaseWebGlObject {
get typeName(): string {
return "__NonExistent_Type_12345__";
}
}
const obj = new UnknownObject();
expect(obj.type).toBeNull();
});
});