Skip to content

Instantly share code, notes, and snippets.

@kalwalt
Created March 25, 2023 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kalwalt/fad9f879887a265583dfb8c51fa7ca14 to your computer and use it in GitHub Desktop.
Save kalwalt/fad9f879887a265583dfb8c51fa7ca14 to your computer and use it in GitHub Desktop.
Failing jest test for WebARKitCV class.
/**
* @jest-environment jsdom
*/
import {describe, expect, test} from '@jest/globals';
import { WebARKitCV } from '../src/WebARKitCV';
describe('Init WebARKitCV and test the properties', () => {
test('Init the constructor...', () => {
document.body.innerHTML = '<img src="pinball.jpg" id="pinball" />';
const wb = new WebARKitCV()
.setHeight(480)
.setWidth(640)
.addTrackable("pinball", "./pinball.jpg")
.loadTrackables()
.build();
expect(wb.height).toBe(480);
expect(wb.width).toBe(640);
expect(wb!.trackable!.name).toBe("pinball");
expect(wb!.trackable!.url).toBe("./pinball.jpg");
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment