Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
creates test/z_teardown.js file and puts teardown tests/methods there -
- Loading branch information
Showing
5 changed files
with
51 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
var OPTIONS = require('./options'); | ||
var REQUEST = require('./http_request'); | ||
var FS = require('./fs'); | ||
|
||
module.exports = function del(record, callback) { | ||
var options = OPTIONS(record, 'DELETE'); | ||
FS.saveFile(record, function(err, filename) { | ||
console.log('record : '+filename); | ||
}); | ||
return REQUEST(options, callback).end(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// After all the other tests have run we need to clear state on DEV for next time | ||
|
||
var test = require('tape'); | ||
var chalk = require('chalk'); | ||
|
||
var FS = require('../lib/index.js').FS; | ||
var D = require('../lib/fs_delete.js'); | ||
|
||
// fake record | ||
var record = { | ||
type: 'tweet', | ||
index: 'twitter', | ||
id: Math.floor(Math.random() * (1000000)), | ||
message: "what evs" | ||
} | ||
|
||
// create another few files to exercise : | ||
test(chalk.cyan('Create dummy records to exercise ') + chalk.red('deleteDataDir ') + chalk.cyan('method )'), function (t) { | ||
record.id = 12345; | ||
FS.saveFile(record, function(){ | ||
// console.log(' - - - - - - - '); | ||
// console.log(record.id); | ||
record.id = 65432; | ||
FS.saveFile(record, function(){ | ||
// console.log(' - - - - - - - '); | ||
// console.log(record.id); | ||
t.end(); | ||
}); | ||
}); | ||
}); | ||
|
||
test(chalk.cyan('TIDY UP TIME ( delete all files in ') + chalk.red('_data ') + chalk.cyan('directory )'), function (t) { | ||
D.deleteDataDir(function (err, deleted) { | ||
t.equal(deleted, true, chalk.green("✓ ") + chalk.red('_data DELETED!')); | ||
FS.dataDirExists(function (err, exists) { | ||
t.equal(exists, false, chalk.green("✓ ") + chalk.red('_data ') + chalk.green("dir should no longer exist!")); | ||
t.end(); | ||
}); | ||
}); | ||
}); |