mirror of
https://github.com/wassname/talk.git
synced 2026-07-05 00:52:27 +08:00
Merge branch 'watch-fixes' of ssh://github.com/coralproject/talk into watch-fixes
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
const path = require("path");
|
||||
|
||||
module.exports = {
|
||||
displayName: "client",
|
||||
rootDir: "../",
|
||||
roots: ["<rootDir>/src/core/client"],
|
||||
collectCoverageFrom: ["**/*.{js,jsx,mjs,ts,tsx}"],
|
||||
coveragePathIgnorePatterns: ["/node_modules/"],
|
||||
setupFiles: [
|
||||
"<rootDir>/config/polyfills.js",
|
||||
"<rootDir>/src/core/client/test/setup.ts",
|
||||
],
|
||||
testMatch: ["**/*.spec.{js,jsx,mjs,ts,tsx}"],
|
||||
testEnvironment: "node",
|
||||
testURL: "http://localhost",
|
||||
transform: {
|
||||
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest",
|
||||
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
|
||||
"^(?!.*\\.(js|jsx|mjs|ts|tsx|css|json|ftl)$)":
|
||||
"<rootDir>/config/jest/fileTransform.js",
|
||||
},
|
||||
transformIgnorePatterns: [
|
||||
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|ts|tsx)$",
|
||||
],
|
||||
moduleNameMapper: {
|
||||
"^talk-admin/(.*)$": "<rootDir>/src/core/client/admin/$1",
|
||||
"^talk-ui/(.*)$": "<rootDir>/src/core/client/ui/$1",
|
||||
"^talk-stream/(.*)$": "<rootDir>/src/core/client/stream/$1",
|
||||
"^talk-framework/(.*)$": "<rootDir>/src/core/client/framework/$1",
|
||||
"^talk-common/(.*)$": "<rootDir>/src/core/common/$1",
|
||||
},
|
||||
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
|
||||
snapshotSerializers: ["enzyme-to-json/serializer"],
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
useBabelrc: true,
|
||||
tsConfigFile: path.resolve(__dirname, "tsconfig.jest.json"),
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,19 @@
|
||||
module.exports = {
|
||||
displayName: "server",
|
||||
rootDir: "../",
|
||||
roots: ["<rootDir>/src"],
|
||||
collectCoverageFrom: ["**/*.{js,jsx,mjs,ts,tsx}"],
|
||||
coveragePathIgnorePatterns: ["/node_modules/"],
|
||||
testMatch: ["**/*.spec.{js,jsx,mjs,ts,tsx}"],
|
||||
testPathIgnorePatterns: ["/node_modules/", "/client/"],
|
||||
testEnvironment: "node",
|
||||
testURL: "http://localhost",
|
||||
transform: {
|
||||
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest",
|
||||
},
|
||||
moduleNameMapper: {
|
||||
"^talk-server/(.*)$": "<rootDir>/src/core/server/$1",
|
||||
"^talk-common/(.*)$": "<rootDir>/src/core/common/$1",
|
||||
},
|
||||
moduleFileExtensions: ["ts", "tsx", "js", "jsx", "json", "node"],
|
||||
};
|
||||
+3
-45
@@ -1,48 +1,6 @@
|
||||
const path = require("path");
|
||||
const paths = require("./paths");
|
||||
|
||||
module.exports = {
|
||||
rootDir: "../",
|
||||
roots: ["<rootDir>/src", "<rootDir>/scripts"],
|
||||
collectCoverageFrom: ["src/**/*.{js,jsx,mjs,ts,tsx}"],
|
||||
coveragePathIgnorePatterns: ["/node_modules/"],
|
||||
setupFiles: ["<rootDir>/config/polyfills.js", "<rootDir>/test/setupjest.ts"],
|
||||
testMatch: ["**/*.spec.{js,jsx,mjs,ts,tsx}"],
|
||||
testEnvironment: "node",
|
||||
testURL: "http://localhost",
|
||||
transform: {
|
||||
"^.+\\.(js|jsx|mjs|ts|tsx)$": "<rootDir>/node_modules/ts-jest",
|
||||
"^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
|
||||
"^(?!.*\\.(js|jsx|mjs|css|json|ftl)$)":
|
||||
"<rootDir>/config/jest/fileTransform.js",
|
||||
},
|
||||
transformIgnorePatterns: [
|
||||
"[/\\\\]node_modules[/\\\\].+\\.(js|jsx|mjs|ts|tsx)$",
|
||||
projects: [
|
||||
"<rootDir>/jest-client.config.js",
|
||||
"<rootDir>/jest-server.config.js",
|
||||
],
|
||||
moduleNameMapper: {
|
||||
"^talk-admin/(.*)$": "<rootDir>/src/core/client/admin/$1",
|
||||
"^talk-ui/(.*)$": "<rootDir>/src/core/client/ui/$1",
|
||||
"^talk-stream/(.*)$": "<rootDir>/src/core/client/stream/$1",
|
||||
"^talk-framework/(.*)$": "<rootDir>/src/core/client/framework/$1",
|
||||
"^talk-common/(.*)$": "<rootDir>/src/core/common/$1",
|
||||
"^talk-server/(.*)$": "<rootDir>/src/core/server/$1",
|
||||
},
|
||||
moduleFileExtensions: [
|
||||
"web.js",
|
||||
"js",
|
||||
"json",
|
||||
"web.jsx",
|
||||
"jsx",
|
||||
"node",
|
||||
"mjs",
|
||||
"ts",
|
||||
"tsx",
|
||||
],
|
||||
snapshotSerializers: ["enzyme-to-json/serializer"],
|
||||
globals: {
|
||||
"ts-jest": {
|
||||
useBabelrc: true,
|
||||
tsConfigFile: path.resolve(__dirname, "tsconfig.jest.json"),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
import { getPageInfo } from "./connection";
|
||||
|
||||
it("handles when there is none requested", () => {
|
||||
const pageInfo = getPageInfo({ first: 0 }, []);
|
||||
|
||||
expect(pageInfo).toEqual({
|
||||
hasNextPage: false,
|
||||
hasPreviousPage: false,
|
||||
startCursor: null,
|
||||
endCursor: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("handles when there is no edges", () => {
|
||||
const pageInfo = getPageInfo({ first: 10 }, []);
|
||||
|
||||
expect(pageInfo).toEqual({
|
||||
hasNextPage: false,
|
||||
hasPreviousPage: false,
|
||||
startCursor: null,
|
||||
endCursor: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("handles when there is more edges than requested", () => {
|
||||
const pageInfo = getPageInfo({ first: 1 }, [
|
||||
{
|
||||
node: null,
|
||||
cursor: 1,
|
||||
},
|
||||
{
|
||||
node: null,
|
||||
cursor: 2,
|
||||
},
|
||||
]);
|
||||
|
||||
expect(pageInfo).toEqual({
|
||||
hasNextPage: true,
|
||||
hasPreviousPage: false,
|
||||
startCursor: null,
|
||||
endCursor: 1,
|
||||
});
|
||||
});
|
||||
|
||||
it("handles when there is exactly as many edges as requested", () => {
|
||||
const pageInfo = getPageInfo({ first: 1 }, [
|
||||
{
|
||||
node: null,
|
||||
cursor: 1,
|
||||
},
|
||||
]);
|
||||
|
||||
expect(pageInfo).toEqual({
|
||||
hasNextPage: false,
|
||||
hasPreviousPage: false,
|
||||
startCursor: null,
|
||||
endCursor: 1,
|
||||
});
|
||||
});
|
||||
@@ -1,6 +0,0 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
["@babel/env", { targets: "last 2 versions, ie 11", modules: "commonjs" }],
|
||||
"@babel/react",
|
||||
],
|
||||
};
|
||||
Reference in New Issue
Block a user