UNPKG

boats

Version:

Beautiful Open / Async Template System - Write less yaml with BOATS and Nunjucks.

85 lines (83 loc) 3.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const calculateIndentFromLineBreak_1 = tslib_1.__importDefault(require("../calculateIndentFromLineBreak")); describe('calculateIndentFromLineBreak', () => { it('check 4 space indent from start of file', () => { const str = ' Weathers: type'; const pointer = (0, calculateIndentFromLineBreak_1.default)(str, 14); expect(pointer).toEqual(4); }); it('check 2 space indent from start of file', () => { const str = ' Weathers: type'; const pointer = (0, calculateIndentFromLineBreak_1.default)(str, 12); expect(pointer).toEqual(2); }); it('check 0 space indent from start of file', () => { const str = 'Weathers: type'; const pointer = (0, calculateIndentFromLineBreak_1.default)(str, 12); expect(pointer).toEqual(0); }); it('check 0 space indent from start of new line', () => { const str = ` Weathers: type`; const pointer = (0, calculateIndentFromLineBreak_1.default)(str, 12); expect(pointer).toEqual(0); }); it('check 2 space indent from start after new line', () => { const str = ` Weathers: type`; const pointer = (0, calculateIndentFromLineBreak_1.default)(str, 12); expect(pointer).toEqual(2); }); it('check 0 space indent not from start of new line', () => { const str = ` Weathers: type Weathers: type`; const pointer = (0, calculateIndentFromLineBreak_1.default)(str, 27); expect(pointer).toEqual(0); }); it('check 0 space indent not from start of new line but after a new line', () => { const str = ` Weathers: type Weathers: type`; const pointer = (0, calculateIndentFromLineBreak_1.default)(str, 27); expect(pointer).toEqual(0); }); it('check 2 space indent from start of new line', () => { const str = ` Weathers: type`; const pointer = (0, calculateIndentFromLineBreak_1.default)(str, 12); expect(pointer).toEqual(2); }); it('check 2 space indent from not start of new line', () => { const str = ` Weathers: type Weathers: type`; const pointer = (0, calculateIndentFromLineBreak_1.default)(str, 33); expect(pointer).toEqual(2); }); it('check 4 space indent from not start of new line', () => { const str = ` Weathers: type Weathers: type`; const pointer = (0, calculateIndentFromLineBreak_1.default)(str, 35); expect(pointer).toEqual(4); }); it('check 4 space indent from not start of new line', () => { const str = ` Weathers: type Weathers: type Weathers: type`; const pointer = (0, calculateIndentFromLineBreak_1.default)(str, 54); expect(pointer).toEqual(4); }); it('check 4 space indent from not start of new line', () => { const str = ` Weathers: type Weathers: type Weathers: type`; const pointer = (0, calculateIndentFromLineBreak_1.default)(str, 56); expect(pointer).toEqual(6); }); });