Skip to content

Commit 82ae220

Browse files
authored
Revert "refactor(*): remove redundant packages for now"
1 parent 14009f9 commit 82ae220

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+992
-269
lines changed

.DS_Store

6 KB
Binary file not shown.

demo/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "@contractual/demo",
3+
"private": true,
4+
"version": "0.0.0",
5+
"license": "UNLICENSED",
6+
"main": "dist/index.js",
7+
"scripts": {
8+
"test": "playwright test --config=playwright.config.ts"
9+
},
10+
"dependencies": {
11+
"@contractual/client": "workspace:*",
12+
"@contractual/fixtures": "workspace:*",
13+
"@contractual/test": "workspace:*",
14+
"@playwright/test": "^1.49.1"
15+
},
16+
"engines": {
17+
"node": ">=18.12.0"
18+
}
19+
}

demo/playwright.config.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type { PlaywrightTestConfig } from '@playwright/test';
2+
3+
const config: PlaywrightTestConfig = {
4+
name: 'demo-api',
5+
testDir: __dirname,
6+
testMatch: '*.e2e.test.ts',
7+
workers: 1,
8+
retries: 0,
9+
use: {
10+
baseURL: 'https://dash.readme.com/api/v1',
11+
extraHTTPHeaders: {
12+
'Content-Type': 'application/json',
13+
Authorization: `Basic ${btoa('rdme_xn8s9h2390f02a267ff4123685499bbbf93db28092eb3fd3da3b817fa2d0b82a1ced11')}:`,
14+
},
15+
},
16+
};
17+
18+
export default config;

demo/readme-api.e2e.test.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { test } from '@contractual/test';
2+
import { expect } from '@playwright/test';
3+
4+
// let createdVersionId: string;
5+
6+
test('create version', async ({ operation }) => {
7+
await operation('basic version 1.2.0 from 1.0.0', async ({ response }) => {
8+
expect(response.status).toBe(400);
9+
});
10+
});
11+
12+
// test('create version', async ({ operation }) => {
13+
// const response = await operation('rc version with something else');
14+
//
15+
// expect(response.status).toBe(400);
16+
// // expect(response.body._id).toBeDefined();
17+
//
18+
// // createdVersionId = response.body._id;
19+
// });
20+
21+
test('delete version', async ({ operation }) => {
22+
const response = await operation(() => ({
23+
params: { versionId: createdVersionId },
24+
}));
25+
26+
expect(response.body._id).toBeDefined();
27+
});

demo/reporter.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import type {
2+
Reporter,
3+
TestCase,
4+
TestResult,
5+
FullResult,
6+
FullConfig,
7+
Suite,
8+
} from '@playwright/test/reporter';
9+
10+
class ContractualReporter implements Reporter {
11+
constructor(options: { customOption?: string } = {}) {
12+
console.log(`my-awesome-reporter setup with customOption set to ${options.customOption}`);
13+
}
14+
15+
onBegin(config: FullConfig, suite: Suite) {
16+
console.log(`Starting the run with ${suite.allTests().length} tests`);
17+
}
18+
19+
onTestBegin(test: TestCase) {
20+
console.log(`Starting test ${test.title}`);
21+
}
22+
23+
onTestEnd(test: TestCase, result: TestResult) {
24+
console.log(`Finished test ${test.title}: ${result.status}`);
25+
}
26+
27+
onEnd(result: FullResult) {
28+
console.log(`Finished the run: ${result.status}`);
29+
}
30+
}
31+
32+
export default ContractualReporter;

packages/cli/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@
5252
"@contractual/generators.fixtures": "workspace:*",
5353
"commander": "^12.1.0"
5454
},
55+
"devDependencies": {
56+
"@contractual/fixtures": "workspace:*"
57+
},
5558
"publishConfig": {
5659
"access": "public",
5760
"provenance": true

packages/fixtures/.eslintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "../../.eslintrc"
3+
}

packages/fixtures/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
!fixtures/*
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://json.schemastore.org/tsconfig",
3+
"_version": "0.0.0",
4+
"compilerOptions": {
5+
"outDir": "../output",
6+
"sourceMap": false,
7+
"module": "esnext",
8+
"target": "esnext",
9+
"lib": ["esnext"],
10+
"strict": true,
11+
"esModuleInterop": true,
12+
"skipLibCheck": true,
13+
"forceConsistentCasingInFileNames": true,
14+
"resolveJsonModule": false
15+
}
16+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { registerFixtures } from '@contractual/fixtures';
2+
export default registerFixtures('create version', {
3+
'basic version': () => ({
4+
body: {
5+
version: 'string',
6+
codename: 'string',
7+
from: 'string',
8+
is_stable: true,
9+
is_beta: true,
10+
is_hidden: true,
11+
is_deprecated: true,
12+
},
13+
}),
14+
'rc version': ({ extend }) => {
15+
return extend({
16+
'with something else': () => ({
17+
body: {
18+
version: 'string',
19+
from: 'string',
20+
},
21+
}),
22+
});
23+
},
24+
});

0 commit comments

Comments
 (0)