|
| 1 | +import { testBlock } from "bingo-stratum-testers"; |
| 2 | +import { describe, expect, test } from "vitest"; |
| 3 | + |
| 4 | +import { blockRepositorySettings } from "./blockRepositorySettings.js"; |
| 5 | +import { optionsBase } from "./options.fakes.js"; |
| 6 | + |
| 7 | +describe("blockRepositorySettings", () => { |
| 8 | + test("with a short description", () => { |
| 9 | + const creation = testBlock(blockRepositorySettings, { |
| 10 | + options: optionsBase, |
| 11 | + }); |
| 12 | + |
| 13 | + expect(creation).toMatchInlineSnapshot(` |
| 14 | + { |
| 15 | + "requests": [ |
| 16 | + { |
| 17 | + "endpoint": "PATCH /repos/{owner}/{repo}", |
| 18 | + "parameters": { |
| 19 | + "allow_auto_merge": true, |
| 20 | + "allow_merge_commit": false, |
| 21 | + "allow_rebase_merge": false, |
| 22 | + "allow_squash_merge": true, |
| 23 | + "delete_branch_on_merge": true, |
| 24 | + "description": "Test description", |
| 25 | + "has_wiki": false, |
| 26 | + "owner": "test-owner", |
| 27 | + "repo": "test-repository", |
| 28 | + "security_and_analysis": { |
| 29 | + "secret_scanning": { |
| 30 | + "status": "enabled", |
| 31 | + }, |
| 32 | + "secret_scanning_push_protection": { |
| 33 | + "status": "enabled", |
| 34 | + }, |
| 35 | + }, |
| 36 | + "squash_merge_commit_message": "PR_BODY", |
| 37 | + "squash_merge_commit_title": "PR_TITLE", |
| 38 | + }, |
| 39 | + "type": "octokit", |
| 40 | + }, |
| 41 | + ], |
| 42 | + } |
| 43 | + `); |
| 44 | + }); |
| 45 | + |
| 46 | + test("with a long description", () => { |
| 47 | + const creation = testBlock(blockRepositorySettings, { |
| 48 | + options: { |
| 49 | + ...optionsBase, |
| 50 | + description: `A very very very very very very very very very very very very very very very very long <em><code>HTML-ish</code> description</em> ending with an emoji. 🧵`, |
| 51 | + }, |
| 52 | + }); |
| 53 | + |
| 54 | + expect(creation).toMatchInlineSnapshot(` |
| 55 | + { |
| 56 | + "requests": [ |
| 57 | + { |
| 58 | + "endpoint": "PATCH /repos/{owner}/{repo}", |
| 59 | + "parameters": { |
| 60 | + "allow_auto_merge": true, |
| 61 | + "allow_merge_commit": false, |
| 62 | + "allow_rebase_merge": false, |
| 63 | + "allow_squash_merge": true, |
| 64 | + "delete_branch_on_merge": true, |
| 65 | + "description": "A very very very very very very very very very very very very very very very very long HTML-ish description ending with an emoji. 🧵", |
| 66 | + "has_wiki": false, |
| 67 | + "owner": "test-owner", |
| 68 | + "repo": "test-repository", |
| 69 | + "security_and_analysis": { |
| 70 | + "secret_scanning": { |
| 71 | + "status": "enabled", |
| 72 | + }, |
| 73 | + "secret_scanning_push_protection": { |
| 74 | + "status": "enabled", |
| 75 | + }, |
| 76 | + }, |
| 77 | + "squash_merge_commit_message": "PR_BODY", |
| 78 | + "squash_merge_commit_title": "PR_TITLE", |
| 79 | + }, |
| 80 | + "type": "octokit", |
| 81 | + }, |
| 82 | + ], |
| 83 | + } |
| 84 | + `); |
| 85 | + }); |
| 86 | +}); |
0 commit comments