File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ var loadAdapter = require("../src/Adapters/AdapterLoader").loadAdapter;
3
3
var FilesAdapter = require ( "parse-server-fs-adapter" ) . default ;
4
4
var S3Adapter = require ( "parse-server-s3-adapter" ) . default ;
5
5
var ParsePushAdapter = require ( "parse-server-push-adapter" ) . default ;
6
+ const Config = require ( '../src/Config' ) ;
6
7
7
8
describe ( "AdapterLoader" , ( ) => {
8
9
@@ -118,6 +119,30 @@ describe("AdapterLoader", ()=>{
118
119
done ( ) ;
119
120
} ) ;
120
121
122
+ it ( "should load custom push adapter from string (#3544)" , ( done ) => {
123
+ var adapterPath = require ( 'path' ) . resolve ( "./spec/MockPushAdapter" ) ;
124
+ var options = {
125
+ ios : {
126
+ bundleId : 'bundle.id'
127
+ }
128
+ }
129
+ const pushAdapterOptions = {
130
+ adapter : adapterPath ,
131
+ options
132
+ } ;
133
+ expect ( ( ) => {
134
+ reconfigureServer ( {
135
+ push : pushAdapterOptions ,
136
+ } ) . then ( ( ) => {
137
+ const config = new Config ( Parse . applicationId ) ;
138
+ const pushAdapter = config . pushWorker . adapter ;
139
+ expect ( pushAdapter . getValidPushTypes ( ) ) . toEqual ( [ 'ios' ] ) ;
140
+ expect ( pushAdapter . options ) . toEqual ( pushAdapterOptions ) ;
141
+ done ( ) ;
142
+ } ) ;
143
+ } ) . not . toThrow ( ) ;
144
+ } ) ;
145
+
121
146
it ( "should load S3Adapter from direct passing" , ( done ) => {
122
147
var s3Adapter = new S3Adapter ( "key" , "secret" , "bucket" )
123
148
expect ( ( ) => {
Original file line number Diff line number Diff line change
1
+ module . exports = function ( options ) {
2
+ return {
3
+ options : options ,
4
+ send : function ( ) { } ,
5
+ getValidPushTypes : function ( ) {
6
+ return Object . keys ( options . options ) ;
7
+ }
8
+ } ;
9
+ } ;
You can’t perform that action at this time.
0 commit comments