1// Copyright 2012-present Oliver Eilhard. All rights reserved.
2// Use of this source code is governed by a MIT-license.
3// See http://olivere.mit-license.org/license.txt for details.
4
5package elastic
6
7import "testing"
8
9func TestIngestSimulatePipelineURL(t *testing.T) {
10	client := setupTestClientAndCreateIndex(t)
11
12	tests := []struct {
13		Id       string
14		Expected string
15	}{
16		{
17			"",
18			"/_ingest/pipeline/_simulate",
19		},
20		{
21			"my-pipeline-id",
22			"/_ingest/pipeline/my-pipeline-id/_simulate",
23		},
24	}
25
26	for _, test := range tests {
27		path, _, err := client.IngestSimulatePipeline().Id(test.Id).buildURL()
28		if err != nil {
29			t.Fatal(err)
30		}
31		if path != test.Expected {
32			t.Errorf("expected %q; got: %q", test.Expected, path)
33		}
34	}
35}
36