cream-and-sugar
Version:
A deliciously functional syntax for JavaScript with native support for JSX
18 lines (13 loc) • 496 B
JavaScript
import assert from 'assert';
import { shrink } from './utils';
import { compileCode } from '../src/compiler/compiler';
describe('Atoms', () => {
it('should compile an atom into a symbol', () => {
const toCompile = 'ATOM';
assert.equal(compileCode(toCompile).trim(), "Symbol.for('ATOM');");
});
it('should compile an atom into an object key', () => {
const toCompile = '{ATOM:foo}';
assert.equal(shrink(compileCode(toCompile)), "{[Symbol.for('ATOM')]:foo};");
});
});