Skip to content

switch to uvu #203

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

Closed
wants to merge 4 commits into from
Closed
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
8 changes: 1 addition & 7 deletions exercises/practice/grade-school/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,5 @@
]
},
"blurb": "Given students' names along with the grade that they are in, create a roster for the school.",
"source": "A pairing session with Phil Battos at gSchool",
"custom": {
"version.tests.compatibility": "jest-27",
"flag.tests.task-per-describe": false,
"flag.tests.may-run-long": false,
"flag.tests.includes-optional": false
}
"source": "A pairing session with Phil Battos at gSchool"
}
4 changes: 0 additions & 4 deletions exercises/practice/grade-school/babel.config.js

This file was deleted.

31 changes: 20 additions & 11 deletions exercises/practice/grade-school/grade-school.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { suite } from "uvu";
import * as assert from "uvu/assert";
import { compileWat, WasmRunner } from "@exercism/wasm-lib";

const test = suite('grade-school');
const xtest = test.skip;
const describe = (_, x) => x();

let wasmModule;
let currentInstance;

beforeAll(async () => {
test.before(async () => {
try {
const watPath = new URL("./grade-school.wat", import.meta.url);
const { buffer } = await compileWat(watPath);
Expand Down Expand Up @@ -43,7 +49,7 @@ class GradeSchool {
}

describe('School', () => {
beforeEach(async () => {
test.before.each(async () => {
currentInstance = null;

if (!wasmModule) {
Expand All @@ -60,19 +66,19 @@ describe('School', () => {

let school;

beforeEach(() => {
test.before.each(() => {
school = new GradeSchool();
});

test('a new school has an empty roster', () => {
expect(school.roster()).toEqual('');
assert.equal(school.roster(), '');
});

xtest('adding a student adds them to the roster for the given grade', () => {
school.add('Aimee', 2);

const expectedDb = 'Aimee\n';
expect(school.roster()).toEqual(expectedDb);
assert.equal(school.roster(), expectedDb);
});

xtest('adding more students to the same grade adds them to the roster', () => {
Expand All @@ -81,15 +87,15 @@ describe('School', () => {
school.add('Paul', 2);

const expectedDb = 'Blair\nJames\nPaul\n';
expect(school.roster()).toEqual(expectedDb);
assert.equal(school.roster(), expectedDb);
});

xtest('adding students to different grades adds them to the roster', () => {
school.add('Chelsea', 3);
school.add('Logan', 7);

const expectedDb = 'Chelsea\nLogan\n';
expect(school.roster()).toEqual(expectedDb);
assert.equal(school.roster(), expectedDb);
});

xtest('grade returns the students in that grade in alphabetical order', () => {
Expand All @@ -98,11 +104,11 @@ describe('School', () => {
school.add('Jeff', 1);

const expectedStudents = 'Bradley\nFranklin\n';
expect(school.grade(5)).toEqual(expectedStudents);
assert.equal(school.grade(5), expectedStudents);
});

xtest('grade returns an empty array if there are no students in that grade', () => {
expect(school.grade(1)).toEqual('');
assert.equal(school.grade(1), '');
});

xtest('the students names in each grade in the roster are sorted', () => {
Expand All @@ -112,12 +118,15 @@ describe('School', () => {
school.add('Kyle', 3);

const expectedSortedStudents = 'Kyle\nChristopher\nJennifer\nKareem\n';
expect(school.roster()).toEqual(expectedSortedStudents);
assert.equal(school.roster(), expectedSortedStudents);
});

xtest("a student can't be in two different grades", () => {
school.add('Aimee', 2);
school.add('Aimee', 1);
expect(school.grade(2)).toEqual('');
assert.equal(school.grade(2), '');
});
});

test.run();

18 changes: 6 additions & 12 deletions exercises/practice/grade-school/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"name": "@exercism/wasm-grade-school",
"version": "0.0.2",
"version": "0.0.3",
"description": "Exercism exercises in WebAssembly.",
"author": "Alex Lohr",
"module": true,
"type": "module",
"private": true,
"license": "MIT",
Expand All @@ -11,26 +12,19 @@
"url": "https://github.com/exercism/wasm",
"directory": "exercises/practice/grade-school"
},
"jest": {
"maxWorkers": 1
},
"devDependencies": {
"@babel/core": "^7.23.3",
"@exercism/babel-preset-javascript": "^0.4.0",
"@exercism/eslint-config-javascript": "^0.6.0",
"@types/jest": "^29.5.8",
"@types/node": "^20.9.1",
"babel-jest": "^29.7.0",
"core-js": "^3.33.2",
"eslint": "^8.54.0",
"jest": "^29.7.0"
"uvu": "^0.5.6",
"watchlist": "0.3.1"
},
"dependencies": {
"@exercism/wasm-lib": "^0.2.0"
},
"scripts": {
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js ./*",
"watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch ./*",
"test": "uvu ./",
"watch": "watchlist *.spec.js *.wat -- yarn test",
"lint": "eslint ."
}
}
Loading