Fix tests.

This commit is contained in:
PierreOzoux 2022-05-18 18:02:17 +02:00
parent 4d3e5da116
commit ec4c27e1f3
8 changed files with 50 additions and 63 deletions

View file

@ -1,7 +1,7 @@
_id: req_61c232ba3e5145fdbdeaf76283bbdae8
type: Request
parentId: fld_0f6f8e8898c848a7b3e1a0455c1c6e51
modified: 1651496182148
modified: 1652889488055
created: 1651049731533
url: "{{base}}/Users"
name: Users

View file

@ -1,7 +1,7 @@
_id: req_ef7e9d77fc90488e8d005455c5f7ff28
type: Request
parentId: fld_0f6f8e8898c848a7b3e1a0455c1c6e51
modified: 1651486313094
modified: 1652889597805
created: 1651052824400
url: "{{base}}/Users/test"
name: Users/:id

View file

@ -1,17 +0,0 @@
_id: ut_0336e3c86e494c658f26684b1cf3acff
type: UnitTest
parentId: uts_429299a4eccb41d587546701419d1687
modified: 1651483472086
created: 1651143044064
requestId: req_a94c79a2fd0a49b3b3c3d71966d96d5a
name: Get /User/test
code: >
const response = await insomnia.send();
const body = JSON.parse(response.data);
expect(response.status).to.equal(200);
expect(body.userName).to.equal('test');
expect(body.emails.find(x => x.primary === true).value).to.equal('test@example.net');

View file

@ -1,16 +0,0 @@
_id: ut_3e40e630bb434b888548336d23039c5d
type: UnitTest
parentId: uts_429299a4eccb41d587546701419d1687
modified: 1651483474016
created: 1651143728650
requestId: req_a94c79a2fd0a49b3b3c3d71966d96d5a
name: Get /User/test
code: >
const response1 = await insomnia.send();
const body = JSON.parse(response1.data);
expect(response1.status).to.equal(200);
expect(body.emails.find(x => x.primary === true).value).to.equal('another@example.net');

View file

@ -1,15 +1,14 @@
_id: ut_679fa5a9d3124222931e1436c64720af
type: UnitTest
parentId: uts_429299a4eccb41d587546701419d1687
modified: 1651483466991
modified: 1652889353104
created: 1651047628255
requestId: req_61c232ba3e5145fdbdeaf76283bbdae8
name: Get /Users
code: |+
code: |
const response = await insomnia.send();
expect(response.status).to.equal(200);
const body = JSON.parse(response.data);
//console.log(body);
expect(body.Resources).to.be.an('array');
expect(body.Resources[0].id).to.equal('admin');

View file

@ -1,10 +0,0 @@
_id: ut_91894e79c9ed4d5da5f4e3db2bb7f4ba
type: UnitTest
parentId: uts_429299a4eccb41d587546701419d1687
modified: 1651483473151
created: 1651143719742
requestId: req_ef7e9d77fc90488e8d005455c5f7ff28
name: Put /User/test
code: |-
const response1 = await insomnia.send();
expect(response1.status).to.equal(200);

View file

@ -1,10 +1,51 @@
_id: ut_bdcc8b3fadc246f0ad4d2ef37617d472
type: UnitTest
parentId: uts_429299a4eccb41d587546701419d1687
modified: 1651483468325
modified: 1652889638388
created: 1651142984584
requestId: req_a4fa84d8861d4122916524d3c67eb3d0
name: Post /Users
code: |-
const response1 = await insomnia.send();
expect(response1.status).to.equal(200);
name: Full scenario Post/Get/Put/Get/Del
code: >-
// Post /Users
var response = await insomnia.send();
expect(response.status).to.equal(200);
// Get /User/test
response = await insomnia.send('req_a94c79a2fd0a49b3b3c3d71966d96d5a');
var body = JSON.parse(response.data);
expect(response.status).to.equal(200);
expect(body.userName).to.equal('test');
expect(body.emails.find(x => x.primary === true).value).to.equal('test@example.net');
// Put /User/test
response = await insomnia.send('req_ef7e9d77fc90488e8d005455c5f7ff28');
expect(response.status).to.equal(200);
// Get /User/test
response = await insomnia.send('req_a94c79a2fd0a49b3b3c3d71966d96d5a');
body = JSON.parse(response.data);
expect(response.status).to.equal(200);
expect(body.emails.find(x => x.primary === true).value).to.equal('another@example.net');
// Del /User/test
const response1 = await insomnia.send('req_e74f3da259354e84aa99967258d99bbb');
expect(response1.status).to.equal(204);

View file

@ -1,10 +0,0 @@
_id: ut_f8e860e92fbb403eb96e48889ec2c59a
type: UnitTest
parentId: uts_429299a4eccb41d587546701419d1687
modified: 1651483475427
created: 1651143759030
requestId: req_e74f3da259354e84aa99967258d99bbb
name: Del /User/test
code: |-
const response1 = await insomnia.send();
expect(response1.status).to.equal(204);