Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should warn only once `keepAcl` parameter is passed', done => {
file.request = util.noop;
// since --throw-deprication is enabled using try=>catch block
try {
file.copy('newFile', {keepAcl: 'private'}, assert.ifError);
} catch (err) {
assert.strictEqual(
err.message,
'keepAcl parameter is not supported and will be removed in the next major'
);
assert.strictEqual(err.name, 'DeprecationWarning');
}
file2.copy('newFile2', {keepAcl: 'private'}, assert.ifError);
done();
});
});
beforeEach(() => {
sandbox = sinon.createSandbox();
fakeGapicClient = util.noop;
// tslint:disable-next-line no-any
(fakeGapicClient as any).scopes = [];
fakeV1.DatabaseAdminClient = fakeGapicClient;
fakeV1.InstanceAdminClient = fakeGapicClient;
fakeV1.SpannerClient = fakeGapicClient;
fakeCodec.SpannerDate = util.noop;
fakeCodec.Int = util.noop;
spanner = new Spanner(OPTIONS);
spanner.projectId = OPTIONS.projectId;
replaceProjectIdTokenOverride = null;
});
it('should get buckets with a query', done => {
const token = 'next-page-token';
storage.request = (reqOpts: DecorateRequestOptions) => {
assert.deepStrictEqual(reqOpts.qs, {
project: storage.projectId,
maxResults: 5,
pageToken: token,
});
done();
};
storage.getBuckets({maxResults: 5, pageToken: token}, util.noop);
});
it('should not use global forwarding rules', function() {
const rule = new Rule({createRule: util.noop}, RULE_NAME);
assert(rule instanceof FakeServiceObject);
const calledWith = rule.calledWith_[0];
assert.strictEqual(calledWith.baseUrl, '/forwardingRules');
});
it('should make the file private to user if strict = true', done => {
file.setMetadata = (metadata: {}, query: {}) => {
assert.deepStrictEqual(query, {predefinedAcl: 'private'});
done();
};
file.makePrivate({strict: true}, util.noop);
});
it('should get buckets without a query', done => {
storage.request = (reqOpts: DecorateRequestOptions) => {
assert.strictEqual(reqOpts.uri, '/b');
assert.deepStrictEqual(reqOpts.qs, {project: storage.projectId});
done();
};
storage.getBuckets(util.noop);
});
beforeEach(function() {
vm.getMetadata = function(callback) {
callback(null, METADATA);
};
vm.waiters.push({
status: STATUS,
callback: util.noop,
});
});
function createLogger(maxEntrySize?: number) {
assignSeverityToEntriesOverride = null;
LOGGING = {
projectId: '{{project-id}}',
entry: util.noop,
request: util.noop,
loggingService: util.noop,
auth: util.noop,
};
const options: LogOptions = {};
if (maxEntrySize) {
options.maxEntrySize = maxEntrySize;
}
return new Log(LOGGING, LOG_NAME, options);
}
(options: CreateReadStreamOptions, done: (err: Error) => void) => {
file
.createReadStream(options)
.on('error', done)
.on('end', done)
.on('data', util.noop);
}
)
GrpcServiceObject.prototype.setMetadata = function(metadata, callback) {
var protoOpts = this.methods.setMetadata.protoOpts;
var reqOpts = extend(true, {}, this.methods.setMetadata.reqOpts, metadata);
this.request(protoOpts, reqOpts, callback || util.noop);
};