feat: initial commit - opencode spec-driven development boilerplate
Converted from Claude Code boilerplate to opencode: - CLAUDE.md -> AGENTS.md (opencode instructions) - .claude/settings.json -> opencode.json (permissions schema) - .claude/agents/ -> .opencode/agent/ (subagents with mode: subagent) - .claude/commands/ -> .opencode/command/ (slash commands with ) - .claude/skills/ -> .opencode/skills/ (7 skills, removed allowed-tools) - DevContainer updated to install opencode - All .claude/ paths and Claude Code references updated
This commit is contained in:
93
src/example.test.ts
Normal file
93
src/example.test.ts
Normal file
@ -0,0 +1,93 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { add, subtract, multiply, divide } from './example';
|
||||
|
||||
describe('Math operations', () => {
|
||||
describe('add', () => {
|
||||
it('正の数を足すと正しい結果が返る', () => {
|
||||
// Given: 準備
|
||||
const a = 2;
|
||||
const b = 3;
|
||||
|
||||
// When: 実行
|
||||
const result = add(a, b);
|
||||
|
||||
// Then: 検証
|
||||
expect(result).toBe(5);
|
||||
});
|
||||
|
||||
it('負の数を足すと正しい結果が返る', () => {
|
||||
// Given: 準備
|
||||
const a = -2;
|
||||
const b = 3;
|
||||
|
||||
// When: 実行
|
||||
const result = add(a, b);
|
||||
|
||||
// Then: 検証
|
||||
expect(result).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('subtract', () => {
|
||||
it('正の数を引くと正しい結果が返る', () => {
|
||||
// Given: 準備
|
||||
const a = 5;
|
||||
const b = 3;
|
||||
|
||||
// When: 実行
|
||||
const result = subtract(a, b);
|
||||
|
||||
// Then: 検証
|
||||
expect(result).toBe(2);
|
||||
});
|
||||
});
|
||||
|
||||
describe('multiply', () => {
|
||||
it('正の数をかけると正しい結果が返る', () => {
|
||||
// Given: 準備
|
||||
const a = 2;
|
||||
const b = 3;
|
||||
|
||||
// When: 実行
|
||||
const result = multiply(a, b);
|
||||
|
||||
// Then: 検証
|
||||
expect(result).toBe(6);
|
||||
});
|
||||
|
||||
it('0をかけると0が返る', () => {
|
||||
// Given: 準備
|
||||
const a = 5;
|
||||
const b = 0;
|
||||
|
||||
// When: 実行
|
||||
const result = multiply(a, b);
|
||||
|
||||
// Then: 検証
|
||||
expect(result).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('divide', () => {
|
||||
it('正の数で割ると正しい結果が返る', () => {
|
||||
// Given: 準備
|
||||
const a = 6;
|
||||
const b = 3;
|
||||
|
||||
// When: 実行
|
||||
const result = divide(a, b);
|
||||
|
||||
// Then: 検証
|
||||
expect(result).toBe(2);
|
||||
});
|
||||
|
||||
it('0で割るとエラーをスローする', () => {
|
||||
// Given: 準備
|
||||
const a = 5;
|
||||
const b = 0;
|
||||
|
||||
// When/Then: 実行と検証
|
||||
expect(() => divide(a, b)).toThrow('Division by zero is not allowed');
|
||||
});
|
||||
});
|
||||
});
|
||||
18
src/example.ts
Normal file
18
src/example.ts
Normal file
@ -0,0 +1,18 @@
|
||||
export function add(a: number, b: number): number {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
export function subtract(a: number, b: number): number {
|
||||
return a - b;
|
||||
}
|
||||
|
||||
export function multiply(a: number, b: number): number {
|
||||
return a * b;
|
||||
}
|
||||
|
||||
export function divide(a: number, b: number): number {
|
||||
if (b === 0) {
|
||||
throw new Error('Division by zero is not allowed');
|
||||
}
|
||||
return a / b;
|
||||
}
|
||||
Reference in New Issue
Block a user