constants_replacements_spec.js 858 B

12345678910111213141516171819202122232425262728293031
  1. 'use strict';
  2. const chai = require('chai');
  3. const sinon = require('sinon');
  4. const sinonChai = require('sinon-chai');
  5. const expect = chai.expect;
  6. chai.use(sinonChai);
  7. describe("Constants replacement in ini files", function () {
  8. var MultiIni = require('../src');
  9. it("Default replacement if constant found", function () {
  10. var ini = new MultiIni.Class({
  11. constants: {'CONSTANT': 'replacement'},
  12. filters: [MultiIni.filters.constants]
  13. });
  14. var data = ini.read('test/data/constant.ini');
  15. expect(data).not.to.be.null;
  16. expect(data['section']).to.be.defined;
  17. expect(data['section']['key1']).to.equal('"Part1 replacement"');
  18. expect(data['section']['key2']).to.equal('"replacement Part2"');
  19. expect(data['section']['key3']).to.equal('Part1replacementPart2');
  20. });
  21. });