From 4ddc3dc6f87c192627d00db85a1080411400eeb5 Mon Sep 17 00:00:00 2001 From: Tim Leslie Date: Wed, 1 Jul 2020 08:59:02 +1000 Subject: [PATCH 1/8] Remove name argument to setupServer (#3212) --- .changeset/friendly-bees-switch.md | 8 +++++++ .changeset/metal-shoes-work.md | 21 +++++++++++++++++++ api-tests/CalendarDay.test.js | 2 -- api-tests/DateTime.test.js | 2 -- api-tests/Virtual.test.js | 2 -- api-tests/access-control/utils.js | 2 -- api-tests/auth-header.test.js | 2 -- api-tests/default-value/defaults.test.js | 2 -- .../extend-graphql-schema.test.js | 2 -- api-tests/fields.test.js | 4 +--- api-tests/hooks/list-hooks.test.js | 2 -- api-tests/package.json | 1 - api-tests/queries-access-control/meta.test.js | 2 -- api-tests/queries/cache-hints.test.js | 3 --- api-tests/queries/limits.test.js | 3 --- api-tests/queries/meta.test.js | 2 -- api-tests/queries/relationships.test.js | 2 -- api-tests/queries/search.test.js | 3 --- .../many-to-many-one-sided.test.js | 7 +------ .../crud-self-ref/many-to-many.test.js | 7 +------ .../one-to-many-one-sided.test.js | 7 +------ .../crud-self-ref/one-to-many.test.js | 7 +------ .../crud-self-ref/one-to-one.test.js | 7 +------ .../crud/many-to-many-one-sided.test.js | 7 +------ .../relationships/crud/many-to-many.test.js | 7 +------ .../crud/one-to-many-one-sided.test.js | 7 +------ .../relationships/crud/one-to-many.test.js | 7 +------ .../relationships/crud/one-to-one.test.js | 7 +------ .../filtering/access-control.test.js | 2 -- .../relationships/filtering/filtering.test.js | 2 -- .../relationships/filtering/nested.test.js | 2 -- .../nested-mutations/connect-many.test.js | 2 -- .../nested-mutations/connect-singular.test.js | 2 -- .../create-and-connect-many.test.js | 2 -- .../create-and-connect-singular.test.js | 2 -- .../nested-mutations/create-many.test.js | 2 -- .../nested-mutations/create-singular.test.js | 2 -- .../disconnect-all-many.test.js | 2 -- .../disconnect-all-singular.test.js | 2 -- .../nested-mutations/disconnect-many.test.js | 2 -- .../disconnect-singular.test.js | 2 -- .../reconnect-many-to-one.test.js | 2 -- .../two-way-backreference/to-many.test.js | 2 -- .../to-one-required.test.js | 2 -- api-tests/required.test.js | 2 -- api-tests/uniqueness/unique.test.js | 2 -- benchmarks/fixtures/create-related.js | 2 -- benchmarks/fixtures/create.js | 2 -- benchmarks/fixtures/query.js | 2 -- benchmarks/package.json | 1 - packages/fields-wysiwyg-tinymce/package.json | 1 - .../src/types/Slug/Implementation.test.js | 1 - packages/test-utils/lib/test-utils.js | 3 +-- 53 files changed, 41 insertions(+), 142 deletions(-) create mode 100644 .changeset/friendly-bees-switch.md create mode 100644 .changeset/metal-shoes-work.md diff --git a/.changeset/friendly-bees-switch.md b/.changeset/friendly-bees-switch.md new file mode 100644 index 00000000000..340bb2c4e82 --- /dev/null +++ b/.changeset/friendly-bees-switch.md @@ -0,0 +1,8 @@ +--- +'@keystonejs/benchmarks': patch +'@keystonejs/fields-wysiwyg-tinymce': patch +'@keystonejs/fields': patch +'@keystonejs/test-utils': patch +--- + +Removed `name` argument from calls to `setupServer` in tests. diff --git a/.changeset/metal-shoes-work.md b/.changeset/metal-shoes-work.md new file mode 100644 index 00000000000..8d6dbcae9bf --- /dev/null +++ b/.changeset/metal-shoes-work.md @@ -0,0 +1,21 @@ +--- +'@keystonejs/api-tests': major +--- + +Removed the `name` argument to `setupServer`. This value will now be autogenerated by the test system. If you would like to use a specific name you can still pass through `{ keystoneOptions: { name: '...' } }` to retain the original behaviour. + +``` +setupServer({ name: 'foo', adapterName, createLists, ... }); +``` + +can now be written as + +``` +setupServer({ adapterName, createLists, ... }) +``` + +or, if you would like the `Keystone` instance to have a specific name, + +``` +setupServer({ adapterName, createLists, keystoneOptions: { name: 'foo' }, ... }) +``` diff --git a/api-tests/CalendarDay.test.js b/api-tests/CalendarDay.test.js index 2f0df6a0ce1..a984473a8ab 100644 --- a/api-tests/CalendarDay.test.js +++ b/api-tests/CalendarDay.test.js @@ -1,12 +1,10 @@ const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const { CalendarDay } = require('@keystonejs/fields'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/api-tests/DateTime.test.js b/api-tests/DateTime.test.js index 1b0bf2ea97f..86fdba5af75 100644 --- a/api-tests/DateTime.test.js +++ b/api-tests/DateTime.test.js @@ -1,11 +1,9 @@ const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const { Text, DateTime } = require('@keystonejs/fields'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Post', { fields: { diff --git a/api-tests/Virtual.test.js b/api-tests/Virtual.test.js index a333fea5d28..9cc42b85932 100644 --- a/api-tests/Virtual.test.js +++ b/api-tests/Virtual.test.js @@ -1,12 +1,10 @@ const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const { Integer, Virtual } = require('@keystonejs/fields'); -const cuid = require('cuid'); function makeSetupKeystone(fields) { return function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Post', { fields: { diff --git a/api-tests/access-control/utils.js b/api-tests/access-control/utils.js index 188cc32fae2..5ec9f57d57a 100644 --- a/api-tests/access-control/utils.js +++ b/api-tests/access-control/utils.js @@ -1,4 +1,3 @@ -const cuid = require('cuid'); const { setupServer } = require('@keystonejs/test-utils'); const { Text } = require('@keystonejs/fields'); const { objMerge } = require('@keystonejs/utils'); @@ -102,7 +101,6 @@ const createFieldImperative = fieldAccess => ({ function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { name: { type: Text } } }); diff --git a/api-tests/auth-header.test.js b/api-tests/auth-header.test.js index 5e630609ba0..40097b7b5b3 100644 --- a/api-tests/auth-header.test.js +++ b/api-tests/auth-header.test.js @@ -2,7 +2,6 @@ const { PasswordAuthStrategy } = require('@keystonejs/auth-password'); const { Text, Password, DateTime } = require('@keystonejs/fields'); const { multiAdapterRunners, networkedGraphqlRequest } = require('@keystonejs/test-utils'); const { setupServer } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); const initialData = { User: [ @@ -25,7 +24,6 @@ const defaultAccess = ({ authentication: { item } }) => !!item; function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `Jest Test Project For Login Auth ${cuid()}`, createLists: keystone => { keystone.createList('Post', { fields: { diff --git a/api-tests/default-value/defaults.test.js b/api-tests/default-value/defaults.test.js index 69c0fe800e8..f8329b3d924 100644 --- a/api-tests/default-value/defaults.test.js +++ b/api-tests/default-value/defaults.test.js @@ -1,10 +1,8 @@ const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const { Text } = require('@keystonejs/fields'); -const cuid = require('cuid'); const setupList = (adapterName, fields) => setupServer({ - name: `ks5-testdb-${cuid()}`, adapterName, createLists: keystone => { keystone.createList('User', { fields }); diff --git a/api-tests/extend-graphql-schema/extend-graphql-schema.test.js b/api-tests/extend-graphql-schema/extend-graphql-schema.test.js index 85e9ea9cf4a..8ce4d0f0607 100644 --- a/api-tests/extend-graphql-schema/extend-graphql-schema.test.js +++ b/api-tests/extend-graphql-schema/extend-graphql-schema.test.js @@ -5,14 +5,12 @@ const { graphqlRequest, networkedGraphqlRequest, } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); const falseFn = () => false; function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { name: { type: Text } }, diff --git a/api-tests/fields.test.js b/api-tests/fields.test.js index 2f0a3c5c1a6..1747c4ac223 100644 --- a/api-tests/fields.test.js +++ b/api-tests/fields.test.js @@ -1,6 +1,5 @@ const globby = require('globby'); const path = require('path'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer } = require('@keystonejs/test-utils'); // `mongodb-memory-server` downloads a binary on first run in CI, which can take @@ -20,14 +19,13 @@ describe('Fields', () => { const keystoneTestWrapper = (testFn = () => {}) => runner( () => { - const name = `Field tests for ${mod.name} ${cuid()}`; const createLists = keystone => { // Create a list with all the fields required for testing const fields = mod.getTestFields(); keystone.createList(listName, { fields }); }; - return setupServer({ name, adapterName, createLists }); + return setupServer({ adapterName, createLists }); }, async ({ keystone, ...rest }) => { // Populate the database before running the tests diff --git a/api-tests/hooks/list-hooks.test.js b/api-tests/hooks/list-hooks.test.js index 005641bc98b..185c000bc5e 100644 --- a/api-tests/hooks/list-hooks.test.js +++ b/api-tests/hooks/list-hooks.test.js @@ -1,11 +1,9 @@ const { Text } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/api-tests/package.json b/api-tests/package.json index 4faec57f4b9..0d25d5e3c98 100644 --- a/api-tests/package.json +++ b/api-tests/package.json @@ -27,7 +27,6 @@ "@keystonejs/fields": "^13.0.1", "@keystonejs/test-utils": "^7.0.0", "@keystonejs/utils": "^5.4.1", - "cuid": "^2.1.8", "date-fns": "^2.14.0", "express": "^4.17.1" } diff --git a/api-tests/queries-access-control/meta.test.js b/api-tests/queries-access-control/meta.test.js index d33fb8c5a32..3fb1c628ccd 100644 --- a/api-tests/queries-access-control/meta.test.js +++ b/api-tests/queries-access-control/meta.test.js @@ -1,11 +1,9 @@ const { Text, Relationship } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/api-tests/queries/cache-hints.test.js b/api-tests/queries/cache-hints.test.js index b350dfd345b..8bbc9b64e72 100644 --- a/api-tests/queries/cache-hints.test.js +++ b/api-tests/queries/cache-hints.test.js @@ -5,12 +5,9 @@ const { networkedGraphqlRequest, } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); - function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Post', { fields: { diff --git a/api-tests/queries/limits.test.js b/api-tests/queries/limits.test.js index 3dfe3953535..7bc3c8aeb77 100644 --- a/api-tests/queries/limits.test.js +++ b/api-tests/queries/limits.test.js @@ -9,12 +9,9 @@ const { validation: { depthLimit, definitionLimit, fieldLimit }, } = require('@keystonejs/app-graphql'); -const cuid = require('cuid'); - function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Post', { fields: { diff --git a/api-tests/queries/meta.test.js b/api-tests/queries/meta.test.js index 565bc537f8a..c7c5124ac31 100644 --- a/api-tests/queries/meta.test.js +++ b/api-tests/queries/meta.test.js @@ -1,11 +1,9 @@ const { Text, Relationship } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/api-tests/queries/relationships.test.js b/api-tests/queries/relationships.test.js index a1522b5134f..2c7544e8f19 100644 --- a/api-tests/queries/relationships.test.js +++ b/api-tests/queries/relationships.test.js @@ -4,12 +4,10 @@ const { Text, Relationship } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Post', { fields: { diff --git a/api-tests/queries/search.test.js b/api-tests/queries/search.test.js index 58ac5b18168..4445f5f636a 100644 --- a/api-tests/queries/search.test.js +++ b/api-tests/queries/search.test.js @@ -1,12 +1,9 @@ const { Text, Integer } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); - function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Test', { fields: { diff --git a/api-tests/relationships/crud-self-ref/many-to-many-one-sided.test.js b/api-tests/relationships/crud-self-ref/many-to-many-one-sided.test.js index 9cb20a24886..5aa8b0ec744 100644 --- a/api-tests/relationships/crud-self-ref/many-to-many-one-sided.test.js +++ b/api-tests/relationships/crud-self-ref/many-to-many-one-sided.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -113,11 +112,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => describe(`Many-to-many relationships`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud-self-ref/many-to-many.test.js b/api-tests/relationships/crud-self-ref/many-to-many.test.js index d7aca30988e..1b6d7a90d4b 100644 --- a/api-tests/relationships/crud-self-ref/many-to-many.test.js +++ b/api-tests/relationships/crud-self-ref/many-to-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -127,11 +126,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`Many-to-many relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud-self-ref/one-to-many-one-sided.test.js b/api-tests/relationships/crud-self-ref/one-to-many-one-sided.test.js index b845a52a633..ceaf229ab41 100644 --- a/api-tests/relationships/crud-self-ref/one-to-many-one-sided.test.js +++ b/api-tests/relationships/crud-self-ref/one-to-many-one-sided.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -118,11 +117,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => describe(`One-to-many relationships `, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Count', () => { diff --git a/api-tests/relationships/crud-self-ref/one-to-many.test.js b/api-tests/relationships/crud-self-ref/one-to-many.test.js index 2be78780d10..9ddbe8eedec 100644 --- a/api-tests/relationships/crud-self-ref/one-to-many.test.js +++ b/api-tests/relationships/crud-self-ref/one-to-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -124,11 +123,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`One-to-many relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud-self-ref/one-to-one.test.js b/api-tests/relationships/crud-self-ref/one-to-one.test.js index b3279bc2e99..bc13ca966f6 100644 --- a/api-tests/relationships/crud-self-ref/one-to-one.test.js +++ b/api-tests/relationships/crud-self-ref/one-to-one.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -90,11 +89,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`One-to-one relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud/many-to-many-one-sided.test.js b/api-tests/relationships/crud/many-to-many-one-sided.test.js index 64db2ef67c3..d4cd6226742 100644 --- a/api-tests/relationships/crud/many-to-many-one-sided.test.js +++ b/api-tests/relationships/crud/many-to-many-one-sided.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -136,11 +135,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`Many-to-many relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud/many-to-many.test.js b/api-tests/relationships/crud/many-to-many.test.js index cc53c4bd0fa..93fe771017b 100644 --- a/api-tests/relationships/crud/many-to-many.test.js +++ b/api-tests/relationships/crud/many-to-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -138,11 +137,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`Many-to-many relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud/one-to-many-one-sided.test.js b/api-tests/relationships/crud/one-to-many-one-sided.test.js index 50635503a0e..d626f26b23b 100644 --- a/api-tests/relationships/crud/one-to-many-one-sided.test.js +++ b/api-tests/relationships/crud/one-to-many-one-sided.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -146,11 +145,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`One-to-many relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Count', () => { diff --git a/api-tests/relationships/crud/one-to-many.test.js b/api-tests/relationships/crud/one-to-many.test.js index 55fdcef73c6..90cd41148b5 100644 --- a/api-tests/relationships/crud/one-to-many.test.js +++ b/api-tests/relationships/crud/one-to-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -134,11 +133,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`One-to-many relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/crud/one-to-one.test.js b/api-tests/relationships/crud/one-to-one.test.js index 9ade5101c50..239cd162471 100644 --- a/api-tests/relationships/crud/one-to-one.test.js +++ b/api-tests/relationships/crud/one-to-one.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -130,11 +129,7 @@ multiAdapterRunners().map(({ runner, adapterName }) => ].forEach(([createLists, order]) => { describe(`One-to-one relationships - ${order}`, () => { function setupKeystone(adapterName) { - return setupServer({ - adapterName, - name: `ks5-testdb-${cuid()}`, - createLists, - }); + return setupServer({ adapterName, createLists }); } describe('Read', () => { diff --git a/api-tests/relationships/filtering/access-control.test.js b/api-tests/relationships/filtering/access-control.test.js index 1b1a051dfc9..c74fb7a3bd6 100644 --- a/api-tests/relationships/filtering/access-control.test.js +++ b/api-tests/relationships/filtering/access-control.test.js @@ -5,7 +5,6 @@ const { setupServer, networkedGraphqlRequest, } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -14,7 +13,6 @@ const postNames = ['Post 1', 'Post 2', 'Post 3']; function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('UserToPostLimitedRead', { fields: { diff --git a/api-tests/relationships/filtering/filtering.test.js b/api-tests/relationships/filtering/filtering.test.js index 0e8eb7c7059..c11a148b7f9 100644 --- a/api-tests/relationships/filtering/filtering.test.js +++ b/api-tests/relationships/filtering/filtering.test.js @@ -1,11 +1,9 @@ const { Text, Relationship } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/api-tests/relationships/filtering/nested.test.js b/api-tests/relationships/filtering/nested.test.js index dcbdea6ccb3..f66da58600b 100644 --- a/api-tests/relationships/filtering/nested.test.js +++ b/api-tests/relationships/filtering/nested.test.js @@ -1,11 +1,9 @@ const { Text, Relationship } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/api-tests/relationships/nested-mutations/connect-many.test.js b/api-tests/relationships/nested-mutations/connect-many.test.js index 5c9c1c5947b..261186401e8 100644 --- a/api-tests/relationships/nested-mutations/connect-many.test.js +++ b/api-tests/relationships/nested-mutations/connect-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Note', { fields: { diff --git a/api-tests/relationships/nested-mutations/connect-singular.test.js b/api-tests/relationships/nested-mutations/connect-singular.test.js index bd7edf10cae..18fabaaddbe 100644 --- a/api-tests/relationships/nested-mutations/connect-singular.test.js +++ b/api-tests/relationships/nested-mutations/connect-singular.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -11,7 +10,6 @@ const { function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Group', { fields: { diff --git a/api-tests/relationships/nested-mutations/create-and-connect-many.test.js b/api-tests/relationships/nested-mutations/create-and-connect-many.test.js index da4e1d2c580..fb3fd792c15 100644 --- a/api-tests/relationships/nested-mutations/create-and-connect-many.test.js +++ b/api-tests/relationships/nested-mutations/create-and-connect-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Note', { fields: { diff --git a/api-tests/relationships/nested-mutations/create-and-connect-singular.test.js b/api-tests/relationships/nested-mutations/create-and-connect-singular.test.js index 42012a88c4f..28a26bf5bdc 100644 --- a/api-tests/relationships/nested-mutations/create-and-connect-singular.test.js +++ b/api-tests/relationships/nested-mutations/create-and-connect-singular.test.js @@ -1,11 +1,9 @@ const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Group', { fields: { diff --git a/api-tests/relationships/nested-mutations/create-many.test.js b/api-tests/relationships/nested-mutations/create-many.test.js index 7de1415040c..fe52d3f443b 100644 --- a/api-tests/relationships/nested-mutations/create-many.test.js +++ b/api-tests/relationships/nested-mutations/create-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Note', { fields: { diff --git a/api-tests/relationships/nested-mutations/create-singular.test.js b/api-tests/relationships/nested-mutations/create-singular.test.js index 2e622c31e89..00220844135 100644 --- a/api-tests/relationships/nested-mutations/create-singular.test.js +++ b/api-tests/relationships/nested-mutations/create-singular.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -11,7 +10,6 @@ const { function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Group', { fields: { diff --git a/api-tests/relationships/nested-mutations/disconnect-all-many.test.js b/api-tests/relationships/nested-mutations/disconnect-all-many.test.js index 515be32bbab..9e4a2515421 100644 --- a/api-tests/relationships/nested-mutations/disconnect-all-many.test.js +++ b/api-tests/relationships/nested-mutations/disconnect-all-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { setupServer, graphqlRequest, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Note', { fields: { diff --git a/api-tests/relationships/nested-mutations/disconnect-all-singular.test.js b/api-tests/relationships/nested-mutations/disconnect-all-singular.test.js index 2563c2d16b0..3d6cd8c3b96 100644 --- a/api-tests/relationships/nested-mutations/disconnect-all-singular.test.js +++ b/api-tests/relationships/nested-mutations/disconnect-all-singular.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Group', { fields: { diff --git a/api-tests/relationships/nested-mutations/disconnect-many.test.js b/api-tests/relationships/nested-mutations/disconnect-many.test.js index e17b75e4499..d2d38cb32f3 100644 --- a/api-tests/relationships/nested-mutations/disconnect-many.test.js +++ b/api-tests/relationships/nested-mutations/disconnect-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Note', { fields: { diff --git a/api-tests/relationships/nested-mutations/disconnect-singular.test.js b/api-tests/relationships/nested-mutations/disconnect-singular.test.js index 6d599fa8bc9..d29003b164f 100644 --- a/api-tests/relationships/nested-mutations/disconnect-singular.test.js +++ b/api-tests/relationships/nested-mutations/disconnect-singular.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, @@ -13,7 +12,6 @@ const alphanumGenerator = gen.alphaNumString.notEmpty(); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Group', { fields: { diff --git a/api-tests/relationships/nested-mutations/reconnect-many-to-one.test.js b/api-tests/relationships/nested-mutations/reconnect-many-to-one.test.js index 67af3eb767c..a354d5f401b 100644 --- a/api-tests/relationships/nested-mutations/reconnect-many-to-one.test.js +++ b/api-tests/relationships/nested-mutations/reconnect-many-to-one.test.js @@ -1,11 +1,9 @@ const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Note', { fields: { diff --git a/api-tests/relationships/nested-mutations/two-way-backreference/to-many.test.js b/api-tests/relationships/nested-mutations/two-way-backreference/to-many.test.js index d8b36ad6dd0..b5221efbb45 100644 --- a/api-tests/relationships/nested-mutations/two-way-backreference/to-many.test.js +++ b/api-tests/relationships/nested-mutations/two-way-backreference/to-many.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -14,7 +13,6 @@ jest.setTimeout(60000); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Student', { fields: { diff --git a/api-tests/relationships/nested-mutations/two-way-backreference/to-one-required.test.js b/api-tests/relationships/nested-mutations/two-way-backreference/to-one-required.test.js index b6001053e8e..5ceac163e3b 100644 --- a/api-tests/relationships/nested-mutations/two-way-backreference/to-one-required.test.js +++ b/api-tests/relationships/nested-mutations/two-way-backreference/to-one-required.test.js @@ -1,6 +1,5 @@ const { gen, sampleOne } = require('testcheck'); const { Text, Relationship } = require('@keystonejs/fields'); -const cuid = require('cuid'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const alphanumGenerator = gen.alphaNumString.notEmpty(); @@ -10,7 +9,6 @@ jest.setTimeout(6000000); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('Company', { fields: { diff --git a/api-tests/required.test.js b/api-tests/required.test.js index 0b2dd2768bf..51a68aefc0d 100644 --- a/api-tests/required.test.js +++ b/api-tests/required.test.js @@ -1,4 +1,3 @@ -const cuid = require('cuid'); const globby = require('globby'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const { Text } = require('@keystonejs/fields'); @@ -17,7 +16,6 @@ describe('Test isRequired flag for all field types', () => { runner( () => setupServer({ - name: `Field tests for ${type.type} ${cuid()}`, adapterName, createLists: keystone => { if (type.type === 'Select') { diff --git a/api-tests/uniqueness/unique.test.js b/api-tests/uniqueness/unique.test.js index c03b35b2634..406a680fede 100644 --- a/api-tests/uniqueness/unique.test.js +++ b/api-tests/uniqueness/unique.test.js @@ -1,11 +1,9 @@ const { Text } = require('@keystonejs/fields'); const { multiAdapterRunners, setupServer, graphqlRequest } = require('@keystonejs/test-utils'); -const cuid = require('cuid'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/benchmarks/fixtures/create-related.js b/benchmarks/fixtures/create-related.js index f2c1800a06c..a46a840e4a0 100644 --- a/benchmarks/fixtures/create-related.js +++ b/benchmarks/fixtures/create-related.js @@ -1,4 +1,3 @@ -const cuid = require('cuid'); const { Text, Relationship } = require('@keystonejs/fields'); const { setupServer } = require('@keystonejs/test-utils'); const { FixtureGroup, timeQuery, populate, range } = require('../lib/utils'); @@ -6,7 +5,6 @@ const { FixtureGroup, timeQuery, populate, range } = require('../lib/utils'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/benchmarks/fixtures/create.js b/benchmarks/fixtures/create.js index 1207fb6fac7..d2d94dce08a 100644 --- a/benchmarks/fixtures/create.js +++ b/benchmarks/fixtures/create.js @@ -1,4 +1,3 @@ -const cuid = require('cuid'); const { Text } = require('@keystonejs/fields'); const { setupServer } = require('@keystonejs/test-utils'); const { FixtureGroup, timeQuery, populate, range } = require('../lib/utils'); @@ -6,7 +5,6 @@ const { FixtureGroup, timeQuery, populate, range } = require('../lib/utils'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/benchmarks/fixtures/query.js b/benchmarks/fixtures/query.js index 9f5c7a022d6..793b2e122b0 100644 --- a/benchmarks/fixtures/query.js +++ b/benchmarks/fixtures/query.js @@ -1,4 +1,3 @@ -const cuid = require('cuid'); const { Text, Relationship } = require('@keystonejs/fields'); const { setupServer, graphqlRequest } = require('@keystonejs/test-utils'); const { FixtureGroup, timeQuery, populate, range } = require('../lib/utils'); @@ -6,7 +5,6 @@ const { FixtureGroup, timeQuery, populate, range } = require('../lib/utils'); function setupKeystone(adapterName) { return setupServer({ adapterName, - name: `ks5-testdb-${cuid()}`, createLists: keystone => { keystone.createList('User', { fields: { diff --git a/benchmarks/package.json b/benchmarks/package.json index 2ddb404e423..122bfd79565 100644 --- a/benchmarks/package.json +++ b/benchmarks/package.json @@ -23,7 +23,6 @@ "@keystonejs/test-utils": "^7.0.0", "body-parser": "^1.18.2", "cookie-signature": "^1.1.0", - "cuid": "^2.1.8", "supertest-light": "^1.0.3", "testcheck": "^1.0.0-rc.2" } diff --git a/packages/fields-wysiwyg-tinymce/package.json b/packages/fields-wysiwyg-tinymce/package.json index 936b1a546b1..57455fd8711 100644 --- a/packages/fields-wysiwyg-tinymce/package.json +++ b/packages/fields-wysiwyg-tinymce/package.json @@ -19,7 +19,6 @@ "@keystonejs/build-field-types": "^5.2.8", "@keystonejs/fields": "^13.0.0", "@tinymce/tinymce-react": "^3.5.0", - "cuid": "^2.1.8", "prop-types": "^15.7.2", "react": "^16.13.1", "tinymce": "^5.2.2" diff --git a/packages/fields/src/types/Slug/Implementation.test.js b/packages/fields/src/types/Slug/Implementation.test.js index a69d10e5a83..24ab559c24c 100644 --- a/packages/fields/src/types/Slug/Implementation.test.js +++ b/packages/fields/src/types/Slug/Implementation.test.js @@ -21,7 +21,6 @@ const generateListName = () => const setupList = (adapterName, fields) => setupServer({ - name: 'Slug Tests', adapterName, createLists: keystone => { keystone.createList(generateListName(), { fields }); diff --git a/packages/test-utils/lib/test-utils.js b/packages/test-utils/lib/test-utils.js index d51d26a7721..f36c70f53fb 100644 --- a/packages/test-utils/lib/test-utils.js +++ b/packages/test-utils/lib/test-utils.js @@ -9,7 +9,6 @@ const { KnexAdapter } = require('@keystonejs/adapter-knex'); const { MongooseAdapter } = require('@keystonejs/adapter-mongoose'); async function setupServer({ - name, adapterName, schemaName = 'testing', schemaNames = ['testing'], @@ -28,7 +27,7 @@ async function setupServer({ }[adapterName]; const keystone = new Keystone({ - name, + name: 'keystone-test-server', adapter: new Adapter(await argGenerator()), defaultAccess: { list: true, field: true }, schemaNames, From 887ad8199aa5c32a3db8588104f4548c90aa106c Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Wed, 1 Jul 2020 10:20:37 +1100 Subject: [PATCH 2/8] Arch: redesigned Pagination component (#3178) --- .changeset/curly-hounds-melt.md | 5 + packages/arch/packages/pagination/src/Page.js | 1 + .../packages/pagination/src/Pagination.js | 173 ++++++++---------- .../integration/list-view-url-state_spec.js | 12 -- 4 files changed, 80 insertions(+), 111 deletions(-) create mode 100644 .changeset/curly-hounds-melt.md diff --git a/.changeset/curly-hounds-melt.md b/.changeset/curly-hounds-melt.md new file mode 100644 index 00000000000..82902170da4 --- /dev/null +++ b/.changeset/curly-hounds-melt.md @@ -0,0 +1,5 @@ +--- +'@arch-ui/pagination': patch +--- + +Redesigned Pagination display. diff --git a/packages/arch/packages/pagination/src/Page.js b/packages/arch/packages/pagination/src/Page.js index f796651b84e..630684a74b1 100644 --- a/packages/arch/packages/pagination/src/Page.js +++ b/packages/arch/packages/pagination/src/Page.js @@ -15,6 +15,7 @@ const Page = props => { return (