Skip to content

Commit

Permalink
Improves documentation, add loading tests
Browse files Browse the repository at this point in the history
  • Loading branch information
flovilmart committed Mar 4, 2016
1 parent 069605e commit a44b1d9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,20 @@ PARSE_SERVER_MAX_UPLOAD_SIZE

```

##### Configuring S3 Adapter

You can use the following environment variable setup the S3 adapter

```js
S3_ACCESS_KEY
S3_SECRET_KEY
S3_BUCKET
S3_REGION
S3_BUCKET_PREFIX
S3_DIRECT_ACCESS

```

## Contributing

We really want Parse to be yours, to see it grow and thrive in the open source community. Please see the [Contributing to Parse Server guide](CONTRIBUTING.md).
25 changes: 25 additions & 0 deletions spec/AdapterLoader.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

var loadAdapter = require("../src/Adapters/AdapterLoader").loadAdapter;
var FilesAdapter = require("../src/Adapters/Files/FilesAdapter").default;
var ParsePushAdapter = require("../src/Adapters/Push/ParsePushAdapter");
var S3Adapter = require("../src/Adapters/Files/S3Adapter").default;

describe("AdapterLoader", ()=>{

Expand Down Expand Up @@ -84,4 +86,27 @@ describe("AdapterLoader", ()=>{
}).not.toThrow("foo is required for that adapter");
done();
});

it("should load push adapter from options", (done) => {
var options = {
ios: {
bundleId: 'bundle.id'
}
}
expect(() => {
var adapter = loadAdapter(undefined, ParsePushAdapter, options);
expect(adapter.constructor).toBe(ParsePushAdapter);
expect(adapter).not.toBe(undefined);
}).not.toThrow();
done();
});

it("should load S3Adapter from direct passing", (done) => {
var s3Adapter = new S3Adapter("key", "secret", "bucket")
expect(() => {
var adapter = loadAdapter(s3Adapter, FilesAdapter);
expect(adapter).toBe(s3Adapter);
}).not.toThrow();
done();
})
});
2 changes: 1 addition & 1 deletion src/Adapters/AdapterLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export function loadAdapter(adapter, defaultAdapter, options) {
} else if (adapter.adapter) {
return loadAdapter(adapter.adapter, undefined, adapter.options);
}
// return the adapter as is as it's unusable otherwise
// return the adapter as provided
return adapter;
}

Expand Down

0 comments on commit a44b1d9

Please sign in to comment.