Skip to content

Commit

Permalink
Merge pull request #4 from Benoit-Welsch/Fix---action-+-unit-test-Sca…
Browse files Browse the repository at this point in the history
…nner

Fix   action + unit test scanner
  • Loading branch information
Benoit-Welsch committed Dec 10, 2023
2 parents d23a761 + 997b19b commit 0faa7a9
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish to NPM

on:
pull_request:
branches: ["master"]

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status

steps:
- name: Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest

- name: Setup .npmrc
uses: actions/setup-node@v3
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
# Defaults to the user or organization that owns the workflow file
scope: "@lv00"

- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: bun install

- name: Test
run: bun test
10 changes: 7 additions & 3 deletions src/Scanner/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ it('should scan current folder', () => {
expect(libFolder.files.length).toBe(3);
expect(libFolder.folders.length).toBe(0);

expect(libFolder.files[0].name).toBe('Readme.md');
expect(libFolder.files[1].name).toBe('index.test.ts');
expect(libFolder.files[2].name).toBe('index.ts');
expect(libFolder.files).toBeArrayOfSize(3);

const fileNames = libFolder.files.map((f) => f.name);

expect(fileNames).toContain('index.ts');
expect(fileNames).toContain('Readme.md');
expect(fileNames).toContain('index.test.ts');

libFolder.files.forEach((file) => {
expect(file.parent).toBe(libFolder);
Expand Down

0 comments on commit 0faa7a9

Please sign in to comment.