Skip to content

Commit

Permalink
Upgrade GDevelop.js jest to v29 and adapt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
4ian committed Nov 26, 2023
1 parent e054258 commit 231d60d
Show file tree
Hide file tree
Showing 21 changed files with 6,339 additions and 6,923 deletions.
418 changes: 53 additions & 365 deletions GDevelop.js/__tests__/Core.js

Large diffs are not rendered by default.

321 changes: 321 additions & 0 deletions GDevelop.js/__tests__/ExpressionCompletionFinder.spec.js

Large diffs are not rendered by default.

11 changes: 4 additions & 7 deletions GDevelop.js/__tests__/GDJS.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@ const { makeTestExtensions } = require('../TestUtils/TestExtensions');

describe('libGD.js - GDJS related tests', function () {
let gd = null;
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
makeTestExtensions(gd);
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
makeTestExtensions(gd);
});

describe('Exporter', () => {
// Fake files to simulate a file system (see tests below).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ const {

describe('libGD.js - GDJS Code Generation integration tests', function () {
let gd = null;
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
});

const generateAndRunVariableAffectationWithConditions = (
parameterTypes,
Expand Down
11 changes: 4 additions & 7 deletions GDevelop.js/__tests__/GDJSAsyncCodeGenerationIntegrationTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ const { makeTestExtensions } = require('../TestUtils/TestExtensions');

describe('libGD.js - GDJS Async Code Generation integration tests', function () {
let gd = null;
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
makeTestExtensions(gd);
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
makeTestExtensions(gd);
});

describe('Basics', () => {
it('generates a working function with asynchronous actions', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ const {

describe('libGD.js - GDJS Code Generation integration tests', () => {
let gd = null;
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
});

describe('can generate a function that create an instance', () => {
const generateFunctionWithCreateAction = (gd) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ const makeAddOneToObjectTestVariableEvent = (objectName) => ({

describe('libGD.js - GDJS Code Generation integration tests', function () {
let gd = null;
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
});

it('does not generate anything for a disabled event and its sub events', function () {
const serializerElement = gd.Serializer.fromJSObject([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ const { makeMinimalGDJSMock } = require('../TestUtils/GDJSMocks');

describe('libGD.js - GDJS Behavior Code Generation integration tests', function () {
let gd = null;
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
});

it('generates a working empty behavior', function () {
// Create an empty behavior
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ const {

describe('libGD.js - GDJS Boolean Operator Code Generation integration tests', () => {
let gd = null;
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
});

const generateAndRunVariableAffectationWithConditions = (conditions) => {
const serializerElement = gd.Serializer.fromJSObject([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ const {

describe('libGD.js - GDJS Code Generation integration tests', function () {
let gd = null;
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
});

const generateAndRunVariableAffectationWithConditions = (
conditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ const { makeTestExtensions } = require('../TestUtils/TestExtensions.js');

describe('libGD.js - GDJS Custom Object Code Generation integration tests', function () {
let gd = null;
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
makeTestExtensions(gd);
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
makeTestExtensions(gd);
});

it('generates a working custom object with properties (with different types), all used in an expression', () => {
const { gdjs, runtimeScene } = makeMinimalGDJSMock();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,9 @@ const {

describe('libGD.js - GDJS Scene Code Generation integration tests', function () {
let gd = null;
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
});

it('generates code for a link to an external events', function () {
const project = new gd.ProjectHelper.createNewGDJSProject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ const {

describe('libGD.js - GDJS Object Code Generation integration tests', function () {
let gd = null;
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
});

describe('SceneInstancesCount', () => {
const prepareCompiledEvents = () => {
Expand Down
10 changes: 3 additions & 7 deletions GDevelop.js/__tests__/GDJSProjectSerialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@ const { makeTestExtensions } = require('../TestUtils/TestExtensions');

describe('libGD.js - GDJS project serialization tests', function () {
let gd = null;

beforeAll((done) => {
initializeGDevelopJs().then((module) => {
gd = module;
makeTestExtensions(gd);
done();
});
beforeAll(async () => {
gd = await initializeGDevelopJs();
makeTestExtensions(gd);
});

it('should keep TextObject configuration after after a save and reload', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ const {

describe('libGD.js - GDJS Code Generation integration tests', function () {
let gd = null;
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
});

const generateAndRunVariableAffectationWithConditions = (
variableValue,
Expand Down
9 changes: 3 additions & 6 deletions GDevelop.js/__tests__/MetadataDeclarationHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@ const initializeGDevelopJs = require('../../Binaries/embuild/GDevelop.js/libGD.j

describe('MetadataDeclarationHelper', () => {
let gd = null;
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
});

it('can create metadata for free actions', () => {
const extension = new gd.PlatformExtension();
Expand Down
7 changes: 3 additions & 4 deletions GDevelop.js/__tests__/Serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ const initializeGDevelopJs = require('../../Binaries/embuild/GDevelop.js/libGD.j

describe('libGD.js object serialization', function() {
let gd = null;
beforeAll((done) => (initializeGDevelopJs().then(module => {
gd = module;
done();
})));
beforeAll(async () => {
gd = await initializeGDevelopJs();
});

describe('gd.SerializerElement', function() {
it('should support operations on its value', function() {
Expand Down
9 changes: 3 additions & 6 deletions GDevelop.js/__tests__/SerializerBenchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ describe.skip('gd.Serializer benchmarks', function () {
`;

const json = '[' + new Array(1000).fill(partialJson).join(',') + ']';
beforeAll((done) =>
initializeGDevelopJs().then((module) => {
gd = module;
done();
})
);
beforeAll(async () => {
gd = await initializeGDevelopJs();
});

it('Benchmark JSON string -> SerializerElement', function () {
const benchmarkSuite = makeBenchmarkSuite({
Expand Down
7 changes: 3 additions & 4 deletions GDevelop.js/__tests__/Vector.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ const initializeGDevelopJs = require('../../Binaries/embuild/GDevelop.js/libGD.j

describe('libGD.js - gd.Vector* tests', function() {
let gd = null;
beforeAll((done) => (initializeGDevelopJs().then(module => {
gd = module;
done();
})));
beforeAll(async () => {
gd = await initializeGDevelopJs();
});

describe('gd.VectorString', function() {
let vector = null;
Expand Down
Loading

0 comments on commit 231d60d

Please sign in to comment.