test('adding a machine should create a new entry', () => {
const f = `tmp/netrc`
const beforeSave = `machine api.dickeyxxx.com # foo
login [email protected]
password myapikey`
fs.writeFileSync(f, beforeSave)
const netrc = new Netrc(f)
netrc.machines['foo.bar.com'].login = '[email protected]'
netrc.machines['foo.bar.com'].password = 'foopassword'
netrc.save()
const afterSave = `machine api.dickeyxxx.com # foo
login [email protected]
password myapikey
machine foo.bar.com
password foopassword
login [email protected]`
expect(fs.readFileSync(f, 'utf8')).toEqual(afterSave)
})
Difference:
- Expected
+ Received
machine api.dickeyxxx.com # foo
login [email protected]
- password myapikey
-machine foo.bar.com
+ password myapikeymachine foo.bar.com
password foopassword
login [email protected]