(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestEncodeBuildArgs(t *testing.T) { |
| 10 | conditions := []string{"react-server"} |
| 11 | buildArgsString := encodeBuildArgs( |
| 12 | BuildArgs{ |
| 13 | Alias: map[string]string{"a": "b"}, |
| 14 | Deps: map[string]string{ |
| 15 | "c": "1.0.0", |
| 16 | "d": "1.0.0", |
| 17 | "e": "1.0.0", |
| 18 | }, |
| 19 | External: *set.NewReadOnly("baz", "bar"), |
| 20 | Conditions: conditions, |
| 21 | ExternalRequire: true, |
| 22 | KeepNames: true, |
| 23 | IgnoreAnnotations: true, |
| 24 | }, |
| 25 | false, |
| 26 | ) |
| 27 | args, err := decodeBuildArgs(buildArgsString) |
| 28 | if err != nil { |
| 29 | t.Fatal(err) |
| 30 | } |
| 31 | if len(args.Alias) != 1 || args.Alias["a"] != "b" { |
| 32 | t.Fatal("invalid alias") |
| 33 | } |
| 34 | if len(args.Deps) != 3 { |
| 35 | t.Fatal("invalid deps") |
| 36 | } |
| 37 | if args.External.Len() != 2 { |
| 38 | t.Fatal("invalid external") |
| 39 | } |
| 40 | if len(args.Conditions) != 1 || args.Conditions[0] != "react-server" { |
| 41 | t.Fatal("invalid conditions") |
| 42 | } |
| 43 | if !args.ExternalRequire { |
| 44 | t.Fatal("ignoreRequire should be true") |
| 45 | } |
| 46 | if !args.KeepNames { |
| 47 | t.Fatal("keepNames should be true") |
| 48 | } |
| 49 | if !args.IgnoreAnnotations { |
| 50 | t.Fatal("ignoreAnnotations should be true") |
| 51 | } |
| 52 | } |
nothing calls this directly
no test coverage detected