Kinto / kinto-discovery-lib

1 stars 0 forks source link

Trial #2

Closed oak11 closed 8 years ago

oak11 commented 8 years ago

@Natim @almet here, I get the following error: 1) discovery library registerUserURL With an already existing user URL should return the existing URL: Error: Missing Authorization header at registerUserURL (lib/index.js:36:17) at Context. (tests/discovery_test.js:58:16)

2) discovery library registerUserURL when server returns a 5xx should return an error in case of 501 : Error: Missing Authorization header at registerUserURL (lib/index.js:36:17) at Context. (tests/discovery_test.js:73:37)

3) discovery library registerUserURL when server returns a 5xx should return an error in case of 500: Error: Missing Authorization header at registerUserURL (lib/index.js:36:17) at Context. (tests/discovery_test.js:80:8)

4) discovery library registerUserURL when server returns a 5xx should return an error in case of 503: Error: Missing Authorization header at registerUserURL (lib/index.js:36:17) at Context. (tests/discovery_test.js:88:4)

5) discovery library registerUserURL if headers are empty should return an error message: Error: Missing Authorization header at registerUserURL (lib/index.js:36:17) at Context. (tests/discovery_test.js:97:24)

6) discovery library registerUserURL Invalid headers should reject promise with error message: Error: Missing Authorization header at registerUserURL (lib/index.js:36:17) at Context. (tests/discovery_test.js:113:16)

I dont understand how to rectify this

oak11 commented 8 years ago

@almet @Natim @n1k0 @leplatrem : Used node-localStorage for implementing localStorage. I get TypeError: Cannot read property 'should' of null

Is this probably because the new library is asserting over the one with should, and this library does not have 'should' as a functionality? What should I do to ensure localStorage can be used?

almet commented 8 years ago

Do you have a stack trace?

oak11 commented 8 years ago

@almet : No, the complete output is this(the tests that don't use should run. Should we use expect instead? that works.) :

undefined in if===================================

discovery library getUserIDHash ✓ should return the same hash for the same userid ✓ should return different hashes for different values ✓ should return an uuid registerUserURL With an already existing user URL 1) should return the existing URL when server returns a 5xx 2) should return an error in case of 501 3) should return an error in case of 500 4) should return an error in case of 503 if headers are empty 5) should return an error message Invalid headers 6) should reject promise with error message retrieveUserURL when server returns a 5xx 7) should return an error in case of 501 8) should return an error in case of 500 9) should return an error in case of 503 With an already existing user URL 10) should return the existing URL without existing url 11) should return the default URL First time access or error 403 12) should return the default URL Invalid headers 13) should reject promise with error message if default server is null ✓ should return message: default server is null

4 passing (71ms) 13 failing

1) discovery library registerUserURL With an already existing user URL should return the existing URL: TypeError: Cannot read property 'should' of null at Context. (tests/discovery_test.js:58:88)

2) discovery library registerUserURL when server returns a 5xx should return an error in case of 501 : TypeError: Cannot read property 'should' of null at Context. (tests/discovery_test.js:72:88)

3) discovery library registerUserURL when server returns a 5xx should return an error in case of 500: TypeError: Cannot read property 'should' of null at Context. (tests/discovery_test.js:80:88)

4) discovery library registerUserURL when server returns a 5xx should return an error in case of 503: TypeError: Cannot read property 'should' of null at Context. (tests/discovery_test.js:88:88)

5) discovery library registerUserURL if headers are empty should return an error message: TypeError: Cannot read property 'should' of null at Context. (tests/discovery_test.js:98:81)

6) discovery library registerUserURL Invalid headers should reject promise with error message: TypeError: Cannot read property 'should' of null at Context. (tests/discovery_test.js:115:86)

7) discovery library retrieveUserURL when server returns a 5xx should return an error in case of 501 : TypeError: Cannot read property 'should' of null at Context. (tests/discovery_test.js:136:87)

8) discovery library retrieveUserURL when server returns a 5xx should return an error in case of 500: TypeError: Cannot read property 'should' of null at Context. (tests/discovery_test.js:144:87)

9) discovery library retrieveUserURL when server returns a 5xx should return an error in case of 503: TypeError: Cannot read property 'should' of null at Context. (tests/discovery_test.js:152:87)

10) discovery library retrieveUserURL With an already existing user URL should return the existing URL: TypeError: Cannot read property 'should' of null at Context. (tests/discovery_test.js:170:87)

11) discovery library retrieveUserURL without existing url should return the default URL: TypeError: Cannot read property 'should' of null at Context. (tests/discovery_test.js:186:87)

12) discovery library retrieveUserURL First time access or error 403 should return the default URL: TypeError: Cannot read property 'should' of null at Context. (tests/discovery_test.js:202:87)

13) discovery library retrieveUserURL Invalid headers should reject promise with error message: TypeError: Cannot read property 'should' of null at Context. (tests/discovery_test.js:218:87)

almet commented 8 years ago

You are actually returning null: https://github.com/Kinto/kinto-discovery-lib/pull/2/files#diff-6d186b954a58d5bb740f73d84fe39073R35. I don't understand why you're doing this conditional.

Eventually, you would like to return the cached version if it is different than null, but doing the check on [object Response] doesn't make a lot of sense.

oak11 commented 8 years ago

@almet: yup that solved it :) now I am working on storing the url in localstorage. however, I keep getting TypeError: 'https://my-kinto-instance.com/v1' is not a thenable. or TypeError: [object object] is not a thenable. what do these type of errors mean?

oak11 commented 8 years ago

@almet @Natim : this covers all the test cases we listed in the pad. Is there something I should add/ modify here?