refactor: migrate challenge parser tests to vitest (#62186)

This commit is contained in:
Oliver Eyton-Williams
2025-09-12 18:50:02 +02:00
committed by GitHub
parent 2590c1c820
commit 28411a2cec
36 changed files with 257 additions and 288 deletions

View File

@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`getSection should match the hints snapshot 1`] = `
exports[`getSection > should match the hints snapshot 1`] = `
[
{
"children": [
@@ -338,7 +338,7 @@ if(let x of xs) {
]
`;
exports[`getSection should match the instructions snapshot 1`] = `
exports[`getSection > should match the instructions snapshot 1`] = `
[
{
"children": [

View File

@@ -1,7 +1,8 @@
const isArray = require('lodash/isArray');
import isArray from 'lodash/isArray';
import { describe, beforeAll, it, expect } from 'vitest';
const parseFixture = require('../../__fixtures__/parse-fixture');
const getAllBefore = require('./before-heading');
import parseFixture from '../../__fixtures__/parse-fixture';
import getAllBefore from './before-heading';
describe('before-headings', () => {
let simpleAst;

View File

@@ -1,4 +1,6 @@
const { findAll } = require('./find-all');
import { describe, it, expect } from 'vitest';
import { findAll } from './find-all';
const testTree = {
type: 'root',

View File

@@ -1,33 +0,0 @@
describe('get-file-visitor', () => {
it('should join code with newlines', () => {
/* i.e. if you've got two js code blocks it should do this
```js
one
```
```js
two
```
become
```js
one
two
```
not
```js
onetwo
```
or
```js
one
two
```
*/
});
});

View File

@@ -1,5 +1,7 @@
const parseFixture = require('../../__fixtures__/parse-fixture');
const getId = require('./get-id');
import { describe, beforeAll, it, expect } from 'vitest';
import parseFixture from '../../__fixtures__/parse-fixture';
import getId from './get-id';
describe('get-id', () => {
let idNode, imageNode, multipleChildrenNode;

View File

@@ -1,5 +1,7 @@
const parseFixture = require('../../__fixtures__/parse-fixture');
const { getParagraphContent } = require('./get-paragraph-content');
import { describe, beforeAll, it, expect } from 'vitest';
import parseFixture from '../../__fixtures__/parse-fixture';
import { getParagraphContent } from './get-paragraph-content';
describe('getParagraphContent', () => {
let simpleAST;

View File

@@ -1,9 +1,10 @@
const isArray = require('lodash/isArray');
const { root } = require('mdast-builder');
const find = require('unist-util-find');
import { describe, beforeAll, it, expect } from 'vitest';
import isArray from 'lodash/isArray';
import { root } from 'mdast-builder';
import find from 'unist-util-find';
const parseFixture = require('../../__fixtures__/parse-fixture');
const { getSection } = require('./get-section');
import parseFixture from '../../__fixtures__/parse-fixture';
import { getSection } from './get-section';
describe('getSection', () => {
let simpleAst, extraHeadingAst;

View File

@@ -1,5 +1,6 @@
const parseFixture = require('../../__fixtures__/parse-fixture');
const mdastToHTML = require('./mdast-to-html');
import { describe, beforeAll, it, expect } from 'vitest';
import parseFixture from '../../__fixtures__/parse-fixture';
import mdastToHTML from './mdast-to-html';
describe('mdast-to-html', () => {
let mdastMixedNodes, singleNode, inlineHTMLNodes;