Skip to content

Commit

Permalink
Add tests for hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
yoannmoinet committed Oct 4, 2024
1 parent 5333b35 commit a1492d9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the MIT License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

import {
getCodeowners,
getDescription,
Expand Down
25 changes: 25 additions & 0 deletions packages/tests/src/tools/src/commands/create-plugin/hooks.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Unless explicitly stated otherwise all files in this repository are licensed under the MIT License.
// This product includes software developed at Datadog (https://www.datadoghq.com/).
// Copyright 2019-Present Datadog, Inc.

import { allHookNames } from '@dd/tools/commands/create-plugin/constants';
import { allHooks, getHookTemplate } from '@dd/tools/commands/create-plugin/hooks';

describe('hooks.ts', () => {
describe('allHooks', () => {
test.each(allHookNames)('Should have a description for %s.', (hookInput) => {
const hook = allHooks[hookInput];
expect(hook).toBeDefined();
expect(hook.name).toBeTruthy();
expect(hook.descriptions).toBeDefined();
expect(hook.descriptions).not.toHaveLength(0);
});
});

describe('getHookTemplate', () => {
test.each(allHookNames)('Should have a template for %s.', (hookInput) => {
const template = getHookTemplate(hookInput);
expect(template).toBeTruthy();
});
});
});

0 comments on commit a1492d9

Please sign in to comment.