<commit_before>
          
   FRISBY  
          



ALTERNATIVES ==>                  #  - supertest:
                                  #     - not maintained
                                  #     - uses superagent
                                  #  - frisby (prefer)
                                  #     - uses node-fetch

VERSION ==>                       #2.0.14
                                  #Assertions on HTTP response (status, headers, body)
<commit_msg>no commit message<commit_after>
          
   FRISBY  
          



ALTERNATIVES ==>                  #  - supertest:
                                  #     - not maintained
                                  #     - uses superagent
                                  #  - frisby (prefer)
                                  #     - uses node-fetch

VERSION ==>                       #2.0.14
                                  #Assertions on HTTP response (status, headers, body)


                                             /=+===============================+=\
                                            /  :                               :  \
                                            )==:             BASE              :==(
                                            \  :_______________________________:  /
                                             \=+===============================+=/


FREQ.*()->FREQ                    #All FREQ methods return FREQ
                                  #Also if FRISBY|FREQ.*(), FRISBY method returns FREQ

FRISBY|FREQ.use(FUNC(FREQ))       #Plugin system.
                                  #Just fires FUNC(FREQ)


                                             /=+===============================+=\
                                            /  :                               :  \
                                            )==:            REQUEST            :==(
                                            \  :_______________________________:  /
                                             \=+===============================+=/


FRISBY|FREQ.fetch('URL'[, OBJ])   #Like fetch(...)
                                  #OBJ (beside regular fetch options):
                                  #  - urlEncode true: apply encodeURI() on 'URL'
FRISBY|FREQ.                      #Same as *.fetch() but:
 get|patch|post|put|del(...)      #  - with OBJ.method
                                  #  - apply JSON.stringify() on OBJ.body OBJ2
FRISBY|FREQ.fromJSON(VAL)         #Same as *.fetch() but using a fake request:
                                  #  - url '/'
                                  #  - status 200
                                  #  - headers Content-Type: application/json [S]
                                  #  - body VAL

FRISBY.globalSetup(OPTS)          #OPTS.request are default fetch options
FRISBY|FREQ.setup(OPTS[, BOOL])   #Default are:
                                  #  - credentials 'include'
                                  #  - headers Content-Type: application/json [C], User-Agent: frisby/VERSION
                                  #  - timeout 5000
                                  #If BOOL true, replace instead of deep merge.

FRISBY.baseUrl('URL')             #For relative URLs
                                  #Can also use OPTS.request.baseUrl 'URL'
FRISBY.getBaseUrl()->'URL'        #

FRISBY|FREQ.timeout(NUM)          #
FREQ.timeout()->NUM               #


                                             /=+===============================+=\
                                            /  :                               :  \
                                            )==:           RESPONSE            :==(
                                            \  :_______________________________:  /
                                             \=+===============================+=/


FREQ.promise()->PROMISE           #fetch()'s PROMISE
FREQ.then|catch(...)              #Same as FREQ.promise().then|catch(...)
                                  #Except default error handler: console.log() the JSON response
FREQ.done(FUNC)                   #Same as FREQ.then(() => FUNC())


                                             /=+===============================+=\
                                            /  :                               :  \
                                            )==:           DEBUGGING           :==(
                                            \  :_______________________________:  /
                                             \=+===============================+=/


FREQ.inspectRequest()             #console.log() request
FREQ.inspectRequestHeaders()      #console.log() request headers

FREQ.inspectResponse()            #console.log() response
FREQ.inspectStatus()              #console.log() response status
FREQ.inspectHeaders()             #console.log() response headers
FREQ.inspectBody()                #console.log() response body
FREQ.inspectJSON()                #console.log() response body, as JSON


                                             /=+===============================+=\
                                            /  :                               :  \
                                            )==:          ASSERTIONS           :==(
                                            \  :_______________________________:  /
                                             \=+===============================+=/


FREQ.expect(...)                  #Throw ERROR if expectation on fetch()'s RES not met.
                                  #If fetch()'s PROMISE was rejected, expect[Not]() will not be checked,
                                  #i.e. PROMISE should be returned in the test's it()
                                  #If GLOBAL.expect() is defined, Jasmine's expect(...).toBe(...) will be used,
                                  #so it must be mocked to an empty function if it does not exist (e.g. with Chai).
FREQ.expectNot(...)               #Inverse

FREQ.expect(FUNC(RES))            #Asserts RES
FREQ.expect('status', NUM)        #Asserts RES.status
FREQ.expect
 ('header', 'VAR'[, VAL|REGEXP])  #Asserts RES.get('VAR'), case-insensitive.

FREQ.expect
 ('bodyContains', STR|REGEXP)     #Asserts RES.body as a string
FREQ.json(['VARR',] VAL[_ARR])    #Asserts RES.body as a JSON value
                                  #If VAL_ARR???
                                  #If VAL is OBJ, subset???
                                  #VARR can contain:
                                  #  - & for "all OBJ keys"
                                  #  - * for "all ARR indices"
                                  #  - ? for "at least one ARR index"
FREQ.jsonStrict(['VARR',] VAL)    #Same but does a deepEqual()
FREQ.jsonTypes[Strict]            #Same but using JOI.validate(RES.body, SCHEMA) (see its doc)
 (['VARR',] SCHEMA)               #Uses OPTS.allowUnknown true (unknown properties) unless "Strict"

FRISBY|FREQ.addExpectHandler
 ('NAME', FUNC(RES, ...))         #Add custom FREQ.expect('NAME', ...)
FRISBY|FREQ.removeExpectHandler
 ('NAME')                         #

{'fraction_non_alphanumeric': 0.21389067524115757, 'fraction_numerical': 0.002057877813504823, 'mean_word_length': 1.0506329113924051, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 101, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4643638', 'n_tokens_mistral': 3673, 'n_tokens_neox': 3563, 'n_words': 358}