(t *testing.T)
| 32 | } |
| 33 | |
| 34 | func TestThen(t *testing.T) { |
| 35 | t.Parallel() |
| 36 | |
| 37 | assert := internal.NewAssert(t, "TestThen") |
| 38 | |
| 39 | p1 := New(func(resolve func(string), reject func(error)) { |
| 40 | resolve("abc") |
| 41 | }) |
| 42 | |
| 43 | p2 := Then(p1, func(data string) string { |
| 44 | return data + "de" |
| 45 | }) |
| 46 | |
| 47 | val, err := p1.Await() |
| 48 | assert.IsNil(err) |
| 49 | assert.Equal("abc", val) |
| 50 | |
| 51 | val, err = p2.Await() |
| 52 | assert.IsNil(err) |
| 53 | assert.Equal("abcde", val) |
| 54 | } |
| 55 | |
| 56 | func TestPromise_Then(t *testing.T) { |
| 57 | t.Parallel() |