mirror of
https://github.com/tenrok/BBob.git
synced 2026-05-15 11:59:37 +03:00
8797f7f363
* feat: initial typescript support * feat: typescript support * feat(plugin-helper): move files to typescript * chore: update lock files * feat: preset types * fix: build * fix: benchmark * fix: remove pnpm cache * fix: bench action * fix: pnpm recursive install * fix: nx cache * fix: lock file * fix: workflows * fix: lerna support in pnpm * fix: pnpm workspace * fix: remove unused files * fix: pnpm lock file * fix: update lerna for support pnpm * fix: lerna bootstrap * fix: rollup build * fix: update nx * fix: build * fix: add nx dep target * fix: remove nx cache * fix: workflow run on push only for master * fix: test workflow run on push only for master * fix: remove parallel for gen types * fix: benchmark * fix: benchmark imports * fix: pnpm * fix: types errors and pnpm * fix: types * fix: types * refactor: parser * fix(parser): tests * fix: preset tests * fix: react types * fix: react type declarations * fix: pnpm lock file * fix: react preset types * fix: lock file * fix: vue2 types * feat: dev container support * fix: types * fix: types * refactor: rewrite pkg-task, add nx gen-types deps, fix react/render.ts * refactor: types * fix: types * fix: rename gen-types to types * fix: nx build order * fix: nx reset * fix: define nx deps explicit * fix: build * fix: nx * fix: nx order build * fix: nx deps * fix: bbob cli tests * fix: tests * fix: cli tests and import * fix: test cover * fix: cli cover
69 lines
1.7 KiB
TypeScript
69 lines
1.7 KiB
TypeScript
import Token, { TYPE_WORD, TYPE_TAG, TYPE_ATTR_NAME, TYPE_ATTR_VALUE, TYPE_SPACE, TYPE_NEW_LINE } from '../src/Token'
|
|
|
|
describe('Token', () => {
|
|
test('isEmpty', () => {
|
|
const token = new Token();
|
|
|
|
expect(token.isEmpty()).toBeTruthy()
|
|
});
|
|
test('isText', () => {
|
|
const token = new Token(TYPE_WORD);
|
|
|
|
expect(token.isText()).toBeTruthy();
|
|
});
|
|
test('isTag', () => {
|
|
const token = new Token(TYPE_TAG);
|
|
|
|
expect(token.isTag()).toBeTruthy();
|
|
});
|
|
test('isAttrName', () => {
|
|
const token = new Token(TYPE_ATTR_NAME);
|
|
|
|
expect(token.isAttrName()).toBeTruthy();
|
|
});
|
|
test('isAttrValue', () => {
|
|
const token = new Token(TYPE_ATTR_VALUE);
|
|
|
|
expect(token.isAttrValue()).toBeTruthy();
|
|
});
|
|
test('isStart', () => {
|
|
const token = new Token(TYPE_TAG, 'my-tag');
|
|
|
|
expect(token.isStart()).toBeTruthy();
|
|
});
|
|
test('isEnd', () => {
|
|
const token = new Token(TYPE_TAG, '/my-tag');
|
|
|
|
expect(token.isEnd()).toBeTruthy();
|
|
});
|
|
test('getName', () => {
|
|
const token = new Token(TYPE_TAG, '/my-tag');
|
|
|
|
expect(token.getName()).toBe('my-tag');
|
|
});
|
|
test('getValue', () => {
|
|
const token = new Token(TYPE_TAG, '/my-tag');
|
|
|
|
expect(token.getValue()).toBe('/my-tag');
|
|
});
|
|
test('getLine', () => {
|
|
const token = new Token(TYPE_TAG, '/my-tag', 12);
|
|
|
|
expect(token.getLine()).toBe(12);
|
|
});
|
|
test('getColumn', () => {
|
|
const token = new Token(TYPE_TAG, '/my-tag', 12, 14);
|
|
|
|
expect(token.getColumn()).toBe(14);
|
|
});
|
|
test('toString', () => {
|
|
const tokenEnd = new Token(TYPE_TAG, '/my-tag', 12, 14);
|
|
|
|
expect(tokenEnd.toString()).toBe('[/my-tag]');
|
|
|
|
const tokenStart = new Token(TYPE_TAG, 'my-tag', 12, 14);
|
|
|
|
expect(tokenStart.toString()).toBe('[my-tag]');
|
|
});
|
|
});
|