(chore) run prettier
This commit is contained in:
@@ -4,7 +4,6 @@ import { TranslationCollection } from '../../src/utils/translation.collection';
|
||||
import { NamespacedJsonCompiler } from '../../src/compilers/namespaced-json.compiler';
|
||||
|
||||
describe('NamespacedJsonCompiler', () => {
|
||||
|
||||
let compiler: NamespacedJsonCompiler;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -23,7 +22,10 @@ describe('NamespacedJsonCompiler', () => {
|
||||
}
|
||||
`;
|
||||
const collection: TranslationCollection = compiler.parse(contents);
|
||||
expect(collection.values).to.deep.equal({'NAMESPACE.KEY.FIRST_KEY': '', 'NAMESPACE.KEY.SECOND_KEY': 'VALUE' });
|
||||
expect(collection.values).to.deep.equal({
|
||||
'NAMESPACE.KEY.FIRST_KEY': '',
|
||||
'NAMESPACE.KEY.SECOND_KEY': 'VALUE'
|
||||
});
|
||||
});
|
||||
|
||||
it('should unflatten keys on compile', () => {
|
||||
@@ -59,11 +61,10 @@ describe('NamespacedJsonCompiler', () => {
|
||||
|
||||
it('should not reorder keys when compiled', () => {
|
||||
const collection = new TranslationCollection({
|
||||
'BROWSE': '',
|
||||
'LOGIN': ''
|
||||
BROWSE: '',
|
||||
LOGIN: ''
|
||||
});
|
||||
const result: string = compiler.compile(collection);
|
||||
expect(result).to.equal('{\n\t"BROWSE": "",\n\t"LOGIN": ""\n}');
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -3,7 +3,6 @@ import { expect } from 'chai';
|
||||
import { DirectiveParser } from '../../src/parsers/directive.parser';
|
||||
|
||||
describe('DirectiveParser', () => {
|
||||
|
||||
const templateFilename: string = 'test.template.html';
|
||||
const componentFilename: string = 'test.component.ts';
|
||||
|
||||
@@ -86,5 +85,4 @@ describe('DirectiveParser', () => {
|
||||
const keys = parser.extract(contents, componentFilename).keys();
|
||||
expect(keys).to.deep.equal([]);
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -3,7 +3,6 @@ import { expect } from 'chai';
|
||||
import { MarkerParser } from '../../src/parsers/marker.parser';
|
||||
|
||||
describe('MarkerParser', () => {
|
||||
|
||||
const componentFilename: string = 'test.component.ts';
|
||||
|
||||
let parser: MarkerParser;
|
||||
@@ -12,7 +11,6 @@ describe('MarkerParser', () => {
|
||||
parser = new MarkerParser();
|
||||
});
|
||||
|
||||
|
||||
it('should extract strings using marker function', () => {
|
||||
const contents = `
|
||||
import { marker } from '@biesbjerg/ngx-translate-extract-marker';
|
||||
@@ -35,11 +33,6 @@ describe('MarkerParser', () => {
|
||||
_('Mix ' + \`of \` + 'different ' + \`types\`);
|
||||
`;
|
||||
const keys = parser.extract(contents, componentFilename).keys();
|
||||
expect(keys).to.deep.equal([
|
||||
'Hello world',
|
||||
'This is a very very very very long line.',
|
||||
'Mix of different types'
|
||||
]);
|
||||
expect(keys).to.deep.equal(['Hello world', 'This is a very very very very long line.', 'Mix of different types']);
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -3,7 +3,6 @@ import { expect } from 'chai';
|
||||
import { PipeParser } from '../../src/parsers/pipe.parser';
|
||||
|
||||
describe('PipeParser', () => {
|
||||
|
||||
const templateFilename: string = 'test.template.html';
|
||||
|
||||
let parser: PipeParser;
|
||||
@@ -118,5 +117,4 @@ describe('PipeParser', () => {
|
||||
const keys = parser.extract(contents, templateFilename).keys();
|
||||
expect(keys).to.deep.equal(['message']);
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -2,12 +2,9 @@ import { expect } from 'chai';
|
||||
|
||||
import { ServiceParser } from '../../src/parsers/service.parser';
|
||||
|
||||
class TestServiceParser extends ServiceParser {
|
||||
|
||||
}
|
||||
class TestServiceParser extends ServiceParser {}
|
||||
|
||||
describe('ServiceParser', () => {
|
||||
|
||||
const componentFilename: string = 'test.component.ts';
|
||||
|
||||
let parser: TestServiceParser;
|
||||
@@ -44,7 +41,7 @@ describe('ServiceParser', () => {
|
||||
expect(keys).to.deep.equal(['Fallback message']);
|
||||
});
|
||||
|
||||
it('should extract strings in TranslateService\'s get() method', () => {
|
||||
it("should extract strings in TranslateService's get() method", () => {
|
||||
const contents = `
|
||||
@Component({ })
|
||||
export class AppComponent {
|
||||
@@ -57,7 +54,7 @@ describe('ServiceParser', () => {
|
||||
expect(keys).to.deep.equal(['Hello World']);
|
||||
});
|
||||
|
||||
it('should extract strings in TranslateService\'s instant() method', () => {
|
||||
it("should extract strings in TranslateService's instant() method", () => {
|
||||
const contents = `
|
||||
@Component({ })
|
||||
export class AppComponent {
|
||||
@@ -70,7 +67,7 @@ describe('ServiceParser', () => {
|
||||
expect(keys).to.deep.equal(['Hello World']);
|
||||
});
|
||||
|
||||
it('should extract strings in TranslateService\'s stream() method', () => {
|
||||
it("should extract strings in TranslateService's stream() method", () => {
|
||||
const contents = `
|
||||
@Component({ })
|
||||
export class AppComponent {
|
||||
@@ -83,7 +80,7 @@ describe('ServiceParser', () => {
|
||||
expect(keys).to.deep.equal(['Hello World']);
|
||||
});
|
||||
|
||||
it('should extract array of strings in TranslateService\'s get() method', () => {
|
||||
it("should extract array of strings in TranslateService's get() method", () => {
|
||||
const contents = `
|
||||
@Component({ })
|
||||
export class AppComponent {
|
||||
@@ -96,7 +93,7 @@ describe('ServiceParser', () => {
|
||||
expect(keys).to.deep.equal(['Hello', 'World']);
|
||||
});
|
||||
|
||||
it('should extract array of strings in TranslateService\'s instant() method', () => {
|
||||
it("should extract array of strings in TranslateService's instant() method", () => {
|
||||
const contents = `
|
||||
@Component({ })
|
||||
export class AppComponent {
|
||||
@@ -109,7 +106,7 @@ describe('ServiceParser', () => {
|
||||
expect(key).to.deep.equal(['Hello', 'World']);
|
||||
});
|
||||
|
||||
it('should extract array of strings in TranslateService\'s stream() method', () => {
|
||||
it("should extract array of strings in TranslateService's stream() method", () => {
|
||||
const contents = `
|
||||
@Component({ })
|
||||
export class AppComponent {
|
||||
@@ -298,5 +295,4 @@ describe('ServiceParser', () => {
|
||||
const keys = parser.extract(contents, componentFilename).keys();
|
||||
expect(keys).to.deep.equal(['Back']);
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -3,7 +3,6 @@ import { expect } from 'chai';
|
||||
import { isPathAngularComponent, extractComponentInlineTemplate } from '../../src/utils/utils';
|
||||
|
||||
describe('Utils', () => {
|
||||
|
||||
it('should recognize js extension as angular component', () => {
|
||||
const result = isPathAngularComponent('test.js');
|
||||
expect(result).to.equal(true);
|
||||
@@ -63,5 +62,4 @@ describe('Utils', () => {
|
||||
const template = extractComponentInlineTemplate(contents);
|
||||
expect(template).to.equal('\n\t\t\t\t\t<p>\n\t\t\t\t\t\tHello World\n\t\t\t\t\t</p>\n\t\t\t\t');
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -5,7 +5,6 @@ import { KeyAsDefaultValuePostProcessor } from '../../src/post-processors/key-as
|
||||
import { TranslationCollection } from '../../src/utils/translation.collection';
|
||||
|
||||
describe('KeyAsDefaultValuePostProcessor', () => {
|
||||
|
||||
let processor: PostProcessorInterface;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -27,5 +26,4 @@ describe('KeyAsDefaultValuePostProcessor', () => {
|
||||
'Use this key as value as well': 'Use this key as value as well'
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -5,7 +5,6 @@ import { NullAsDefaultValuePostProcessor } from '../../src/post-processors/null-
|
||||
import { TranslationCollection } from '../../src/utils/translation.collection';
|
||||
|
||||
describe('NullAsDefaultValuePostProcessor', () => {
|
||||
|
||||
let processor: PostProcessorInterface;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -38,5 +37,4 @@ describe('NullAsDefaultValuePostProcessor', () => {
|
||||
'String A': 'Streng A'
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -5,15 +5,14 @@ import { PurgeObsoleteKeysPostProcessor } from '../../src/post-processors/purge-
|
||||
import { TranslationCollection } from '../../src/utils/translation.collection';
|
||||
|
||||
describe('PurgeObsoleteKeysPostProcessor', () => {
|
||||
|
||||
let processor: PostProcessorInterface;
|
||||
let postProcessor: PostProcessorInterface;
|
||||
|
||||
beforeEach(() => {
|
||||
processor = new PurgeObsoleteKeysPostProcessor();
|
||||
postProcessor = new PurgeObsoleteKeysPostProcessor();
|
||||
});
|
||||
|
||||
it('should purge obsolete keys', () => {
|
||||
const collection = new TranslationCollection({
|
||||
const draft = new TranslationCollection({
|
||||
'I am completely new': '',
|
||||
'I already exist': '',
|
||||
'I already exist but was not present in extract': ''
|
||||
@@ -27,10 +26,9 @@ describe('PurgeObsoleteKeysPostProcessor', () => {
|
||||
'I already exist but was not present in extract': ''
|
||||
});
|
||||
|
||||
expect(processor.process(collection, extracted, existing).values).to.deep.equal({
|
||||
expect(postProcessor.process(draft, extracted, existing).values).to.deep.equal({
|
||||
'I am completely new': '',
|
||||
'I already exist': ''
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -5,7 +5,6 @@ import { SortByKeyPostProcessor } from '../../src/post-processors/sort-by-key.po
|
||||
import { TranslationCollection } from '../../src/utils/translation.collection';
|
||||
|
||||
describe('SortByKeyPostProcessor', () => {
|
||||
|
||||
let processor: PostProcessorInterface;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -14,20 +13,19 @@ describe('SortByKeyPostProcessor', () => {
|
||||
|
||||
it('should sort keys alphanumerically', () => {
|
||||
const collection = new TranslationCollection({
|
||||
'z': 'last value',
|
||||
'a': 'a value',
|
||||
z: 'last value',
|
||||
a: 'a value',
|
||||
'9': 'a numeric key',
|
||||
'b': 'another value'
|
||||
b: 'another value'
|
||||
});
|
||||
const extracted = new TranslationCollection();
|
||||
const existing = new TranslationCollection();
|
||||
|
||||
expect(processor.process(collection, extracted, existing).values).to.deep.equal({
|
||||
'9': 'a numeric key',
|
||||
'a': 'a value',
|
||||
'b': 'another value',
|
||||
'z': 'last value'
|
||||
a: 'a value',
|
||||
b: 'another value',
|
||||
z: 'last value'
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
@@ -3,7 +3,6 @@ import { expect } from 'chai';
|
||||
import { TranslationCollection } from '../../src/utils/translation.collection';
|
||||
|
||||
describe('StringCollection', () => {
|
||||
|
||||
let collection: TranslationCollection;
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -64,12 +63,15 @@ describe('StringCollection', () => {
|
||||
it('should merge with other collection', () => {
|
||||
collection = collection.add('oldKey', 'oldVal');
|
||||
const newCollection = new TranslationCollection({ newKey: 'newVal' });
|
||||
expect(collection.union(newCollection).values).to.deep.equal({ oldKey: 'oldVal', newKey: 'newVal' });
|
||||
expect(collection.union(newCollection).values).to.deep.equal({
|
||||
oldKey: 'oldVal',
|
||||
newKey: 'newVal'
|
||||
});
|
||||
});
|
||||
|
||||
it('should intersect with passed collection', () => {
|
||||
collection = collection.addKeys(['red', 'green', 'blue']);
|
||||
const newCollection = new TranslationCollection( { red: '', blue: '' });
|
||||
const newCollection = new TranslationCollection({ red: '', blue: '' });
|
||||
expect(collection.intersect(newCollection).values).to.deep.equal({ red: '', blue: '' });
|
||||
});
|
||||
|
||||
@@ -88,7 +90,10 @@ describe('StringCollection', () => {
|
||||
it('should map values', () => {
|
||||
collection = new TranslationCollection({ red: 'rød', green: 'grøn', blue: 'blå' });
|
||||
collection = collection.map((key, val) => 'mapped value');
|
||||
expect(collection.values).to.deep.equal({ red: 'mapped value', green: 'mapped value', blue: 'mapped value' });
|
||||
expect(collection.values).to.deep.equal({
|
||||
red: 'mapped value',
|
||||
green: 'mapped value',
|
||||
blue: 'mapped value'
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user