Skip to content

Commit 052fa2c

Browse files
author
Aries Yuwono
committed
add
1 parent 1d8fddb commit 052fa2c

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2014-2015 MarkLogic Corporation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
process.env.NODE_ENV = 'development';
18+
19+
var should = require('should');
20+
21+
var testconfig = require('../etc/test-config-qa.js');
22+
23+
var marklogic = require('../');
24+
25+
var db = marklogic.createDatabaseClient(testconfig.restWriterConnection);
26+
27+
describe('Process Env Test', function() {
28+
29+
before(function(done) {
30+
this.timeout(10000);
31+
db.documents.write({
32+
uri: '/process/env/test.json',
33+
content: {name:'development'}
34+
}).result(function(response){done();}, done);
35+
});
36+
37+
var selectOneDocument = function() {
38+
var uri = '/some/uri/test.json'; //replace with VALID URI
39+
return db.documents.read(uri).result();
40+
};
41+
var resolve = function(document) {
42+
console.log(document);
43+
};
44+
var reject = function(error) {
45+
console.log(error);
46+
}
47+
selectOneDocument().then(resolve, reject);
48+
49+
it('should delete the document', function(done) {
50+
db.documents.remove('/process/env/test.json').result(function(document) {
51+
document.removed.should.eql(true);
52+
done();
53+
}, done);
54+
});
55+
56+
process.env.NODE_ENV = undefined;
57+
58+
});

0 commit comments

Comments
 (0)