@@ -76,99 +76,6 @@ describe('Instafeed', function() {
76
76
} ) ;
77
77
} ) ;
78
78
79
- describe ( '#_getAccessToken' , function ( ) {
80
- describe ( 'when "accessToken" is a string' , function ( ) {
81
- it ( 'should pass token as callback arguments' , function ( done ) {
82
- const testToken = 'test_access_token_value' ;
83
- const callback = ( err , token ) => {
84
- assert . equal ( err , null ) ;
85
- assert . equal ( token , testToken ) ;
86
- done ( ) ;
87
- } ;
88
- const options = optionsFixture ( { accessToken : testToken } ) ;
89
- const instance = new Instafeed ( options ) ;
90
- instance . _getAccessToken ( callback ) ;
91
- } ) ;
92
- } ) ;
93
-
94
- describe . only ( 'when "accessToken" is function' , function ( ) {
95
- it ( 'should pass instance as argument' , function ( done ) {
96
- let value = null ;
97
- const getToken = ( feed , callback ) => {
98
- value = feed ;
99
- callback ( null , null ) ;
100
- } ;
101
- const options = optionsFixture ( { accessToken : getToken } ) ;
102
- const instance = new Instafeed ( options ) ;
103
- instance . _getAccessToken ( ( ) => {
104
- assert . ok ( value instanceof Instafeed ) ;
105
- assert . strictEqual ( value , instance ) ;
106
- done ( ) ;
107
- } ) ;
108
- } ) ;
109
-
110
- it ( 'should pass callback as argument' , function ( done ) {
111
- let type = null ;
112
- const getToken = ( feed , callback ) => {
113
- type = typeof callback ;
114
- callback ( null , null ) ;
115
- } ;
116
- const options = optionsFixture ( { accessToken : getToken } ) ;
117
- const instance = new Instafeed ( options ) ;
118
- instance . _getAccessToken ( ( ) => {
119
- assert . equal ( type , 'function' ) ;
120
- done ( ) ;
121
- } ) ;
122
- } ) ;
123
-
124
- describe ( 'when "accessToken" function throws' , function ( ) {
125
- it ( 'should pass error as callback argument' , function ( done ) {
126
- const testError = new Error ( 'test_token_error' ) ;
127
- const getTokenWithThrow = ( ) => { throw testError ; } ;
128
- const options = optionsFixture ( { accessToken : getTokenWithThrow } ) ;
129
- const instance = new Instafeed ( options ) ;
130
- instance . _getAccessToken ( ( err , value ) => {
131
- assert . strictEqual ( err , testError ) ;
132
- done ( ) ;
133
- } ) ;
134
- } ) ;
135
- } ) ;
136
-
137
- describe ( 'when "accessToken" function calls callback' , function ( ) {
138
- describe ( 'with an error argument' , function ( ) {
139
- it ( 'should pass the error to callback' , function ( done ) {
140
- const testError = new Error ( 'test_token_error' ) ;
141
- const getTokenWithError = ( feed , callback ) => {
142
- callback ( testError , null ) ;
143
- } ;
144
- const options = optionsFixture ( { accessToken : getTokenWithError } ) ;
145
- const instance = new Instafeed ( options ) ;
146
- instance . _getAccessToken ( ( err , value ) => {
147
- assert . strictEqual ( err , testError ) ;
148
- done ( ) ;
149
- } ) ;
150
- } ) ;
151
- } ) ;
152
-
153
- describe ( 'with an value argument' , function ( ) {
154
- it ( 'should pass the value to callback' , function ( done ) {
155
- const testToken = 'test_token_from_callback' ;
156
- const getTokenWithError = ( feed , callback ) => {
157
- callback ( null , testToken ) ;
158
- } ;
159
- const options = optionsFixture ( { accessToken : getTokenWithError } ) ;
160
- const instance = new Instafeed ( options ) ;
161
- instance . _getAccessToken ( ( err , value ) => {
162
- assert . equal ( err , null ) ;
163
- assert . equal ( value , testToken ) ;
164
- done ( ) ;
165
- } ) ;
166
- } ) ;
167
- } ) ;
168
- } ) ;
169
- } ) ;
170
- } ) ;
171
-
172
79
browserOnly ( function ( ) {
173
80
describe ( '#run' , function ( ) {
174
81
it ( 'should return true' , function ( ) {
0 commit comments