mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
13 KiB
1 line
13 KiB
1 year ago
|
"use strict";(self.webpackChunknoco_docs=self.webpackChunknoco_docs||[]).push([[8149],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>k});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t){if(null==e)return{};var n,a,i=function(e,t){if(null==e)return{};var n,a,i={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=i,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||r;return n?a.createElement(k,o(o({ref:t},c),{},{components:n})):a.createElement(k,o({ref:t},c))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:i,o[1]=l;for(var p=2;p<r;p++)o[p]=n[p];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},90806:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var a=n(87462),i=(n(67294),n(3905));const r={title:"Writing unit tests",description:"Overview to Unit Testing",tags:["Engineering"]},o=void 0,l={unversionedId:"engineering/unit-testing",id:"engineering/unit-testing",title:"Writing unit tests",description:"Overview to Unit Testing",source:"@site/docs/150.engineering/040.unit-testing.md",sourceDirName:"150.engineering",slug:"/engineering/unit-testing",permalink:"/engineering/unit-testing",draft:!1,editUrl:"https://github.com/nocodb/nocodb/tree/develop/packages/noco-docs/docs/docs/150.engineering/040.unit-testing.md",tags:[{label:"Engineering",permalink:"/tags/engineering"}],version:"current",sidebarPosition:40,frontMatter:{title:"Writing unit tests",description:"Overview to Unit Testing",tags:["Engineering"]},sidebar:"tutorialSidebar",previous:{title:"Development setup",permalink:"/engineering/development-setup"},next:{title:"Playwright E2E testing",permalink:"/engineering/playwright"}},s={},p=[{value:"Unit Tests",id:"unit-tests",level:2},{value:"Pre-requisites",id:"pre-requisites",level:3},{value:"Setup",id:"setup",level:3},{value:"Run Tests",id:"run-tests",level:3},{value:"Folder Structure",id:"folder-structure",level:3},{value:"Factory Pattern",id:"factory-pattern",level:3},{value:"Walk through of writing a Unit Test",id:"walk-through-of-writing-a-unit-test",level:3},{value:"Configure test",id:"configure-test",level:4},{value:"Test case",id:"test-case",level:4},{value:"Integrating the New Test Suite",id:"integrating-the-new-test-suite",level:4},{value:"Seeding Sample DB (Sakila)",id:"seeding-sample-db-sakila",level:3}],c={toc:p},u="wrapper";function d(e){let{components:t,...n}=e;return(0,i.kt)(u,(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h2",{id:"unit-tests"},"Unit Te
|