Chore: Refactor process.js & process.test.js to TypeScript (#58464)

This commit is contained in:
Hamas Shafiq 2022-11-11 10:44:06 +00:00 committed by GitHub
parent c76183a961
commit 8e4fa4046b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 7 deletions

View File

@ -11,21 +11,19 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import traceGenerator from '../demo/trace-generators';
import { TraceProcess } from '../types/trace';
import * as processSelectors from './process';
const generatedTrace = traceGenerator.trace({ numberOfSpans: 45 });
it('getProcessServiceName() should return the serviceName of the process', () => {
const proc = generatedTrace.processes[Object.keys(generatedTrace.processes)[0]];
const proc: TraceProcess = generatedTrace.processes[Object.keys(generatedTrace.processes)[0]];
expect(processSelectors.getProcessServiceName(proc)).toBe(proc.serviceName);
});
it('getProcessTags() should return the tags on the process', () => {
const proc = generatedTrace.processes[Object.keys(generatedTrace.processes)[0]];
const proc: TraceProcess = generatedTrace.processes[Object.keys(generatedTrace.processes)[0]];
expect(processSelectors.getProcessTags(proc)).toBe(proc.tags);
});

View File

@ -12,5 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
export const getProcessServiceName = (proc) => proc.serviceName;
export const getProcessTags = (proc) => proc.tags;
import { TraceProcess } from '../types/trace';
export const getProcessServiceName = (proc: TraceProcess) => proc.serviceName;
export const getProcessTags = (proc: TraceProcess) => proc.tags;