Add Unit Tests to core APIs
See original GitHub issueWe have has some regressions slip through using snapshot testing.
We need to have some proper unit testing on the core APIs to ensure regressions don’t slip through accidentally with a ava --update-snapshots
command that shouldn’t have happened.
Here is a quick example for the git utility
const test = require('ava')
const gitUtils = require('@netlify/git-utils')
test('Verify git utils API methods exist', async (t) => {
t.is(typeof gitUtils, 'object')
t.is(typeof gitUtils.fileMatch, 'function')
t.is(typeof gitUtils.linesOfCode, 'function')
t.is(Array.isArray(gitUtils.modifiedFiles), true)
t.is(Array.isArray(gitUtils.deletedFiles), true)
t.is(Array.isArray(gitUtils.createdFiles), true)
t.is(Array.isArray(gitUtils.commits), true)
})
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Unit Testing in ASP.NET Core Web API - Code Maze Blog
Find out what Unit testing is and how to write unit tests in ASP.NET Core Web API Project to test Controllers and Repo...
Read more >Unit Testing ASP.NET Web API 2 - Microsoft Learn
This guidance and application demonstrate how to create simple unit tests for your Web API 2 application. This tutorial shows how to include ......
Read more >Unit Testing In ASP.NET Core Web API - Medium
Step by step implementation of ASP.NET Core web API Unit testing using xUnit. ... A unit test is a code you can write...
Read more >Part 2 - Unit Tests - Creating Web API in ASP.NET Core 2.0
NET Core 2.0. Part 2 - Unit Tests. Step 07 - Add Unit Tests. In order to add unit tests for API project,...
Read more >Unit Testing Asp.NetCore Web API Using xUnit ... - Tech Seeker
The xUnit for .Net is a free, open-source, community-focused unit testing tool for .NET applications. By default .Net also provides a xUnit ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I actually added module testing for each
utils
and for@netlify/config
, on top of existing integration tests. So now, each package in the monorepo has its own sets of module tests, but all of the packages together as a whole are also covered with integration tests.We’ll revisit testing as needed moving forward, integration tests are sufficient right now.