Skip to content

Instantly share code, notes, and snippets.

View meza's full-sized avatar
👋
tweet me if I missed a PR

Meza meza

👋
tweet me if I missed a PR
  • London, United Kingdom
View GitHub Profile

After a bit of a hectic few days I managed to get basic gametests running.

I followed the primer and it got more and more clear with every new readthrough.

The primer has an ExampleTestInstance which is the E2ETests file of mine. This is extremely ugly for neo 1.21.5 but it proves the point. A TestInstance (yarn) which is the equivalent of GameTestInstance in mojmap is a "single test". Its start method is the body of the test. Since my E2ETests class is an old test for a different setup, it just now acts as a runner of my old tests but it does the trick - kinda. I don't recommend this in the long run but it's a good step in my refactoring.

Now this `TestInst

@meza
meza / test-invsort-config.json
Last active April 5, 2025 17:56
A test config file for the inventory sorter mod
{
"preventSortForScreens": [],
"hideButtonsForScreens": [
"minecraft:shulker_box"
]
}
@meza
meza / Game.ini
Created January 28, 2022 01:49
If you're moving from a singleplayer Atlas world where you had the UseSinglePlayerSettings turned on to a server where you don't want it to be turned on, it can be a problem. In normal circumstances it puts your character in a skill deficit. These are the EXACT points you gain per level in Single Player
[/Script/ShooterGame.ShooterGameMode]
bUseSingleplayerSettings=False
OverridePlayerLevelEngramPoints=8
OverridePlayerLevelEngramPoints=8
OverridePlayerLevelEngramPoints=8
OverridePlayerLevelEngramPoints=8
OverridePlayerLevelEngramPoints=8
OverridePlayerLevelEngramPoints=8
@meza
meza / expressToLambda.js
Created February 5, 2020 22:08
Map express to lambda
export const mapFromLambda = (lambdaResponse, expressResponse) => {
expressResponse.status(lambdaResponse.statusCode);
if (lambdaResponse.headers) {
Object.keys(lambdaResponse.headers).forEach((headerName) => {
expressResponse.setHeader(headerName, lambdaResponse.headers[headerName]);
});
}
expressResponse.send(lambdaResponse.body);
};
// old
// import Chance from 'chance';
// const chance = new Chance();
//new
import { chance } from 'jest-chance';
{
...,
"jest" : {
...,
"globalSetup": "./testSetup.js"
}
}
@meza
meza / testSetup.js
Created March 22, 2019 09:58
Test setup for random seed
const Chance = require("chance")
module.exports = function () {
const chance = new Chance()
if (!process.env.CHANCE_SEED) {
process.env.CHANCE_SEED = chance.hash()
}
console.log(`Using Chance Seed: ${process.env.CHANCE_SEED}`)
}
import Chance from 'chance';
const seedGenerator = new Chance()
const seed = process.env.SEED || seedGenerator.hash();
const chance = new Chance(seed);
const functionUnderTest = (input) => {
return input.veryImportant
}
@meza
meza / randomTest.test.js
Created March 21, 2019 00:06
Randomised test
import Chance from 'chance';
const chance = new Chance();
const functionUnderTest = (input) => {
return input.veryImportant
}
describe('Simple test', () => {
it('Expects something to happen', () => {
const inputString = chance.string();
@meza
meza / simpleTest.test.js
Created March 20, 2019 23:47
False Positive test
const functionUnderTest = (input) => {
return "I'm a teapot"
}
describe('Simple test', () => {
it('Expects something to happen', () => {
const config = {
veryImportant: 'setting'
};
const result = functionUnderTest(config);