<commit_before>module "Full Integration Test against api.soundcloud.com"

QUnit.config.reorder = false
QUnit.config.autorun = false

fixtureTrackId = undefined
accessToken = undefined
asyncTest "Retrieve token using OAuth2", 1, ->
  SC.accessToken null
  SC.post "/oauth2/token",
    client_id: "YOUR_CLIENT_ID"
    client_secret: "YOUR_CLIENT_SECRET"
    grant_type: "password"
    username: "js-sdk-test"
    password: "<PASSWORD>"
  , (response) ->
    accessToken = response.access_token
    SC.accessToken accessToken
    ok response.access_token
    start()

asyncTest "Audio Recording and Uploading", 1, ->
  trackTitle = "JS SDK Test Recording"
  SC.record progress: ->
    SC.recordStop()
    SC.recordUpload
      track:
        title: trackTitle
        sharing: "private"
    , (track) ->
      fixtureTrackId = track.id
      equal track.title, trackTitle
      start()

asyncTest "Receive latest tracks", 1, ->
  SC.get "/tracks",
    limit: 2
  , (tracks) ->
    equal tracks.length, 2
    start()

asyncTest "Update a user description", 1, ->
  randomDescription = "ABC: " + Math.random()
  SC.put "/me",
    user:<commit_msg>include an assertion for the start event in recording test<commit_after>module "Full Integration Test against api.soundcloud.com"

QUnit.config.reorder = false
QUnit.config.autorun = false

fixtureTrackId = undefined
accessToken = undefined
asyncTest "Retrieve token using OAuth2", 1, ->
  SC.accessToken null
  SC.post "/oauth2/token",
    client_id: "YOUR_CLIENT_ID"
    client_secret: "YOUR_CLIENT_SECRET"
    grant_type: "password"
    username: "js-sdk-test"
    password: "<PASSWORD>"
  , (response) ->
    accessToken = response.access_token
    SC.accessToken accessToken
    ok response.access_token
    start()

asyncTest "Audio Recording and Uploading", 2, ->
  trackTitle = "JS SDK Test Recording"
  SC.record
    start: ->
      ok("start event fired")
    progress: ->
      SC.recordStop()
      SC.recordUpload
        track:
          title: trackTitle
          sharing: "private"
      , (track) ->
        fixtureTrackId = track.id
        equal track.title, trackTitle
        start()

asyncTest "Receive latest tracks", 1, ->
  SC.get "/tracks",
    limit: 2
  , (tracks) ->
    equal tracks.length, 2
    start()

asyncTest "Update a user description", 1, ->
  randomDescription = "ABC: " + Math.random()
  SC.put "/me",
    user:
{'fraction_non_alphanumeric': 0.11315240083507307, 'fraction_numerical': 0.006680584551148226, 'mean_word_length': 2.993333333333333, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1968421', 'n_tokens_mistral': 778, 'n_tokens_neox': 756, 'n_words': 202}