diff --git a/.nycrc.json b/.nycrc.json index c630bd216..dc2a4a2a5 100644 --- a/.nycrc.json +++ b/.nycrc.json @@ -1,7 +1,6 @@ { "exclude": [ - "**/teambition-sdk-mock/**", - "**/teambition-sdk-fixture/**" + "**/teambition-sdk-testutil/**" ], "include": [ "**/src/**" diff --git a/circle.yml b/circle.yml index 9ed982d6d..40fa6f77c 100644 --- a/circle.yml +++ b/circle.yml @@ -12,6 +12,8 @@ dependencies: - ~/.cache/yarn test: + override: + - yarn test pre: - greenkeeper-lockfile-update - lerna run build_cjs diff --git a/package.json b/package.json index 46066b79f..92fe01ad2 100644 --- a/package.json +++ b/package.json @@ -64,9 +64,8 @@ "snapper-consumer": "^1.3.6", "source-map-support": "^0.4.16", "teambition-sdk-core": "^0.8.13", - "teambition-sdk-fixture": "^0.8.13", - "teambition-sdk-mock": "^0.8.13", "teambition-sdk-request": "^0.8.13", + "teambition-sdk-testutil": "^0.8.13", "tman": "^1.7.1", "ts-node": "^3.2.0", "tslib": "^1.7.1", diff --git a/packages/teambition-sdk-core/package.json b/packages/teambition-sdk-core/package.json index d91e12840..09c210a82 100644 --- a/packages/teambition-sdk-core/package.json +++ b/packages/teambition-sdk-core/package.json @@ -73,8 +73,7 @@ "sinon": "^2.3.8", "sinon-chai": "^2.11.0", "snapper-consumer": "^1.3.6", - "teambition-sdk-fixture": "^0.8.13", - "teambition-sdk-mock": "^0.8.13", + "teambition-sdk-testutil": "^0.8.13", "tman": "^1.7.1", "ts-node": "^3.2.0", "tslib": "^1.7.1", diff --git a/packages/teambition-sdk-core/test/mock/MockFetch.ts b/packages/teambition-sdk-core/test/mock/MockFetch.ts index 8fc18ab78..b380f5c44 100644 --- a/packages/teambition-sdk-core/test/mock/MockFetch.ts +++ b/packages/teambition-sdk-core/test/mock/MockFetch.ts @@ -1,4 +1,4 @@ -import { Backend } from 'teambition-sdk-mock' +import { Backend } from 'teambition-sdk-testutil' import { SDKFetch } from '../index' function throwIfSlashPath(path: string) { diff --git a/packages/teambition-sdk-core/test/mock/MockSpec.ts b/packages/teambition-sdk-core/test/mock/MockSpec.ts index 4da5020bd..345db8c86 100644 --- a/packages/teambition-sdk-core/test/mock/MockSpec.ts +++ b/packages/teambition-sdk-core/test/mock/MockSpec.ts @@ -2,7 +2,7 @@ import * as chai from 'chai' import * as sinon from 'sinon' import * as sinonChai from 'sinon-chai' -import { Backend, parseObject, reParseQuery } from 'teambition-sdk-mock' +import { Backend, parseObject, reParseQuery } from 'teambition-sdk-testutil' import { describe, it, beforeEach } from 'tman' const expect = chai.expect diff --git a/packages/teambition-sdk-core/test/net/net.ts b/packages/teambition-sdk-core/test/net/net.ts index a92082cee..f88305b70 100644 --- a/packages/teambition-sdk-core/test/net/net.ts +++ b/packages/teambition-sdk-core/test/net/net.ts @@ -4,12 +4,11 @@ import { Database, DataStoreType } from 'reactivedb' import { expect, use } from 'chai' import { spy } from 'sinon' import * as SinonChai from 'sinon-chai' -import { Backend } from 'teambition-sdk-mock' +import { Backend, EventsFixture } from 'teambition-sdk-testutil' import '../../src/schemas' import { schemas, CacheStrategy } from '../../src/SDK' import { Net, SDKFetch, forEach, uuid, Http, EventSchema, } from '..' import { ApiResult } from '../../src/Net/Net' -import { EventsFixture } from 'teambition-sdk-fixture' const { normalEvent, projectEvents } = EventsFixture diff --git a/packages/teambition-sdk-core/test/sockets/eventParser.spec.ts b/packages/teambition-sdk-core/test/sockets/eventParser.spec.ts index 187c42326..9519db840 100644 --- a/packages/teambition-sdk-core/test/sockets/eventParser.spec.ts +++ b/packages/teambition-sdk-core/test/sockets/eventParser.spec.ts @@ -1,4 +1,4 @@ -import { RequestEvent } from 'teambition-sdk-mock' +import { RequestEvent } from 'teambition-sdk-testutil' import { describe, beforeEach, it } from 'tman' import { expect } from 'chai' diff --git a/packages/teambition-sdk-core/test/sockets/sockets.spec.ts b/packages/teambition-sdk-core/test/sockets/sockets.spec.ts index 2c2e7b10b..bdfb49015 100644 --- a/packages/teambition-sdk-core/test/sockets/sockets.spec.ts +++ b/packages/teambition-sdk-core/test/sockets/sockets.spec.ts @@ -1,6 +1,6 @@ import { describe, beforeEach, afterEach, it } from 'tman' import { expect } from 'chai' -import { SocketMock } from 'teambition-sdk-mock' +import { SocketMock } from 'teambition-sdk-testutil' import { createSdk, SDK, SDKFetch } from '../' import { restore } from '../utils' import * as sinon from 'sinon' diff --git a/packages/teambition-sdk-core/test/utils/httpErrorSpec.ts b/packages/teambition-sdk-core/test/utils/httpErrorSpec.ts index 5d5297dc3..e4ba9c2c5 100644 --- a/packages/teambition-sdk-core/test/utils/httpErrorSpec.ts +++ b/packages/teambition-sdk-core/test/utils/httpErrorSpec.ts @@ -1,7 +1,7 @@ import * as chai from 'chai' import { Subject } from 'rxjs/Subject' import { describe, it, beforeEach, afterEach } from 'tman' -import { Backend } from 'teambition-sdk-mock' +import { Backend } from 'teambition-sdk-testutil' import { Http, HttpErrorMessage, SDKFetch } from '../index' diff --git a/packages/teambition-sdk-mock/package.json b/packages/teambition-sdk-mock/package.json deleted file mode 100644 index 05fef90d0..000000000 --- a/packages/teambition-sdk-mock/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "teambition-sdk-mock", - "version": "0.8.13", - "description": "Front-End SDK (Mock) for Teambition", - "main": "./dist/cjs/index.js", - "typings": "./dist/cjs/index.d.ts", - "scripts": { - "build_cjs": "rm -rf dist/mock-cjs && tsc src/index.ts -m commonjs --outDir dist/cjs --sourcemap --inlineSources --target ES5 -d --diagnostics --pretty --strict --noUnusedLocals --noUnusedParameters --experimentalDecorators --suppressImplicitAnyIndexErrors --moduleResolution node --lib es5,es2015.iterable,es2015.collection,es2015.promise,es2015.core,dom" - }, - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/teambition/teambition-sdk.git" - }, - "keywords": [ - "teambition", - "sdk", - "teambition-sdk", - "mock" - ], - "author": "lynweklm@gmail.com", - "license": "MIT", - "bugs": { - "url": "https://github.com/teambition/teambition-sdk/issues" - }, - "homepage": "https://github.com/teambition/teambition-sdk#readme", - "peerDependencies": { - "core-js": "^2.4.1" - } -} diff --git a/packages/teambition-sdk-mock/tsconfig.json b/packages/teambition-sdk-mock/tsconfig.json deleted file mode 100644 index e4bd95e6b..000000000 --- a/packages/teambition-sdk-mock/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "target": "es6", - "importHelpers": true, - "experimentalDecorators": true, - "inlineSourceMap": true, - "outDir": ".tmp", - "module": "commonjs", - "emitDecoratorMetadata": true, - "types": [ - "node" - ], - "typeRoots": [ - "node_modules/@types" - ], - "strict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "suppressImplicitAnyIndexErrors": true - }, - "exclude": [ - "node_modules", - "tools/build", - "dist" - ], - "compileOnSave": false -} diff --git a/packages/teambition-sdk-request/package.json b/packages/teambition-sdk-request/package.json index a5f850684..68a113009 100644 --- a/packages/teambition-sdk-request/package.json +++ b/packages/teambition-sdk-request/package.json @@ -56,8 +56,7 @@ "sinon": "^2.3.8", "sinon-chai": "^2.11.0", "teambition-sdk-core": "^0.8.13", - "teambition-sdk-fixture": "^0.8.13", - "teambition-sdk-mock": "^0.8.13", + "teambition-sdk-testutil": "^0.8.13", "tman": "^1.7.1", "ts-node": "^3.2.0", "tslib": "^1.7.1", diff --git a/packages/teambition-sdk-request/test/apis/EventGenerator.spec.ts b/packages/teambition-sdk-request/test/apis/EventGenerator.spec.ts index 1e73e2b7d..a55b981a4 100644 --- a/packages/teambition-sdk-request/test/apis/EventGenerator.spec.ts +++ b/packages/teambition-sdk-request/test/apis/EventGenerator.spec.ts @@ -1,7 +1,7 @@ import { describe, beforeEach, it } from 'tman' import { expect } from 'chai' import * as Moment from 'moment' -import { EventsFixture } from 'teambition-sdk-fixture' +import { EventsFixture } from 'teambition-sdk-testutil' import { EventGenerator } from '../../src/event/EventGenerator' import { Utils } from 'teambition-sdk-core' diff --git a/packages/teambition-sdk-request/test/apis/event.spec.ts b/packages/teambition-sdk-request/test/apis/event.spec.ts index 1f633b19e..93553910c 100644 --- a/packages/teambition-sdk-request/test/apis/event.spec.ts +++ b/packages/teambition-sdk-request/test/apis/event.spec.ts @@ -2,8 +2,7 @@ import * as moment from 'moment' import { describe, beforeEach, afterEach, it } from 'tman' import { expect } from 'chai' import { SDK, EventSchema } from 'teambition-sdk-core' -import { EventsFixture } from 'teambition-sdk-fixture' -import { SocketMock } from 'teambition-sdk-mock' +import { EventsFixture, SocketMock } from 'teambition-sdk-testutil' import { createSdk } from '../index' import { mock, restore, equals, looseDeepEqual, clone } from '../utils' diff --git a/packages/teambition-sdk-request/test/apis/file.spec.ts b/packages/teambition-sdk-request/test/apis/file.spec.ts index fd19cc0da..27418591b 100644 --- a/packages/teambition-sdk-request/test/apis/file.spec.ts +++ b/packages/teambition-sdk-request/test/apis/file.spec.ts @@ -1,9 +1,8 @@ import { describe, beforeEach, afterEach, it } from 'tman' import { expect } from 'chai' import { SDK, FileSchema } from 'teambition-sdk-core' -import { SocketMock } from 'teambition-sdk-mock' +import { FilesFixture, SocketMock } from 'teambition-sdk-testutil' import { createSdk } from '../index' -import { FilesFixture } from 'teambition-sdk-fixture' import { mock, restore, looseDeepEqual } from '../utils' describe('FileApi Spec', () => { diff --git a/packages/teambition-sdk-request/test/apis/like.spec.ts b/packages/teambition-sdk-request/test/apis/like.spec.ts index 0107357b7..99833f1ed 100644 --- a/packages/teambition-sdk-request/test/apis/like.spec.ts +++ b/packages/teambition-sdk-request/test/apis/like.spec.ts @@ -2,9 +2,8 @@ import { expect } from 'chai' import { describe, it, beforeEach, afterEach } from 'tman' import { SDK, LikeSchema } from 'teambition-sdk-core' -import { SocketMock } from 'teambition-sdk-mock' +import { LikeFixture as like, SocketMock } from 'teambition-sdk-testutil' import { createSdk } from '../index' -import { LikeFixture as like } from 'teambition-sdk-fixture' import { mock, restore } from '../utils' describe('LikeApi Spec: ', () => { diff --git a/packages/teambition-sdk-request/test/apis/my.spec.ts b/packages/teambition-sdk-request/test/apis/my.spec.ts index d8b386255..93d410025 100644 --- a/packages/teambition-sdk-request/test/apis/my.spec.ts +++ b/packages/teambition-sdk-request/test/apis/my.spec.ts @@ -1,10 +1,9 @@ import { describe, it, beforeEach, afterEach } from 'tman' import { expect } from 'chai' import { SDK, EventSchema, TaskSchema } from 'teambition-sdk-core' -import { SocketMock } from 'teambition-sdk-mock' +import { MyFixture, SocketMock } from 'teambition-sdk-testutil' import { createSdk } from '../index' import { EventGenerator, isRecurrence } from '../../src/event' -import { MyFixture } from 'teambition-sdk-fixture' import { mock, restore } from '../utils' function normIfRecurrentEvent(myRecent: any[]): any[] { diff --git a/packages/teambition-sdk-request/test/apis/post.spec.ts b/packages/teambition-sdk-request/test/apis/post.spec.ts index 1d54c0d87..877955fad 100644 --- a/packages/teambition-sdk-request/test/apis/post.spec.ts +++ b/packages/teambition-sdk-request/test/apis/post.spec.ts @@ -1,9 +1,8 @@ import { describe, beforeEach, afterEach, it } from 'tman' import { expect } from 'chai' import { SDK, PostSchema } from 'teambition-sdk-core' -import { SocketMock } from 'teambition-sdk-mock' +import { PostsFixture, SocketMock } from 'teambition-sdk-testutil' import { createSdk } from '../index' -import { PostsFixture } from 'teambition-sdk-fixture' import { mock, restore, equals } from '../utils' import { shuffle } from 'lodash' diff --git a/packages/teambition-sdk-request/test/apis/task.spec.ts b/packages/teambition-sdk-request/test/apis/task.spec.ts index f7f8d37ab..2eabc1cb4 100644 --- a/packages/teambition-sdk-request/test/apis/task.spec.ts +++ b/packages/teambition-sdk-request/test/apis/task.spec.ts @@ -1,9 +1,8 @@ import { describe, beforeEach, afterEach, it } from 'tman' import { expect } from 'chai' import { SDK, TaskSchema } from 'teambition-sdk-core' -import { SocketMock } from 'teambition-sdk-mock' +import { SocketMock, TasksFixture } from 'teambition-sdk-testutil' import { createSdk } from '../index' -import { TasksFixture } from 'teambition-sdk-fixture' import { mock, restore, looseDeepEqual } from '../utils' describe('TaskApi Spec', () => { diff --git a/packages/teambition-sdk-request/test/apis/user.spec.ts b/packages/teambition-sdk-request/test/apis/user.spec.ts index f35400818..695bc40fe 100644 --- a/packages/teambition-sdk-request/test/apis/user.spec.ts +++ b/packages/teambition-sdk-request/test/apis/user.spec.ts @@ -1,9 +1,8 @@ import { describe, beforeEach, afterEach, it } from 'tman' import { expect } from 'chai' import { SDK, UserMe } from 'teambition-sdk-core' -import { SocketMock } from 'teambition-sdk-mock' +import { SocketMock, UserFixture as userMe } from 'teambition-sdk-testutil' import { createSdk } from '../index' -import { UserFixture as userMe } from 'teambition-sdk-fixture' import { mock, restore } from '../utils' describe('UserApi Spec', () => { diff --git a/packages/teambition-sdk-request/test/asyncLoadRDB.spec.ts b/packages/teambition-sdk-request/test/asyncLoadRDB.spec.ts index 0e450207a..7b2eb2f71 100644 --- a/packages/teambition-sdk-request/test/asyncLoadRDB.spec.ts +++ b/packages/teambition-sdk-request/test/asyncLoadRDB.spec.ts @@ -1,15 +1,15 @@ import { describe, beforeEach, afterEach, it } from 'tman' import { expect } from 'chai' import { Subscription } from 'rxjs' -import { SocketMock } from 'teambition-sdk-mock' import { SDK, TaskSchema, PostSchema, LikeSchema } from 'teambition-sdk-core' import { + SocketMock, LikeFixture as like, MyFixture, PostsFixture, TasksFixture, UserFixture as userMe, -} from 'teambition-sdk-fixture' +} from 'teambition-sdk-testutil' import { mock, restore, equals } from './utils' import { createSdkWithoutRDB, loadRDB, normIfRecurrentEvent, EventGenerator } from './index' diff --git a/packages/teambition-sdk-request/test/mock/MockFetch.ts b/packages/teambition-sdk-request/test/mock/MockFetch.ts index f543525f7..5c214df24 100644 --- a/packages/teambition-sdk-request/test/mock/MockFetch.ts +++ b/packages/teambition-sdk-request/test/mock/MockFetch.ts @@ -1,5 +1,5 @@ import { SDKFetch } from 'teambition-sdk-core' -import { Backend } from 'teambition-sdk-mock' +import { Backend } from 'teambition-sdk-testutil' function throwIfSlashPath(path: string) { if (path.charAt(0) === '/') { diff --git a/packages/teambition-sdk-fixture/package.json b/packages/teambition-sdk-testutil/package.json similarity index 72% rename from packages/teambition-sdk-fixture/package.json rename to packages/teambition-sdk-testutil/package.json index 6dbe7ba6c..170270491 100644 --- a/packages/teambition-sdk-fixture/package.json +++ b/packages/teambition-sdk-testutil/package.json @@ -1,8 +1,8 @@ { "private": true, - "name": "teambition-sdk-fixture", + "name": "teambition-sdk-testutil", "version": "0.8.13", - "description": "Front-End SDK (Fixture) for Teambition", + "description": "Front-End SDK (TestUtil) for Teambition", "main": "./dist/cjs/index.js", "typings": "./dist/cjs/index.d.ts", "scripts": { @@ -15,12 +15,17 @@ "keywords": [ "teambition", "sdk", - "teambition-sdk" + "teambition-sdk", + "mock", + "fixture" ], "author": "lynweklm@gmail.com", "license": "MIT", "bugs": { "url": "https://github.com/teambition/teambition-sdk/issues" }, - "homepage": "https://github.com/teambition/teambition-sdk#readme" + "homepage": "https://github.com/teambition/teambition-sdk#readme", + "peerDependencies": { + "core-js": "^2.4.1" + } } diff --git a/packages/teambition-sdk-fixture/src/events.fixture.ts b/packages/teambition-sdk-testutil/src/fixture/events.fixture.ts similarity index 100% rename from packages/teambition-sdk-fixture/src/events.fixture.ts rename to packages/teambition-sdk-testutil/src/fixture/events.fixture.ts diff --git a/packages/teambition-sdk-fixture/src/files.fixture.ts b/packages/teambition-sdk-testutil/src/fixture/files.fixture.ts similarity index 100% rename from packages/teambition-sdk-fixture/src/files.fixture.ts rename to packages/teambition-sdk-testutil/src/fixture/files.fixture.ts diff --git a/packages/teambition-sdk-fixture/src/index.ts b/packages/teambition-sdk-testutil/src/fixture/index.ts similarity index 100% rename from packages/teambition-sdk-fixture/src/index.ts rename to packages/teambition-sdk-testutil/src/fixture/index.ts diff --git a/packages/teambition-sdk-fixture/src/like.fixture.ts b/packages/teambition-sdk-testutil/src/fixture/like.fixture.ts similarity index 100% rename from packages/teambition-sdk-fixture/src/like.fixture.ts rename to packages/teambition-sdk-testutil/src/fixture/like.fixture.ts diff --git a/packages/teambition-sdk-fixture/src/my.fixture.ts b/packages/teambition-sdk-testutil/src/fixture/my.fixture.ts similarity index 100% rename from packages/teambition-sdk-fixture/src/my.fixture.ts rename to packages/teambition-sdk-testutil/src/fixture/my.fixture.ts diff --git a/packages/teambition-sdk-fixture/src/posts.fixture.ts b/packages/teambition-sdk-testutil/src/fixture/posts.fixture.ts similarity index 100% rename from packages/teambition-sdk-fixture/src/posts.fixture.ts rename to packages/teambition-sdk-testutil/src/fixture/posts.fixture.ts diff --git a/packages/teambition-sdk-fixture/src/tasks.fixture.ts b/packages/teambition-sdk-testutil/src/fixture/tasks.fixture.ts similarity index 100% rename from packages/teambition-sdk-fixture/src/tasks.fixture.ts rename to packages/teambition-sdk-testutil/src/fixture/tasks.fixture.ts diff --git a/packages/teambition-sdk-fixture/src/user.fixture.ts b/packages/teambition-sdk-testutil/src/fixture/user.fixture.ts similarity index 100% rename from packages/teambition-sdk-fixture/src/user.fixture.ts rename to packages/teambition-sdk-testutil/src/fixture/user.fixture.ts diff --git a/packages/teambition-sdk-testutil/src/index.ts b/packages/teambition-sdk-testutil/src/index.ts new file mode 100644 index 000000000..b40c873f3 --- /dev/null +++ b/packages/teambition-sdk-testutil/src/index.ts @@ -0,0 +1,2 @@ +export * from './mock' +export * from './fixture' diff --git a/packages/teambition-sdk-mock/src/backend.ts b/packages/teambition-sdk-testutil/src/mock/backend.ts similarity index 100% rename from packages/teambition-sdk-mock/src/backend.ts rename to packages/teambition-sdk-testutil/src/mock/backend.ts diff --git a/packages/teambition-sdk-mock/src/index.ts b/packages/teambition-sdk-testutil/src/mock/index.ts similarity index 100% rename from packages/teambition-sdk-mock/src/index.ts rename to packages/teambition-sdk-testutil/src/mock/index.ts diff --git a/packages/teambition-sdk-mock/src/mock.ts b/packages/teambition-sdk-testutil/src/mock/mock.ts similarity index 100% rename from packages/teambition-sdk-mock/src/mock.ts rename to packages/teambition-sdk-testutil/src/mock/mock.ts diff --git a/packages/teambition-sdk-mock/src/response.ts b/packages/teambition-sdk-testutil/src/mock/response.ts similarity index 100% rename from packages/teambition-sdk-mock/src/response.ts rename to packages/teambition-sdk-testutil/src/mock/response.ts diff --git a/packages/teambition-sdk-mock/src/socket.ts b/packages/teambition-sdk-testutil/src/mock/socket.ts similarity index 100% rename from packages/teambition-sdk-mock/src/socket.ts rename to packages/teambition-sdk-testutil/src/mock/socket.ts diff --git a/packages/teambition-sdk-mock/src/utils.ts b/packages/teambition-sdk-testutil/src/mock/utils.ts similarity index 100% rename from packages/teambition-sdk-mock/src/utils.ts rename to packages/teambition-sdk-testutil/src/mock/utils.ts diff --git a/packages/teambition-sdk-fixture/tsconfig.json b/packages/teambition-sdk-testutil/tsconfig.json similarity index 52% rename from packages/teambition-sdk-fixture/tsconfig.json rename to packages/teambition-sdk-testutil/tsconfig.json index 4650d4398..9af9b0894 100644 --- a/packages/teambition-sdk-fixture/tsconfig.json +++ b/packages/teambition-sdk-testutil/tsconfig.json @@ -1,17 +1,39 @@ { "compilerOptions": { "module": "commonjs", + "moduleResolution": "node", "outDir": "dist/cjs", - "sourceMap": true, - "inlineSources": true, "target": "ES5", + + "types": [ + "node" + ], + "typeRoots": [ + "node_modules/@types" + ], + + "inlineSources": true, + "inlineSourceMap": true, "declaration": true, "diagnostics": true, "pretty": true, + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + + "strict": true, "noUnusedLocals": true, "noUnusedParameters": true, + "noImplicitReturns": true, "suppressImplicitAnyIndexErrors": true, - "moduleResolution": "node", + + "lib": [ + "es5", + "es2015.iterable", + "es2015.collection", + "es2015.promise", + "es2015.core", + "dom" + ], "importHelpers": true, "noEmitHelpers": true }, @@ -19,3 +41,4 @@ "src/index.ts" ] } +