mirror of
https://github.com/actions/stale.git
synced 2026-08-30 04:23:23 +01:00
- Changed import statements across multiple files to use the .js extension for ES module compatibility. - Refactored test files to utilize jest's unstable_mockModule for mocking core actions. - Removed unnecessary spy instances in tests, replacing them with direct mocked function calls. - Updated TypeScript configuration to target ES2022 and use NodeNext module resolution. - Removed the tsconfig.spec.json file and adjusted the main tsconfig.json to exclude test files.
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import {beforeEach, describe, expect, it} from '@jest/globals';
|
|
import {Operations} from './operations.js';
|
|
|
|
describe('Operations', (): void => {
|
|
let operations: Operations;
|
|
|
|
describe('consumeOperation()', (): void => {
|
|
beforeEach((): void => {
|
|
operations = new Operations();
|
|
});
|
|
|
|
it('should increase the count of operation consume by 1', (): void => {
|
|
expect.assertions(1);
|
|
operations.consumeOperation();
|
|
|
|
const result = operations.getConsumedOperationsCount();
|
|
|
|
expect(result).toStrictEqual(1);
|
|
});
|
|
});
|
|
|
|
describe('consumeOperations()', (): void => {
|
|
beforeEach((): void => {
|
|
operations = new Operations();
|
|
});
|
|
|
|
it('should increase the count of operation consume by the provided quantity', (): void => {
|
|
expect.assertions(1);
|
|
operations.consumeOperations(8);
|
|
|
|
const result = operations.getConsumedOperationsCount();
|
|
|
|
expect(result).toStrictEqual(8);
|
|
});
|
|
});
|
|
|
|
describe('getConsumedOperationsCount()', (): void => {
|
|
beforeEach((): void => {
|
|
operations = new Operations();
|
|
});
|
|
|
|
it('should return 0 by default', (): void => {
|
|
expect.assertions(1);
|
|
|
|
const result = operations.getConsumedOperationsCount();
|
|
|
|
expect(result).toStrictEqual(0);
|
|
});
|
|
});
|
|
});
|