Permalink
Browse files

[test] further expanded test to actually check saved files and update…

… env with load
  • Loading branch information...
1 parent 2b1ccf9 commit 409f7ccbe3525f384b43b4a01d6893403d39d019 @blakmatrix blakmatrix committed Dec 11, 2012
Showing with 23 additions and 8 deletions.
  1. +23 −8 test/commands/env-test.js
@@ -332,8 +332,10 @@ vows.describe('jitsu/commands/env').addBatch({
snapshots: [{ filename: 'FILENAME' }]
}
}, { 'x-powered-by': 'Nodejitsu' });
- }
- )
+ },
+ function assertion (err) {
+ assert.ok(!err && fs.existsSync('env.json'));
+ })
}).addBatch({
'env save barbaz': shouldNodejitsuOk('The specified app should save enviroment variables',
function setup() {
@@ -350,6 +352,9 @@ vows.describe('jitsu/commands/env').addBatch({
snapshots: [{ filename: 'FILENAME' }]
}
}, { 'x-powered-by': 'Nodejitsu' });
+ },
+ function assertion (err) {
+ assert.ok(!err && fs.existsSync('env.json'));
}
)
}).addBatch({
@@ -374,6 +379,9 @@ vows.describe('jitsu/commands/env').addBatch({
snapshots: [{ filename: 'FILENAME' }]
}
}, { 'x-powered-by': 'Nodejitsu' });
+ },
+ function assertion (err) {
+ assert.ok(!err && fs.existsSync('env_vars.json'));
}
)
}).addBatch({
@@ -392,12 +400,16 @@ vows.describe('jitsu/commands/env').addBatch({
snapshots: [{ filename: 'FILENAME' }]
}
}, { 'x-powered-by': 'Nodejitsu' });
+ },
+ function assertion (err) {
+ assert.ok(!err && fs.existsSync('env_vars.json'));
}
)
}).addBatch({
'env load': shouldNodejitsuOk('The current app should load enviroment variables from env.json',
function setup() {
jitsu.prompt.override.confirm = 'yes';
+ fs.writeFileSync('env.json', JSON.stringify({ foo: 'bar', baz: 'buzz', test: 'truthy1' }, null, 2), 'utf8');
nock('http://api.mockjitsu.com')
.get('/apps/tester/jitsu')
.reply(200, {
@@ -410,14 +422,15 @@ vows.describe('jitsu/commands/env').addBatch({
snapshots: [{ filename: 'FILENAME' }]
}
}, { 'x-powered-by': 'Nodejitsu' })
- .put('/apps/tester/application', { env: { foo: 'bar', baz: 'buzz', test: 'truthy' } })
+ .put('/apps/tester/application', { env: { foo: 'bar', baz: 'buzz', test: 'truthy1' } })
.reply(200, '', { 'x-powered-by': 'Nodejitsu' });
}
)
}).addBatch({
'env load barbaz': shouldNodejitsuOk('The specified app should load enviroment variables from env.json',
function setup() {
jitsu.prompt.override.confirm = 'yes';
+ fs.writeFileSync('env.json', JSON.stringify({ foo: 'bar', baz: 'buzz', test: 'truthy1' }, null, 2), 'utf8');
nock('http://api.mockjitsu.com')
.get('/apps/tester/barbaz')
.reply(200, {
@@ -430,14 +443,15 @@ vows.describe('jitsu/commands/env').addBatch({
snapshots: [{ filename: 'FILENAME' }]
}
}, { 'x-powered-by': 'Nodejitsu' })
- .put('/apps/tester/barbaz', { env: { foo: 'bar', baz: 'buzz', test: 'truthy' } })
+ .put('/apps/tester/barbaz', { env: { foo: 'bar', baz: 'buzz', test: 'truthy1' } })
.reply(200, '', { 'x-powered-by': 'Nodejitsu' });
}
)
}).addBatch({
'env load env_vars.json': shouldNodejitsuOk('The current app should load enviroment variables from the specified file',
function setup() {
jitsu.prompt.override.confirm = 'yes';
+ fs.writeFileSync('env_vars.json', JSON.stringify({ foo: 'bar', baz: 'buzz', test: 'truthy2' }, null, 2), 'utf8');
nock('http://api.mockjitsu.com')
.get('/apps/tester/env_vars.json')
.reply(400, {
@@ -450,33 +464,34 @@ vows.describe('jitsu/commands/env').addBatch({
app: {
name: 'application',
state: 'stopped',
- env: { foo: 'bar', baz: 'buzz', test: 'truthy' },
+ env: { foo: 'bar', baz: 'buzz', test: 'truthy1' },
subdomain:'application',
scripts: { start: './server.js' },
snapshots: [{ filename: 'FILENAME' }]
}
}, { 'x-powered-by': 'Nodejitsu' })
- .put('/apps/tester/application', { env: { foo: 'bar', baz: 'buzz', test: 'truthy' } })
+ .put('/apps/tester/application', { env: { foo: 'bar', baz: 'buzz', test: 'truthy2' } })
.reply(200, '', { 'x-powered-by': 'Nodejitsu' });
}
)
}).addBatch({
'env load barbaz env_vars.json': shouldNodejitsuOk('The specified app should load enviroment variables from the specified file',
function setup() {
jitsu.prompt.override.confirm = 'yes';
+ fs.writeFileSync('env_vars.json', JSON.stringify({ foo: 'bar', baz: 'buzz', test: 'truthy2' }, null, 2), 'utf8');
nock('http://api.mockjitsu.com')
.get('/apps/tester/barbaz')
.reply(200, {
app: {
name: 'barbaz',
state: 'stopped',
- env: { foo: 'bar', baz: 'buzz', test: 'truthy' },
+ env: { foo: 'bar', baz: 'buzz', test: 'truthy1' },
subdomain:'barbaz',
scripts: { start: './server.js' },
snapshots: [{ filename: 'FILENAME' }]
}
}, { 'x-powered-by': 'Nodejitsu' })
- .put('/apps/tester/barbaz', { env: { foo: 'bar', baz: 'buzz', test: 'truthy' } })
+ .put('/apps/tester/barbaz', { env: { foo: 'bar', baz: 'buzz', test: 'truthy2' } })
.reply(200, '', { 'x-powered-by': 'Nodejitsu' });
}
)

0 comments on commit 409f7cc

Please sign in to comment.