MCPcopy
hub / github.com/duke-git/lancet / TestThen

Function TestThen

promise/promise_test.go:34–54  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func 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
56func TestPromise_Then(t *testing.T) {
57 t.Parallel()

Callers

nothing calls this directly

Calls 6

IsNilMethod · 0.95
EqualMethod · 0.95
NewAssertFunction · 0.92
ThenFunction · 0.85
AwaitMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…