Skip to content

Commit

Permalink
test: improve esm tests
Browse files Browse the repository at this point in the history
  • Loading branch information
remarkablemark committed Jan 10, 2024
1 parent 25ab9e2 commit 3d1a1cf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 20 additions & 1 deletion src/index.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,33 @@ import { it } from 'node:test';

import assert from 'assert';

import { createElement, Image, jsx, render, Video } from '../cjs/index.js';
import {
createElement,
createRef,
Image,
jsx,
render,
Video,
} from '../cjs/index.js';

[createElement, Image, render, Video].forEach((func) => {
it(`exports ${func.name}`, () => {
assert.strictEqual(typeof func, 'function');
});
});

it('exports createElement', () => {
assert.deepEqual(createElement(Image, { x: 42 }), {
key: null,
props: { x: 42 },
type: Image,
});
});

it('exports createRef', () => {
assert.deepEqual(createRef(), { current: null });
});

it('exports jsx', () => {
assert.strictEqual(jsx, createElement);
});
2 changes: 1 addition & 1 deletion src/render/gameobject.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Phaser from 'phaser';
import type { JSX } from 'react';

import { Container, createRef } from '..';
import { Container } from '..';
import { createGameObject } from './gameobject';

jest.mock('phaser', () => {
Expand Down

0 comments on commit 3d1a1cf

Please sign in to comment.