Skip to content

Commit

Permalink
[INTERNAL] Tests: Replace deprecated Buffer constructor calls
Browse files Browse the repository at this point in the history
The Buffer constructor used in some of our recently added tests
(#56 is deprecated. One should
use Buffer.from(string) instead.

Details:
https://nodejs.org/en/docs/guides/buffer-constructor-deprecation/
  • Loading branch information
RandomByte committed Jan 28, 2019
1 parent 1807fcc commit 68956fb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions test/lib/DuplexCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test("DuplexCollection: _byGlob", (t) => {

const resource = new Resource({
path: "my/path",
buffer: new Buffer("content")
buffer: Buffer.from("content")
});
const abstractReader = {
_byGlob: sinon.stub().returns(Promise.resolve([resource]))
Expand Down Expand Up @@ -115,7 +115,7 @@ test("DuplexCollection: _byGlobSource with default options and a reader finding

const resource = new Resource({
path: "my/path",
buffer: new Buffer("content")
buffer: Buffer.from("content")
});
const abstractReader = {
byGlob: sinon.stub().returns(Promise.resolve([resource]))
Expand Down Expand Up @@ -144,7 +144,7 @@ test("DuplexCollection: _byPath with reader finding a resource", (t) => {

const resource = new Resource({
path: "path",
buffer: new Buffer("content")
buffer: Buffer.from("content")
});
const pushCollectionSpy = sinon.spy(resource, "pushCollection");
const abstractReader = {
Expand Down Expand Up @@ -205,7 +205,7 @@ test("DuplexCollection: _write successful", (t) => {

const resource = new Resource({
path: "my/path",
buffer: new Buffer("content")
buffer: Buffer.from("content")
});
const duplexCollection = new DuplexCollection({
name: "myCollection",
Expand Down
4 changes: 2 additions & 2 deletions test/lib/ReaderCollection.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ test("ReaderCollection: _byGlob with finding a resource", (t) => {

const resource = new Resource({
path: "my/path",
buffer: new Buffer("content")
buffer: Buffer.from("content")
});
const abstractReader = {
_byGlob: sinon.stub().returns(Promise.resolve([resource]))
Expand Down Expand Up @@ -74,7 +74,7 @@ test("ReaderCollection: _byPath with reader finding a resource", (t) => {

const resource = new Resource({
path: "my/path",
buffer: new Buffer("content")
buffer: Buffer.from("content")
});
const pushCollectionSpy = sinon.spy(resource, "pushCollection");
const abstractReader = {
Expand Down
6 changes: 3 additions & 3 deletions test/lib/Resource.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ test("Resource: constructor with duplicated content parameter", (t) => {
const error = t.throws(() => {
new Resource({
path: "my/path",
buffer: new Buffer("Content"),
buffer: Buffer.from("Content"),
string: "Content"
});
}, Error);
Expand All @@ -41,7 +41,7 @@ test("Resource: getStream", async (t) => {

const resource = new Resource({
path: "my/path/to/resource",
buffer: new Buffer("Content")
buffer: Buffer.from("Content")
});

return new Promise(function(resolve, reject) {
Expand Down Expand Up @@ -109,7 +109,7 @@ test("Resource: clone resource with buffer", (t) => {

const resource = new Resource({
path: "my/path/to/resource",
buffer: new Buffer("Content")
buffer: Buffer.from("Content")
});

return resource.clone().then(function(clonedResource) {
Expand Down

0 comments on commit 68956fb

Please sign in to comment.