import React, { useEffect } from 'react';
import { teamixTest, productCalculate, pageCalculate } from '@teamix/testing-capability';
import result from './data';

const InnerTest = () => {
  useEffect(() => {}, []);

  useEffect(() => {
    setTimeout(async () => {
      const testA = await teamixTest({
        testItem: ['PERFORMANCE'],
        extendMap: { performanceInfo: { PCP: [2000] } },
      });
      const testB = await teamixTest({
        testItem: ['PERFORMANCE'],
        extendMap: { performanceInfo: { PCP: [3000] } },
      });
      const testC = await teamixTest({
        testItem: ['PERFORMANCE'],
        extendMap: { performanceInfo: { PCP: [3500] } },
      });
      const testD = await teamixTest({
        testItem: ['PERFORMANCE'],
        extendMap: { performanceInfo: { PCP: [2500] } },
      });
      const testE = await teamixTest({
        testItem: ['PERFORMANCE'],
        extendMap: { performanceInfo: { PCP: [1000] } },
      });

      const pageData = pageCalculate([testA, testB, testC, testD, testE]);

      console.log('性能测试 => ', pageData);

      // 自动测试未使用 teamixTest 和 pageCalculate
      console.log(productCalculate(result.map((v) => v.testInfo)));
    }, 1000);
  }, []);

  return <section id="module">依赖测试</section>;
};

export default InnerTest;
