Skip to content

Commit

Permalink
test: enhance test files with structured comments and file overviews
Browse files Browse the repository at this point in the history
  • Loading branch information
lumirlumir committed Dec 15, 2024
1 parent 209f1cf commit 1c9e967
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/clang-format-git-python/src/cli.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
/**
* @fileoverview Test for `cli.js`.
*/

// --------------------------------------------------------------------------------
// Require
// --------------------------------------------------------------------------------

const { doesNotThrow, throws } = require('node:assert');
const { execSync } = require('node:child_process');
const { resolve } = require('node:path');
const { describe, it } = require('node:test');

// --------------------------------------------------------------------------------
// Declaration
// --------------------------------------------------------------------------------

const cli = resolve(__dirname, 'cli.js');

// --------------------------------------------------------------------------------
// Test
// --------------------------------------------------------------------------------

describe('cli doesNotThrow and throws testing', () => {
// Correct
it('node cli.js', () => {
Expand Down
12 changes: 12 additions & 0 deletions packages/clang-format-git-python/src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
/**
* @fileoverview Test for `index.js`.
*/

// --------------------------------------------------------------------------------
// Require
// --------------------------------------------------------------------------------

const { ok } = require('node:assert');
const { describe, it } = require('node:test');

const { gitClangFormatPath, clangFormatGitPythonPath } = require('./index');

// --------------------------------------------------------------------------------
// Test
// --------------------------------------------------------------------------------

describe('index ok testing', () => {
it('gitClangFormatPath should be imported correctly', () => {
ok(gitClangFormatPath);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
/**
* @fileoverview Test for `gitClangFormatPath.js`.
*/

// --------------------------------------------------------------------------------
// Require
// --------------------------------------------------------------------------------

const { strictEqual } = require('node:assert');
const { resolve } = require('node:path');
const { describe, it } = require('node:test');

const { gitClangFormatPath, clangFormatGitPythonPath } = require('./gitClangFormatPath');

// --------------------------------------------------------------------------------
// Test
// --------------------------------------------------------------------------------

describe('gitClangFormatPath strictEqual testing', () => {
it('gitClangFormatPath === clangFormatGitPythonPath', () => {
strictEqual(gitClangFormatPath, clangFormatGitPythonPath);
Expand Down
16 changes: 16 additions & 0 deletions packages/clang-format-git/src/cli.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
/**
* @fileoverview Test for `cli.js`.
*/

// --------------------------------------------------------------------------------
// Require
// --------------------------------------------------------------------------------

const { doesNotThrow, throws } = require('node:assert');
const { execSync } = require('node:child_process');
const { resolve } = require('node:path');
const { describe, it } = require('node:test');

// --------------------------------------------------------------------------------
// Declaration
// --------------------------------------------------------------------------------

const cli = resolve(__dirname, 'cli.js');

// --------------------------------------------------------------------------------
// Test
// --------------------------------------------------------------------------------

describe('cli doesNotThrow and throws testing', () => {
// Correct
it('node cli.js', () => {
Expand Down
12 changes: 12 additions & 0 deletions packages/clang-format-git/src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* @fileoverview Test for `index.js`.
*/

// --------------------------------------------------------------------------------
// Require
// --------------------------------------------------------------------------------

const { ok } = require('node:assert');
const { describe, it } = require('node:test');

Expand All @@ -8,6 +16,10 @@ const {
clangFormatGitPath,
} = require('./index');

// --------------------------------------------------------------------------------
// Test
// --------------------------------------------------------------------------------

describe('index ok testing', () => {
it('getGitClangFormatPath should be imported correctly', () => {
ok(getGitClangFormatPath);
Expand Down
16 changes: 16 additions & 0 deletions packages/clang-format-git/src/utils/getGitClangFormatPath.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* @fileoverview Test for `getGitClangFormatPath.js`.
*/

// --------------------------------------------------------------------------------
// Require
// --------------------------------------------------------------------------------

const { doesNotThrow, throws } = require('node:assert');
const { describe, it } = require('node:test');

Expand All @@ -6,6 +14,10 @@ const {
getClangFormatGitPath,
} = require('./getGitClangFormatPath');

// --------------------------------------------------------------------------------
// Declaration
// --------------------------------------------------------------------------------

/**
* See possible values in {@link https://nodejs.org/api/os.html#osplatform}.
*/
Expand Down Expand Up @@ -40,6 +52,10 @@ const allowed = {
win32: ['x64'],
};

// --------------------------------------------------------------------------------
// Test
// --------------------------------------------------------------------------------

describe('getGitClangFormatPath doesNotThrow and throws testing', () => {
osPlatforms.forEach(osPlatform => {
architectures.forEach(architecture => {
Expand Down
12 changes: 12 additions & 0 deletions packages/clang-format-git/src/utils/gitClangFormatPath.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
/**
* @fileoverview Test for `gitClangFormatPath.js`.
*/

// --------------------------------------------------------------------------------
// Require
// --------------------------------------------------------------------------------

const { strictEqual } = require('node:assert');
const { platform, arch } = require('node:os');
const { describe, it } = require('node:test');

const { gitClangFormatPath, clangFormatGitPath } = require('./gitClangFormatPath');
const { getGitClangFormatPath } = require('./getGitClangFormatPath');

// --------------------------------------------------------------------------------
// Test
// --------------------------------------------------------------------------------

describe('gitClangFormatPath strictEqual testing', () => {
it('gitClangFormatPath === getGitClangFormatPath(platform(), arch())', () => {
strictEqual(gitClangFormatPath, getGitClangFormatPath(platform(), arch()));
Expand Down
16 changes: 16 additions & 0 deletions packages/clang-format-node/src/cli.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
/**
* @fileoverview Test for `cli.js`.
*/

// --------------------------------------------------------------------------------
// Require
// --------------------------------------------------------------------------------

const { doesNotThrow, throws } = require('node:assert');
const { execSync } = require('node:child_process');
const { resolve } = require('node:path');
const { describe, it } = require('node:test');

// --------------------------------------------------------------------------------
// Declaration
// --------------------------------------------------------------------------------

const cli = resolve(__dirname, 'cli.js');

// --------------------------------------------------------------------------------
// Test
// --------------------------------------------------------------------------------

describe('cli doesNotThrow and throws testing', () => {
// Correct
it('node cli.js --help', () => {
Expand Down
12 changes: 12 additions & 0 deletions packages/clang-format-node/src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* @fileoverview Test for `index.js`.
*/

// --------------------------------------------------------------------------------
// Require
// --------------------------------------------------------------------------------

const { ok } = require('node:assert');
const { describe, it } = require('node:test');

Expand All @@ -8,6 +16,10 @@ const {
getClangFormatNodePath,
} = require('./index');

// --------------------------------------------------------------------------------
// Test
// --------------------------------------------------------------------------------

describe('index ok testing', () => {
it('clangFormatPath should be imported correctly', () => {
ok(clangFormatPath);
Expand Down
12 changes: 12 additions & 0 deletions packages/clang-format-node/src/utils/clangFormatPath.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
/**
* @fileoverview Test for `clangFormatPath.js`.
*/

// --------------------------------------------------------------------------------
// Require
// --------------------------------------------------------------------------------

const { strictEqual } = require('node:assert');
const { platform, arch } = require('node:os');
const { describe, it } = require('node:test');

const { clangFormatPath, clangFormatNodePath } = require('./clangFormatPath');
const { getClangFormatPath } = require('./getClangFormatPath');

// --------------------------------------------------------------------------------
// Test
// --------------------------------------------------------------------------------

describe('clangFormatPath strictEqual testing', () => {
it('clangFormatPath === getClangFormatPath(platform(), arch())', () => {
strictEqual(clangFormatPath, getClangFormatPath(platform(), arch()));
Expand Down
16 changes: 16 additions & 0 deletions packages/clang-format-node/src/utils/getClangFormatPath.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
/**
* @fileoverview Test for `getClangFormatPath.js`.
*/

// --------------------------------------------------------------------------------
// Require
// --------------------------------------------------------------------------------

const { doesNotThrow, throws } = require('node:assert');
const { describe, it } = require('node:test');

const { getClangFormatPath, getClangFormatNodePath } = require('./getClangFormatPath');

// --------------------------------------------------------------------------------
// Declaration
// --------------------------------------------------------------------------------

/**
* See possible values in {@link https://nodejs.org/api/os.html#osplatform}.
*/
Expand Down Expand Up @@ -37,6 +49,10 @@ const allowed = {
win32: ['x64'],
};

// --------------------------------------------------------------------------------
// Test
// --------------------------------------------------------------------------------

describe('getClangFormatPath doesNotThrow and throws testing', () => {
osPlatforms.forEach(osPlatform => {
architectures.forEach(architecture => {
Expand Down

0 comments on commit 1c9e967

Please sign in to comment.