Skip to content

benjamin-thomas/ng-reminders

Repository files navigation

Useful devtools

POST without authentication

curl http://localhost:4444/todos -X POST \
     -H "Content-Type: application/json" \
     -d '{"task": "do bad thing"}'

http -f POST http://localhost:4444/todos done=false

POST with authentication

curl http://localhost:4444/todos -X POST \
     -H "Authorization: Bearer $TOKEN"   \
     -H "Content-Type: application/json" \
     -d '{"task": "learn how to auth"}'

http POST http://localhost:4444/todos "Authorization:Bearer $TOKEN" task="learn how to auth"

API setup

Postgrest setup

cd ./api/postgrest/
./manage/dev/full_db_setup [redo]

Running tests

With a visible browser

ng test
cypress open

Headless

ng test --browsers ChromeHeadless
cypress run

Run all prior to commit

ng test --browsers ChromeHeadless --watch=false && cypress run


Cypress setup

Source

  1. ng add @briebug/cypress-schematic --addCypressTestScripts

  2. Update .gitignore

    # Cypress
    /cypress/videos/
    /cypress/screenshots/
    
  3. Run one of those:

    • ng e2e [--headless] OR npm e2e
    • npm cy:open
    • npm cy:run
  4. Setup CI like (for now) oneliner (will need to serve production build later)

    • npm install --save-dev start-server-and-test
    • update package.json
      "e2e:ci": "start-server-and-test start http://ng.reminders.test:4200 cy:run",
      
    • npm run e2e:ci

Useful testing references here

https://codecraft.tv/courses/angular/unit-testing/asynchronous/ https://angular.io/guide/testing-services

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published