@instructure/quiz-interactions
Version:
A React UI component Library for quiz interaction types.
26 lines (23 loc) • 759 B
JavaScript
import {vi} from 'vitest'
import {ellipse} from '../ellipsePolyfill'
// NOTE: outside of IE this test won't be too useful, but once
// we test in multiple browsers this will be a valid check
describe('ellipsePolyfill', () => {
it('is not missing the canvas ellipse function', () => {
expect(typeof CanvasRenderingContext2D.prototype.ellipse).toBe('function')
})
it('calls a bunch of other canvas functions', () => {
const mockCanvas = {
save: vi.fn(),
translate: vi.fn(),
rotate: vi.fn(),
scale: vi.fn(),
arc: vi.fn(),
restore: vi.fn(),
}
ellipse.call(mockCanvas, 0, 0, 10, 10, 0, 0, 45, true)
Object.values(mockCanvas).forEach(mock => {
expect(mock).toHaveBeenCalledOnce()
})
})
})