Add first tests

This commit is contained in:
Chi Vinh Le
2018-07-04 19:04:12 -03:00
parent ea6eaee0d7
commit e1cf3a06f3
4 changed files with 76 additions and 52 deletions
@@ -0,0 +1,28 @@
import React from "react";
import { createRenderer } from "react-test-renderer/shallow";
import Comment from "./Comment";
it("renders username and body", () => {
const props = {
author: {
username: "Marvin",
},
body: "Woof",
};
const renderer = createRenderer();
renderer.render(<Comment {...props} />);
expect(renderer.getRenderOutput()).toMatchSnapshot();
});
it("renders with gutterBottom", () => {
const props = {
author: {
username: "Marvin",
},
body: "Woof",
gutterBottom: true,
};
const renderer = createRenderer();
renderer.render(<Comment {...props} />);
expect(renderer.getRenderOutput()).toMatchSnapshot();
});
@@ -0,0 +1,33 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders username and body 1`] = `
<div
className="root"
>
<withPropsOnChange(Typography)
className="author"
gutterBottom={true}
>
Marvin
</withPropsOnChange(Typography)>
<withPropsOnChange(Typography)>
Woof
</withPropsOnChange(Typography)>
</div>
`;
exports[`renders with gutterBottom 1`] = `
<div
className="root gutterBottom"
>
<withPropsOnChange(Typography)
className="author"
gutterBottom={true}
>
Marvin
</withPropsOnChange(Typography)>
<withPropsOnChange(Typography)>
Woof
</withPropsOnChange(Typography)>
</div>
`;
+9 -33
View File
@@ -5,40 +5,16 @@
"module": "esnext",
"jsx": "preserve",
"allowJs": false,
"lib": [
"dom",
"es7",
"scripthost",
"es2015",
"esnext.asynciterable"
],
"lib": ["dom", "es7", "scripthost", "es2015", "esnext.asynciterable"],
"baseUrl": "./",
"paths": {
"talk-admin/*": [
"./admin/*"
],
"talk-stream/*": [
"./stream/*"
],
"talk-framework/*": [
"./framework/*"
],
"talk-ui/*": [
"./ui/*"
],
"talk-common/*": [
"../common/*"
],
"talk-locales/*": [
"../../locales/*"
]
"talk-admin/*": ["./admin/*"],
"talk-stream/*": ["./stream/*"],
"talk-framework/*": ["./framework/*"],
"talk-ui/*": ["./ui/*"],
"talk-common/*": ["../common/*"]
}
},
"include": [
"./**/*",
"../../types/**/*.d.ts"
],
"exclude": [
"node_modules"
]
}
"include": ["./**/*", "../../types/**/*.d.ts"],
"exclude": ["node_modules"]
}
+6 -19
View File
@@ -9,26 +9,13 @@
"outDir": "../dist",
// See https://github.com/prismagraphql/graphql-request/issues/26 for why we
// have to include "dom" here.
"lib": [
"es6",
"esnext.asynciterable",
"dom"
],
"lib": ["es6", "esnext.asynciterable", "dom"],
"baseUrl": "./",
"paths": {
"talk-server/*": [
"./core/server/*"
],
"talk-common/*": [
"./core/common/*"
]
"talk-server/*": ["./core/server/*"],
"talk-common/*": ["./core/common/*"]
}
},
"include": [
"./**/*"
],
"exclude": [
"node_modules",
"./core/client"
]
}
"include": ["./**/*"],
"exclude": ["node_modules", "./core/client"]
}