mirror of
https://github.com/strapi/strapi.git
synced 2025-11-11 15:49:50 +00:00
Start test migrations
This commit is contained in:
parent
a1a2c76ae7
commit
6a17aa5ac8
@ -1,4 +1,12 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
extends: ['custom/back/typescript'],
|
extends: ['custom/back/typescript'],
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['**/*.test.ts'],
|
||||||
|
rules: {
|
||||||
|
'import/no-relative-packages': 'warn',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|||||||
@ -143,6 +143,7 @@
|
|||||||
"@types/bcryptjs": "2.4.3",
|
"@types/bcryptjs": "2.4.3",
|
||||||
"@types/configstore": "5.0.1",
|
"@types/configstore": "5.0.1",
|
||||||
"@types/delegates": "1.0.0",
|
"@types/delegates": "1.0.0",
|
||||||
|
"@types/jest": "29.5.2",
|
||||||
"@types/koa": "*",
|
"@types/koa": "*",
|
||||||
"@types/koa-compress": "4.0.3",
|
"@types/koa-compress": "4.0.3",
|
||||||
"@types/koa-session": "6.4.1",
|
"@types/koa-session": "6.4.1",
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import './global';
|
import './admin';
|
||||||
import strapiFactory from './Strapi';
|
import strapiFactory from './Strapi';
|
||||||
|
|
||||||
export = strapiFactory;
|
export = strapiFactory;
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
'use strict';
|
import crypto from 'crypto';
|
||||||
|
import { generateAdminUserHash } from '../admin-user-hash';
|
||||||
const crypto = require('crypto');
|
import createContext from '../../../../../../../test/helpers/create-context';
|
||||||
const { generateAdminUserHash } = require('../admin-user-hash');
|
|
||||||
const createContext = require('../../../../../../../test/helpers/create-context');
|
|
||||||
|
|
||||||
describe('user email hash', () => {
|
describe('user email hash', () => {
|
||||||
test('should create a hash from admin user email', () => {
|
test('should create a hash from admin user email', () => {
|
||||||
@ -22,7 +20,7 @@ describe('user email hash', () => {
|
|||||||
|
|
||||||
const hash = crypto.createHash('sha256').update('testemail@strapi.io').digest('hex');
|
const hash = crypto.createHash('sha256').update('testemail@strapi.io').digest('hex');
|
||||||
|
|
||||||
const userId = generateAdminUserHash(strapi);
|
const userId = generateAdminUserHash(strapi as any);
|
||||||
expect(userId).toBe(hash);
|
expect(userId).toBe(hash);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -35,7 +33,7 @@ describe('user email hash', () => {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const userId = generateAdminUserHash(strapi);
|
const userId = generateAdminUserHash(strapi as any);
|
||||||
expect(userId).toBe('');
|
expect(userId).toBe('');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -1,10 +1,8 @@
|
|||||||
'use strict';
|
import { get } from 'lodash/fp';
|
||||||
|
import metrics from '../index';
|
||||||
|
|
||||||
jest.mock('node-fetch', () => jest.fn(() => Promise.resolve()));
|
jest.mock('node-fetch', () => jest.fn(() => Promise.resolve()));
|
||||||
|
|
||||||
const { get } = require('lodash/fp');
|
|
||||||
const metrics = require('../index');
|
|
||||||
|
|
||||||
const fetch = jest.fn(() => Promise.resolve());
|
const fetch = jest.fn(() => Promise.resolve());
|
||||||
|
|
||||||
describe('metrics', () => {
|
describe('metrics', () => {
|
||||||
@ -37,7 +35,7 @@ describe('metrics', () => {
|
|||||||
get: jest.fn(() => ({})),
|
get: jest.fn(() => ({})),
|
||||||
},
|
},
|
||||||
fetch,
|
fetch,
|
||||||
});
|
} as any);
|
||||||
|
|
||||||
metricsInstance.register();
|
metricsInstance.register();
|
||||||
|
|
||||||
@ -72,7 +70,7 @@ describe('metrics', () => {
|
|||||||
get: jest.fn(() => ({})),
|
get: jest.fn(() => ({})),
|
||||||
},
|
},
|
||||||
fetch,
|
fetch,
|
||||||
});
|
} as any);
|
||||||
|
|
||||||
metricsInstance.register();
|
metricsInstance.register();
|
||||||
|
|
||||||
@ -105,21 +103,24 @@ describe('metrics', () => {
|
|||||||
get: jest.fn(() => ({})),
|
get: jest.fn(() => ({})),
|
||||||
},
|
},
|
||||||
fetch,
|
fetch,
|
||||||
});
|
} as any);
|
||||||
|
|
||||||
send('someEvent');
|
send('someEvent');
|
||||||
|
|
||||||
expect(fetch).toHaveBeenCalled();
|
expect(fetch).toHaveBeenCalled();
|
||||||
expect(fetch.mock.calls[0][0]).toBe('https://analytics.strapi.io/api/v2/track');
|
|
||||||
expect(fetch.mock.calls[0][1].method).toBe('POST');
|
const callParameters = fetch.mock.calls[0] as any[];
|
||||||
expect(JSON.parse(fetch.mock.calls[0][1].body)).toMatchObject({
|
expect(callParameters[0]).toBe('https://analytics.strapi.io/api/v2/track');
|
||||||
|
|
||||||
|
expect(callParameters[1].method).toBe('POST');
|
||||||
|
expect(JSON.parse(callParameters[1].body)).toMatchObject({
|
||||||
event: 'someEvent',
|
event: 'someEvent',
|
||||||
groupProperties: {
|
groupProperties: {
|
||||||
projectType: 'Community',
|
projectType: 'Community',
|
||||||
projectId: 'test',
|
projectId: 'test',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
expect(fetch.mock.calls[0][1].headers).toMatchObject({
|
expect(callParameters[1].headers).toMatchObject({
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'X-Strapi-Event': 'someEvent',
|
'X-Strapi-Event': 'someEvent',
|
||||||
});
|
});
|
||||||
@ -152,7 +153,7 @@ describe('metrics', () => {
|
|||||||
get: jest.fn(() => ({})),
|
get: jest.fn(() => ({})),
|
||||||
},
|
},
|
||||||
fetch,
|
fetch,
|
||||||
});
|
} as any);
|
||||||
|
|
||||||
send('someEvent');
|
send('someEvent');
|
||||||
|
|
||||||
@ -1,6 +1,4 @@
|
|||||||
'use strict';
|
import isTruthyEnvVar from '../is-truthy';
|
||||||
|
|
||||||
const isTruthyEnvVar = require('../is-truthy');
|
|
||||||
|
|
||||||
describe('isTruthyEnvVar', () => {
|
describe('isTruthyEnvVar', () => {
|
||||||
test('Handles boolean strings', () => {
|
test('Handles boolean strings', () => {
|
||||||
@ -8,7 +8,7 @@ export type BigInteger = Attribute.OfType<'biginteger'> &
|
|||||||
Attribute.PrivateOption &
|
Attribute.PrivateOption &
|
||||||
Attribute.RequiredOption &
|
Attribute.RequiredOption &
|
||||||
Attribute.WritableOption &
|
Attribute.WritableOption &
|
||||||
Attribute.VisibleOption
|
Attribute.VisibleOption;
|
||||||
|
|
||||||
export type BigIntegerValue = string;
|
export type BigIntegerValue = string;
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import type { Utils } from '@strapi/strapi';
|
import type { Utils } from '..';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Assign a default value `TDefault` to `TValue` if `TValue` is of type `never`
|
* Assign a default value `TDefault` to `TValue` if `TValue` is of type `never`
|
||||||
|
|||||||
14
yarn.lock
14
yarn.lock
@ -2452,12 +2452,12 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@casl/ability@npm:5.4.4":
|
"@casl/ability@npm:6.5.0":
|
||||||
version: 5.4.4
|
version: 6.5.0
|
||||||
resolution: "@casl/ability@npm:5.4.4"
|
resolution: "@casl/ability@npm:6.5.0"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@ucast/mongo2js": ^1.3.0
|
"@ucast/mongo2js": ^1.3.0
|
||||||
checksum: d7afcf09fdd03b1908bdf009246b76327f19cf26b16d235d331231f5ad40fde51d42567fe669143c383627177f547585d6d99486eb4d4b98171cde67b5ee4cd2
|
checksum: 3e5e415ea1c8e5a0865825caea01ab4c146a78888f5efb00a6241957f3141eeb2ccd603acc6a4fc10c401c75b04543bcfc20c22b65d95da32f6b2ea081cfcf2d
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
@ -6950,7 +6950,7 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@strapi/admin@workspace:packages/core/admin"
|
resolution: "@strapi/admin@workspace:packages/core/admin"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@casl/ability": 5.4.4
|
"@casl/ability": 6.5.0
|
||||||
"@pmmmwh/react-refresh-webpack-plugin": 0.5.10
|
"@pmmmwh/react-refresh-webpack-plugin": 0.5.10
|
||||||
"@strapi/data-transfer": 4.12.7
|
"@strapi/data-transfer": 4.12.7
|
||||||
"@strapi/design-system": 1.9.0
|
"@strapi/design-system": 1.9.0
|
||||||
@ -7055,7 +7055,6 @@ __metadata:
|
|||||||
resolution: "@strapi/data-transfer@workspace:packages/core/data-transfer"
|
resolution: "@strapi/data-transfer@workspace:packages/core/data-transfer"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@strapi/logger": 4.12.7
|
"@strapi/logger": 4.12.7
|
||||||
"@strapi/strapi": 4.12.7
|
|
||||||
"@types/fs-extra": 9.0.13
|
"@types/fs-extra": 9.0.13
|
||||||
"@types/jest": 29.5.2
|
"@types/jest": 29.5.2
|
||||||
"@types/koa": "*"
|
"@types/koa": "*"
|
||||||
@ -7271,7 +7270,7 @@ __metadata:
|
|||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@strapi/permissions@workspace:packages/core/permissions"
|
resolution: "@strapi/permissions@workspace:packages/core/permissions"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@casl/ability": 5.4.4
|
"@casl/ability": 6.5.0
|
||||||
"@strapi/utils": 4.12.7
|
"@strapi/utils": 4.12.7
|
||||||
eslint-config-custom: 4.12.7
|
eslint-config-custom: 4.12.7
|
||||||
lodash: 4.17.21
|
lodash: 4.17.21
|
||||||
@ -7723,6 +7722,7 @@ __metadata:
|
|||||||
"@types/bcryptjs": 2.4.3
|
"@types/bcryptjs": 2.4.3
|
||||||
"@types/configstore": 5.0.1
|
"@types/configstore": 5.0.1
|
||||||
"@types/delegates": 1.0.0
|
"@types/delegates": 1.0.0
|
||||||
|
"@types/jest": 29.5.2
|
||||||
"@types/koa": "*"
|
"@types/koa": "*"
|
||||||
"@types/koa-compress": 4.0.3
|
"@types/koa-compress": 4.0.3
|
||||||
"@types/koa-session": 6.4.1
|
"@types/koa-session": 6.4.1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user