Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update jest version to 29.7 #3528

Open
wants to merge 1 commit into
base: integration
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6,945 changes: 2,928 additions & 4,017 deletions packages/api/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"eslint-config-prettier": "^7.0.0",
"eslint-plugin-json": "^3.1.0",
"i18next-parser": "^5.3.0",
"jest": "^26.4.2",
"jest": "^29.7.0",
"lint-staged": "^10.5.3",
"nodemon": "^2.0.22",
"prettier": "2.2.1",
Expand Down
3 changes: 1 addition & 2 deletions packages/api/tests/animal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,9 @@ describe('Animal Tests', () => {
[newOwner] = await mocks.usersFactory();
});

afterAll(async (done) => {
afterAll(async () => {
await tableCleanup(knex);
await knex.destroy();
done();
});

// GET TESTS
Expand Down
3 changes: 1 addition & 2 deletions packages/api/tests/animal_batch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,9 @@ describe('Animal Batch Tests', () => {
[newOwner] = await mocks.usersFactory();
});

afterAll(async (done) => {
afterAll(async () => {
await tableCleanup(knex);
await knex.destroy();
done();
});

// GET TESTS
Expand Down
41 changes: 17 additions & 24 deletions packages/api/tests/animal_group.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,30 +40,24 @@ describe('Animal Group Tests', () => {
let farm;
let newOwner;

function getRequest({ user_id = newOwner.user_id, farm_id = farm.farm_id }, callback) {
chai
function getRequest({ user_id = newOwner.user_id, farm_id = farm.farm_id }) {
return chai
.request(server)
.get('/animal_groups')
.set('user_id', user_id)
.set('farm_id', farm_id)
.end(callback);
.set('farm_id', farm_id);
}

const getRequestAsPromise = util.promisify(getRequest);

function postRequest(data, { user_id = newOwner.user_id, farm_id = farm.farm_id }, callback) {
chai
function postRequest(data, { user_id = newOwner.user_id, farm_id = farm.farm_id }) {
return chai
.request(server)
.post('/animal_groups')
.set('Content-Type', 'application/json')
.set('user_id', user_id)
.set('farm_id', farm_id)
.send(data)
.end(callback);
.send(data);
}

const postRequestAsPromise = util.promisify(postRequest);

function fakeUserFarm(role = 1) {
return { ...mocks.fakeUserFarm(), role_id: role };
}
Expand Down Expand Up @@ -127,10 +121,9 @@ describe('Animal Group Tests', () => {
[newOwner] = await mocks.usersFactory();
});

afterAll(async (done) => {
afterAll(async () => {
await tableCleanup(knex);
await knex.destroy();
done();
});

// GET TESTS
Expand Down Expand Up @@ -169,7 +162,7 @@ describe('Animal Group Tests', () => {
// Create a third animal group belonging to a different farm
await makeAnimalGroup(secondFarm);

const res = await getRequestAsPromise({
const res = await getRequest({
user_id: user.user_id,
farm_id: mainFarm.farm_id,
});
Expand Down Expand Up @@ -206,7 +199,7 @@ describe('Animal Group Tests', () => {
await makeAnimalGroup(mainFarm);
const [unAuthorizedUser] = await mocks.usersFactory();

const res = await getRequestAsPromise({
const res = await getRequest({
user_id: unAuthorizedUser.user_id,
farm_id: mainFarm.farm_id,
});
Expand All @@ -228,7 +221,7 @@ describe('Animal Group Tests', () => {
await makeAnimalGroupRelationship(group, animal);
await makeAnimalBatchGroupRelationship(group, batch);

const res = await getRequestAsPromise({
const res = await getRequest({
user_id: user.user_id,
farm_id: mainFarm.farm_id,
});
Expand Down Expand Up @@ -263,7 +256,7 @@ describe('Animal Group Tests', () => {
const related_animal_ids = [firstAnimal.id, secondAnimal.id];
const related_batch_ids = [firstAnimalBatch.id, secondAnimalBatch.id];

const res = await postRequestAsPromise(
const res = await postRequest(
{
...animalGroup,
related_animal_ids,
Expand Down Expand Up @@ -320,7 +313,7 @@ describe('Animal Group Tests', () => {

const animalGroup = mocks.fakeAnimalGroup();

const res = await postRequestAsPromise(
const res = await postRequest(
{
...animalGroup,
related_animal_ids: [firstAnimal.id, secondAnimal.id],
Expand All @@ -343,7 +336,7 @@ describe('Animal Group Tests', () => {

const animalGroup = mocks.fakeAnimalGroup();

const res = await postRequestAsPromise(
const res = await postRequest(
{
...animalGroup,
related_animal_ids: [],
Expand Down Expand Up @@ -387,7 +380,7 @@ describe('Animal Group Tests', () => {

const animalGroup = mocks.fakeAnimalGroup();

await postRequestAsPromise(
await postRequest(
{
...animalGroup,
related_animal_ids: [],
Expand All @@ -399,7 +392,7 @@ describe('Animal Group Tests', () => {
},
);

const res = await postRequestAsPromise(
const res = await postRequest(
{
...animalGroup,
related_animal_ids: [],
Expand Down Expand Up @@ -427,7 +420,7 @@ describe('Animal Group Tests', () => {

const animalGroup = mocks.fakeAnimalGroup();

const res = await postRequestAsPromise(
const res = await postRequest(
{
...animalGroup,
related_animal_ids,
Expand Down Expand Up @@ -470,7 +463,7 @@ describe('Animal Group Tests', () => {

const animalGroup = mocks.fakeAnimalGroup();

const res = await postRequestAsPromise(
const res = await postRequest(
{
...animalGroup,
related_animal_ids,
Expand Down
17 changes: 6 additions & 11 deletions packages/api/tests/animal_identifier_color.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,14 @@ describe('Animal Identifier Color Tests', () => {
let farm;
let newOwner;

function getRequest({ user_id = newOwner.user_id, farm_id = farm.farm_id }, callback) {
chai
function getRequest({ user_id = newOwner.user_id, farm_id = farm.farm_id }) {
return chai
.request(server)
.get('/animal_identifier_colors')
.set('user_id', user_id)
.set('farm_id', farm_id)
.end(callback);
.set('farm_id', farm_id);
}

const getRequestAsPromise = util.promisify(getRequest);

function fakeUserFarm(role = 1) {
return { ...mocks.fakeUserFarm(), role_id: role };
}
Expand Down Expand Up @@ -78,14 +75,12 @@ describe('Animal Identifier Color Tests', () => {
[newOwner] = await mocks.usersFactory();
});

afterEach(async (done) => {
afterEach(async () => {
await tableCleanup(knex);
done();
});

afterAll(async (done) => {
afterAll(async () => {
await knex.destroy();
done();
});

// GET TESTS
Expand All @@ -98,7 +93,7 @@ describe('Animal Identifier Color Tests', () => {
for (const role of roles) {
const { mainFarm, user } = await returnUserFarms(role);

const res = await getRequestAsPromise({
const res = await getRequest({
user_id: user.user_id,
farm_id: mainFarm.farm_id,
});
Expand Down
6 changes: 2 additions & 4 deletions packages/api/tests/animal_identifier_type.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,12 @@ describe('Animal identifier type tests', () => {
[newOwner] = await mocks.usersFactory();
});

afterEach(async (done) => {
afterEach(async () => {
await tableCleanup(knex);
done();
});

afterAll(async (done) => {
afterAll(async () => {
await knex.destroy();
done();
});

test('should return all animal identifiers for all users', async () => {
Expand Down
17 changes: 6 additions & 11 deletions packages/api/tests/animal_origin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,14 @@ describe('Animal Origin Tests', () => {
let farm;
let newOwner;

function getRequest({ user_id = newOwner.user_id, farm_id = farm.farm_id }, callback) {
chai
function getRequest({ user_id = newOwner.user_id, farm_id = farm.farm_id }) {
return chai
.request(server)
.get('/animal_origins')
.set('user_id', user_id)
.set('farm_id', farm_id)
.end(callback);
.set('farm_id', farm_id);
}

const getRequestAsPromise = util.promisify(getRequest);

function fakeUserFarm(role = 1) {
return { ...mocks.fakeUserFarm(), role_id: role };
}
Expand Down Expand Up @@ -76,14 +73,12 @@ describe('Animal Origin Tests', () => {
[newOwner] = await mocks.usersFactory();
});

afterEach(async (done) => {
afterEach(async () => {
await tableCleanup(knex);
done();
});

afterAll(async (done) => {
afterAll(async () => {
await knex.destroy();
done();
});

// GET TESTS
Expand All @@ -96,7 +91,7 @@ describe('Animal Origin Tests', () => {
for (const role of roles) {
const { mainFarm, user } = await returnUserFarms(role);

const res = await getRequestAsPromise({
const res = await getRequest({
user_id: user.user_id,
farm_id: mainFarm.farm_id,
});
Expand Down
6 changes: 2 additions & 4 deletions packages/api/tests/animal_removal_reason.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,12 @@ describe('Animal Removal Reason Tests', () => {
[newOwner] = await mocks.usersFactory();
});

afterEach(async (done) => {
afterEach(async () => {
await tableCleanup(knex);
done();
});

afterAll(async (done) => {
afterAll(async () => {
await knex.destroy();
done();
});

// GET TESTS
Expand Down
17 changes: 6 additions & 11 deletions packages/api/tests/animal_sex.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,14 @@ describe('Animal Sex Tests', () => {
let farm;
let newOwner;

function getRequest({ user_id = newOwner.user_id, farm_id = farm.farm_id }, callback) {
chai
function getRequest({ user_id = newOwner.user_id, farm_id = farm.farm_id }) {
return chai
.request(server)
.get('/animal_sexes')
.set('user_id', user_id)
.set('farm_id', farm_id)
.end(callback);
.set('farm_id', farm_id);
}

const getRequestAsPromise = util.promisify(getRequest);

function fakeUserFarm(role = 1) {
return { ...mocks.fakeUserFarm(), role_id: role };
}
Expand Down Expand Up @@ -78,14 +75,12 @@ describe('Animal Sex Tests', () => {
[newOwner] = await mocks.usersFactory();
});

afterEach(async (done) => {
afterEach(async () => {
await tableCleanup(knex);
done();
});

afterAll(async (done) => {
afterAll(async () => {
await knex.destroy();
done();
});

// GET TESTS
Expand All @@ -98,7 +93,7 @@ describe('Animal Sex Tests', () => {
for (const role of roles) {
const { mainFarm, user } = await returnUserFarms(role);

const res = await getRequestAsPromise({
const res = await getRequest({
user_id: user.user_id,
farm_id: mainFarm.farm_id,
});
Expand Down
6 changes: 2 additions & 4 deletions packages/api/tests/animal_union_batch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ import animalUnionBatchIdViewModel from '../src/models/animalUnionBatchIdViewMod
import { makeAnimalOrBatchForFarm } from './utils/animalUtils.js';

describe('Animal Union Batch Tests', () => {
afterEach(async (done) => {
afterEach(async () => {
await tableCleanup(knex);
done();
});

afterAll(async (done) => {
afterAll(async () => {
await knex.destroy();
done();
});

// MODEL TESTS
Expand Down
6 changes: 2 additions & 4 deletions packages/api/tests/animal_use.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,12 @@ describe('Animal Use Tests', () => {
[newOwner] = await mocks.usersFactory();
});

afterEach(async (done) => {
afterEach(async () => {
await tableCleanup(knex);
done();
});

afterAll(async (done) => {
afterAll(async () => {
await knex.destroy();
done();
});

describe('Get animal use tests', () => {
Expand Down
Loading
Loading