Skip to content

Commit

Permalink
demonstrate additional specs
Browse files Browse the repository at this point in the history
  • Loading branch information
motdotla committed Feb 10, 2024
1 parent 4cf6f0e commit 6889895
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -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<S:b_'
DONT_CHOKE3='MUcKSGSY@HCON<1S_siWTP`DgS*Ug],mu]SkqI|7V2eOk9:>&fw;>HEwms`D8E2H'
DONT_CHOKE4='m]zjzfRItw2gs[2:{p{ugENyFw9m)tH6_VCQzer`*noVaI<vqa3?FZ9+6U;K#Bfd'
DONT_CHOKE5='#la__nK?IxNlQ%`5q&DpcZ>Munx=[1-AMgAcwmPkToxTaB?kgdF5y`A8m=Oa-B!)'
DONT_CHOKE6='xlC&*<j4J<d._<JKH0RBJV!4(ZQEN-+&!0p137<g*hdY2H4xk?/;KO1\$(W{:Wc}Q'
DONT_CHOKE7='?\$6)m*xhTVewc#NVVgxX%eBhJjoHYzpXFg=gzn[rWXPLj5UWj@z\$/UDm8o79n/p%'
DONT_CHOKE8='@}:[4#g%[R-CFR});bY(Z[KcDQDsVn2_y4cSdU<Mjy!c^F`G<!Ks7]kbS]N1:bP:'
25 changes: 25 additions & 0 deletions tests/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,3 +388,28 @@ t.test('handles $one$two', ct => {

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<S:b_')
ct.equal(parsed.DONT_CHOKE3, 'MUcKSGSY@HCON<1S_siWTP`DgS*Ug],mu]SkqI|7V2eOk9:>&fw;>HEwms`D8E2H')
ct.equal(parsed.DONT_CHOKE4, 'm]zjzfRItw2gs[2:{p{ugENyFw9m)tH6_VCQzer`*noVaI<vqa3?FZ9+6U;K#Bfd')
ct.equal(parsed.DONT_CHOKE5, '#la__nK?IxNlQ%`5q&DpcZ>Munx=[1-AMgAcwmPkToxTaB?kgdF5y`A8m=Oa-B!)')
ct.equal(parsed.DONT_CHOKE6, 'xlC&*<j4J<d._<JKH0RBJV!4(ZQEN-+&!0p137<g*hdY2H4xk?/;KO1$(W{:Wc}Q')
ct.equal(parsed.DONT_CHOKE7, '?$6)m*xhTVewc#NVVgxX%eBhJjoHYzpXFg=gzn[rWXPLj5UWj@z$/UDm8o79n/p%')
ct.equal(parsed.DONT_CHOKE8, '@}:[4#g%[R-CFR});bY(Z[KcDQDsVn2_y4cSdU<Mjy!c^F`G<!Ks7]kbS]N1:bP:')

ct.end()
})

0 comments on commit 6889895

Please sign in to comment.