Skip to content

Commit

Permalink
server/test: verify allowUnorderedBatchNumbers
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdecaf committed Apr 26, 2024
1 parent a5bc613 commit 385aea0
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions server/test/unordered_batches/unordered_batch_test.go
Expand Up @@ -2,6 +2,8 @@ package unordered_batches

import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"net/http/httptest"
"os"
Expand Down Expand Up @@ -35,4 +37,22 @@ func TestUnorderedBatches(t *testing.T) {
w.Flush()

require.Equal(t, http.StatusOK, w.Code)

var response struct {
ID string `json:"id"`
}
json.NewDecoder(w.Body).Decode(&response)
require.NotEmpty(t, response.ID)

// Try POST /validate
var buf bytes.Buffer
buf.WriteString(`{"allowUnorderedBatchNumbers": true}`)
w = httptest.NewRecorder()
req = httptest.NewRequest("POST", fmt.Sprintf("/files/%s/validate", response.ID), &buf)
server.Handler.ServeHTTP(w, req)
w.Flush()

fmt.Printf("\n%s\n", w.Body.String())

require.Equal(t, http.StatusOK, w.Code)
}

0 comments on commit 385aea0

Please sign in to comment.