diff --git a/tests/.env.test b/tests/.env.test index 9cb9c88..bdfbd45 100644 --- a/tests/.env.test +++ b/tests/.env.test @@ -53,3 +53,15 @@ ONETWO=${ONE}${TWO} ONETWO_SIMPLE=${ONE}$TWO ONETWO_SIMPLE2=$ONE${TWO} ONETWO_SUPER_SIMPLE=$ONE$TWO + +TWO_DOLLAR_SIGNS="abcd$$1234" + +# https://github.com/motdotla/dotenv-expand/issues/80 +DONT_CHOKE1='.kZh`>4[,[DDU-*Jt+[;8-,@K=,9%;F9KsoXqOE)gpG^X!{)Q+/9Fc(QF}i[NEi!' +DONT_CHOKE2='=;+=CNy3)-D=zI6gRP2w\$B@0K;Y]e^EFnCmx\$Dx?;.9wf-rgk1BcTR0]JtY { ct.end() }) + +t.test('handles two dollar signs', ct => { + const dotenv = require('dotenv').config({ path: 'tests/.env.test', processEnv: {} }) + const parsed = dotenvExpand.expand(dotenv).parsed + + ct.equal(parsed.TWO_DOLLAR_SIGNS, 'abcd$') + + ct.end() +}) + +t.test('does not choke', ct => { + const dotenv = require('dotenv').config({ path: 'tests/.env.test', processEnv: {} }) + const parsed = dotenvExpand.expand(dotenv).parsed + + ct.equal(parsed.DONT_CHOKE1, '.kZh`>4[,[DDU-*Jt+[;8-,@K=,9%;F9KsoXqOE)gpG^X!{)Q+/9Fc(QF}i[NEi!') + ct.equal(parsed.DONT_CHOKE2, '=;+=CNy3)-D=zI6gRP2w$B@0K;Y]e^EFnCmx$Dx?;.9wf-rgk1BcTR0]JtY&fw;>HEwms`D8E2H') + ct.equal(parsed.DONT_CHOKE4, 'm]zjzfRItw2gs[2:{p{ugENyFw9m)tH6_VCQzer`*noVaIMunx=[1-AMgAcwmPkToxTaB?kgdF5y`A8m=Oa-B!)') + ct.equal(parsed.DONT_CHOKE6, 'xlC&*