From 409c4573ff4c688b3d5eb392b0cdefbd1212f6a7 Mon Sep 17 00:00:00 2001 From: Mihail Stoykov Date: Thu, 5 Aug 2021 18:35:49 +0300 Subject: [PATCH] Use struct literal thanks to @imiric --- js/modules/k6/metrics/metrics_test.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/js/modules/k6/metrics/metrics_test.go b/js/modules/k6/metrics/metrics_test.go index db503a90a8a..e2a69ca12a9 100644 --- a/js/modules/k6/metrics/metrics_test.go +++ b/js/modules/k6/metrics/metrics_test.go @@ -62,10 +62,11 @@ func TestMetrics(t *testing.T) { t.Parallel() rt := goja.New() rt.SetFieldNameMapper(common.FieldNameMapper{}) - mii := &modulestest.InstanceCore{} - mii.Runtime = rt - mii.InitEnv = &common.InitEnvironment{} - mii.Ctx = context.Background() + mii := &modulestest.InstanceCore{ + Runtime: rt, + InitEnv: &common.InitEnvironment{}, + Ctx: context.Background(), + } m, ok := New().NewModuleInstance(mii).(*ModuleInstance) require.True(t, ok) require.NoError(t, rt.Set("metrics", m.GetExports().Named)) @@ -179,10 +180,11 @@ func TestMetricGetName(t *testing.T) { rt := goja.New() rt.SetFieldNameMapper(common.FieldNameMapper{}) - mii := &modulestest.InstanceCore{} - mii.Runtime = rt - mii.InitEnv = &common.InitEnvironment{} - mii.Ctx = context.Background() + mii := &modulestest.InstanceCore{ + Runtime: rt, + InitEnv: &common.InitEnvironment{}, + Ctx: context.Background(), + } m, ok := New().NewModuleInstance(mii).(*ModuleInstance) require.True(t, ok) require.NoError(t, rt.Set("metrics", m.GetExports().Named))