What i am trying to do is to test or make test to .tsx code by using Mocha
as i found by search . the .tsx file contains Reacjs.net code .
Now my question is how can i access the component in side .tsx files and call them .
Thank you
tsx file
import * as React from 'react';
import 'isomorphic-fetch';
interface IEmployee {
firstname: string;
lastname: string;
id: number;
fullname: string;
enrollmentdate: Date;
}
class SEmployee {
public firstname: string;
public lastname: string;
public id: number;
public fullname: string;
public enrollmentdate: Date;
}
interface IFetchEmployee {
employees: IEmployee[];
loading: boolean;
enableaction: boolean;
}
var Assert = require('assert');
describe('Array', function() {
describe('#indexOf()', function() {
it('should return -1 when the value is not present', function() {
Assert.equal(-1, [1,2,3].indexOf(4));
});
});
});
var AssertB = require('assert');
describe('ReadList', function () {
describe('#readdata', function () {
it('should return list of employees', function () {
var employee = readdata();
AssertB.equal(employee[0].firstname, "Muhanned");
});
});
});
What i am trying to do is to test or make test to .tsx code by using Mocha as i found by search . the .tsx file contains Reacjs.net code . Now my question is how can i access the component in side .tsx files and call them .
Thank you
tsx file import * as React from 'react'; import 'isomorphic-fetch';
interface IEmployee { firstname: string; lastname: string; id: number; fullname: string; enrollmentdate: Date; } class SEmployee { public firstname: string; public lastname: string; public id: number; public fullname: string; public enrollmentdate: Date; } interface IFetchEmployee { employees: IEmployee[]; loading: boolean; enableaction: boolean; }
export class FetchEmployee extends React.Component<{}, IFetchEmployee> { public constructor() { super(); this.state = { employees: [], loading: false, enableaction: true }; }
}
test file
var Assert = require('assert'); describe('Array', function() { describe('#indexOf()', function() { it('should return -1 when the value is not present', function() { Assert.equal(-1, [1,2,3].indexOf(4)); }); }); });
var AssertB = require('assert'); describe('ReadList', function () { describe('#readdata', function () { it('should return list of employees', function () { var employee = readdata(); AssertB.equal(employee[0].firstname, "Muhanned"); }); }); });