mirror of
https://github.com/emilybache/GildedRose-Refactoring-Kata.git
synced 2025-12-12 12:22:12 +00:00
Merge pull request #583 from nadlgit/ts-vitest-approval
Port TypeScript approval tests from Jest to Vitest
This commit is contained in:
commit
11610e00ba
30
TypeScript/test/vitest/approvals.spec.ts
Normal file
30
TypeScript/test/vitest/approvals.spec.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { execSync } from 'node:child_process';
|
||||||
|
import { Item, GildedRose } from '@/gilded-rose';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test uses Vitest Snapshot, similar to [Jest Snapshot](https://goo.gl/fbAQLP).
|
||||||
|
*
|
||||||
|
* There are two test cases here with different styles:
|
||||||
|
* <li>"foo" is more similar to the unit test from the 'Java' version
|
||||||
|
* <li>"thirtyDays" is more similar to the TextTest from the 'Java' version
|
||||||
|
*
|
||||||
|
* I suggest choosing one style to develop and deleting the other.
|
||||||
|
*/
|
||||||
|
|
||||||
|
describe('Gilded Rose Approval', () => {
|
||||||
|
it('should foo', () => {
|
||||||
|
const gildedRose = new GildedRose([new Item('foo', 0, 0)]);
|
||||||
|
const items = gildedRose.updateQuality();
|
||||||
|
|
||||||
|
expect(items).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should thirtyDays', () => {
|
||||||
|
const consoleOutput = execSync(
|
||||||
|
'ts-node test/golden-master-text-test.ts 30',
|
||||||
|
{ encoding: 'utf-8' }
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(consoleOutput).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user