2019-06-11 23:06:47 +02:00
|
|
|
import { expect } from 'chai';
|
|
|
|
|
|
|
|
import { PostProcessorInterface } from '../../src/post-processors/post-processor.interface';
|
|
|
|
import { PurgeObsoleteKeysPostProcessor } from '../../src/post-processors/purge-obsolete-keys.post-processor';
|
|
|
|
import { TranslationCollection } from '../../src/utils/translation.collection';
|
|
|
|
|
2019-06-12 11:50:23 +02:00
|
|
|
describe('PurgeObsoleteKeysPostProcessor', () => {
|
2019-09-18 14:16:47 +02:00
|
|
|
let postProcessor: PostProcessorInterface;
|
2019-06-11 23:06:47 +02:00
|
|
|
|
|
|
|
beforeEach(() => {
|
2019-09-18 14:16:47 +02:00
|
|
|
postProcessor = new PurgeObsoleteKeysPostProcessor();
|
2019-06-11 23:06:47 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should purge obsolete keys', () => {
|
2019-09-18 14:16:47 +02:00
|
|
|
const draft = new TranslationCollection({
|
2019-06-11 23:06:47 +02:00
|
|
|
'I am completely new': '',
|
|
|
|
'I already exist': '',
|
|
|
|
'I already exist but was not present in extract': ''
|
|
|
|
});
|
|
|
|
const extracted = new TranslationCollection({
|
|
|
|
'I am completely new': '',
|
|
|
|
'I already exist': ''
|
|
|
|
});
|
|
|
|
const existing = new TranslationCollection({
|
|
|
|
'I already exist': '',
|
|
|
|
'I already exist but was not present in extract': ''
|
|
|
|
});
|
|
|
|
|
2019-09-18 14:16:47 +02:00
|
|
|
expect(postProcessor.process(draft, extracted, existing).values).to.deep.equal({
|
2019-06-11 23:06:47 +02:00
|
|
|
'I am completely new': '',
|
|
|
|
'I already exist': ''
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|