Skip to content

Instantly share code, notes, and snippets.

@DoumanAsh
Created June 23, 2017 08:39
Show Gist options
  • Save DoumanAsh/70b45c3452764c0f85dfb6bf9b516fdc to your computer and use it in GitHub Desktop.
Save DoumanAsh/70b45c3452764c0f85dfb6bf9b516fdc to your computer and use it in GitHub Desktop.
sequelize test
DEBUG [2017-06-23T08:39:07.039Z] (Kok/3660 on maxgolon): Executing (default): CREATE TABLE IF NOT EXISTS `clients` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `login` VARCHAR(20) NOT NULL UNIQUE, `password` VARCHAR(20) NOT NULL, `name` TEXT NOT NULL, `address` TEXT NOT NULL, `email` TEXT NOT NULL, `materials_version` INTEGER, `prices_version` INTEGER, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, UNIQUE (`login`));
DEBUG [2017-06-23T08:39:07.100Z] (Kok/3660 on maxgolon): <--- GET /api/1/clients
host: "127.0.0.1:50546"
accept-encoding: "gzip, deflate"
user-agent: "node-superagent/3.5.2"
connection: "close"
DEBUG [2017-06-23T08:39:07.115Z] (Kok/3660 on maxgolon): Executing (default): SELECT `id`, `login`, `password`, `name`, `address`, `email`, `materials_version`, `prices_version` FROM `clients` AS `clients`;
DEBUG [2017-06-23T08:39:07.123Z] (Kok/3660 on maxgolon): Executing (default): PRAGMA INDEX_LIST(`clients`)
DEBUG [2017-06-23T08:39:07.128Z] (Kok/3660 on maxgolon): Executing (default): PRAGMA INDEX_INFO(`sqlite_autoindex_clients_1`)
DEBUG [2017-06-23T08:39:07.132Z] (Kok/3660 on maxgolon): ---> 200 OK
x-dns-prefetch-control: "off"
x-frame-options: "SAMEORIGIN"
x-download-options: "noopen"
x-content-type-options: "nosniff"
x-xss-protection: "1; mode=block"
content-type: "application/json; charset=utf-8"
DEBUG [2017-06-23T08:39:07.163Z] (Kok/3660 on maxgolon): Executing (default): CREATE TABLE IF NOT EXISTS `materials` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `code` TEXT, `name` TEXT, `name_eng` TEXT, `version`
INTEGER, `unit` VARCHAR(2), `type` VARCHAR(1), `price_group` VARCHAR(10), `quantity_type` VARCHAR(1), `launch_code` INTEGER, `cost_code` INTEGER, `realization_income` INTEGER, `realization_cost` INTEGER, `is_archived` TINYINT(1), `net_weight` INTEGER, `country` TEXT, `description` TEXT, `company` TEXT, `cn` INTEGER, `variety` TEXT, `surface` TEXT, `tyyp` TEXT, `length` INTEGER, `width` INTEGER, `thickness` INTEGER, `kile` TEXT, `m2` INTEGER, `package` TEXT, `serv1` VARCHAR(1), `serv2` VARCHAR(1), `serv3` VARCHAR(1), `serv4` VARCHAR(1), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL);
DEBUG [2017-06-23T08:39:07.170Z] (Kok/3660 on maxgolon): <--- POST /api/1/clients
host: "127.0.0.1:50548"
accept-encoding: "gzip, deflate"
user-agent: "node-superagent/3.5.2"
content-type: "application/json"
content-length: "161"
connection: "close"
DEBUG [2017-06-23T08:39:07.228Z] (Kok/3660 on maxgolon): Executing (default): INSERT INTO `clients` (`id`,`login`,`password`,`name`,`address`,`email`,`materials_version`,`prices_version`,`createdAt`,`updatedAt`) VALUES (NULL,'Client1','Password1','Client''s name','Client''s address','client@mail.com',1,2,'2017-06-23 08:39:07.193 +00:00','2017-06-23 08:39:07.193 +00:00');
DEBUG [2017-06-23T08:39:07.236Z] (Kok/3660 on maxgolon): Executing (default): PRAGMA INDEX_LIST(`materials`)
DEBUG [2017-06-23T08:39:07.242Z] (Kok/3660 on maxgolon): ---> 200 OK
x-dns-prefetch-control: "off"
x-frame-options: "SAMEORIGIN"
x-download-options: "noopen"
x-content-type-options: "nosniff"
x-xss-protection: "1; mode=block"
DEBUG [2017-06-23T08:39:07.251Z] (Kok/3660 on maxgolon): Executing (default): CREATE TABLE IF NOT EXISTS `orders` (`number` INTEGER PRIMARY KEY AUTOINCREMENT, `date` DATE, `need_date` DATE, `comments` TEXT, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL);
DEBUG [2017-06-23T08:39:07.253Z] (Kok/3660 on maxgolon): <--- GET /api/1/clients/Client1
host: "127.0.0.1:50550"
accept-encoding: "gzip, deflate"
user-agent: "node-superagent/3.5.2"
connection: "close"
DEBUG [2017-06-23T08:39:07.261Z] (Kok/3660 on maxgolon): Executing (default): SELECT `id`, `login`, `password`, `name`, `address`, `email`, `materials_version`, `prices_version` FROM `clients` AS `clients` WHERE `clients`.`login` = 'Client1' LIMIT 1;
DEBUG [2017-06-23T08:39:07.266Z] (Kok/3660 on maxgolon): Executing (default): PRAGMA INDEX_LIST(`orders`)
DEBUG [2017-06-23T08:39:07.278Z] (Kok/3660 on maxgolon): ---> 200 OK
x-dns-prefetch-control: "off"
x-frame-options: "SAMEORIGIN"
x-download-options: "noopen"
x-content-type-options: "nosniff"
x-xss-protection: "1; mode=block"
content-type: "application/json; charset=utf-8"
DEBUG [2017-06-23T08:39:07.288Z] (Kok/3660 on maxgolon): Executing (default): CREATE TABLE IF NOT EXISTS `OrdersMaterials` (`createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, `materialId` INTEGER NOT
NULL REFERENCES `materials` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, `orderNumber` INTEGER NOT NULL REFERENCES `orders` (`number`) ON DELETE CASCADE ON UPDATE CASCADE, PRIMARY KEY (`materialId`, `orderNumber`));
DEBUG [2017-06-23T08:39:07.293Z] (Kok/3660 on maxgolon): <--- POST /api/1/clients
host: "127.0.0.1:50552"
accept-encoding: "gzip, deflate"
user-agent: "node-superagent/3.5.2"
content-type: "application/json"
content-length: "164"
connection: "close"
DEBUG [2017-06-23T08:39:07.295Z] (Kok/3660 on maxgolon): Executing (default): PRAGMA INDEX_LIST(`OrdersMaterials`)
DEBUG [2017-06-23T08:39:07.304Z] (Kok/3660 on maxgolon): Executing (default): INSERT INTO `clients` (`id`,`login`,`password`,`name`,`address`,`email`,`materials_version`,`prices_version`,`createdAt`,`updatedAt`) VALUES (NULL,'Client2','Password2','Client''s name2','Client''s address2','client2@mail.com',3,4,'2017-06-23 08:39:07.299 +00:00','2017-06-23 08:39:07.299 +00:00');
DEBUG [2017-06-23T08:39:07.308Z] (Kok/3660 on maxgolon): Executing (default): PRAGMA INDEX_INFO(`sqlite_autoindex_OrdersMaterials_1`)
DEBUG [2017-06-23T08:39:07.309Z] (Kok/3660 on maxgolon): ---> 200 OK
x-dns-prefetch-control: "off"
x-frame-options: "SAMEORIGIN"
x-download-options: "noopen"
x-content-type-options: "nosniff"
x-xss-protection: "1; mode=block"
INFO [2017-06-23T08:39:07.314Z] (Kok/3660 on maxgolon): Synced tables
DEBUG [2017-06-23T08:39:07.315Z] (Kok/3660 on maxgolon): <--- GET /api/1/clients/Client2
host: "127.0.0.1:50554"
accept-encoding: "gzip, deflate"
user-agent: "node-superagent/3.5.2"
connection: "close"
DEBUG [2017-06-23T08:39:07.318Z] (Kok/3660 on maxgolon): Executing (default): SELECT `id`, `login`, `password`, `name`, `address`, `email`, `materials_version`, `prices_version` FROM `clients` AS `clients` WHERE `clients`.`login` = 'Client2' LIMIT 1;
DEBUG [2017-06-23T08:39:07.328Z] (Kok/3660 on maxgolon): ---> 200 OK
x-dns-prefetch-control: "off"
x-frame-options: "SAMEORIGIN"
x-download-options: "noopen"
x-content-type-options: "nosniff"
x-xss-protection: "1; mode=block"
content-type: "application/json; charset=utf-8"
DEBUG [2017-06-23T08:39:07.334Z] (Kok/3660 on maxgolon): <--- GET /api/1/clients
host: "127.0.0.1:50556"
accept-encoding: "gzip, deflate"
user-agent: "node-superagent/3.5.2"
connection: "close"
DEBUG [2017-06-23T08:39:07.340Z] (Kok/3660 on maxgolon): Executing (default): SELECT `id`, `login`, `password`, `name`, `address`, `email`, `materials_version`, `prices_version` FROM `clients` AS `clients` WHERE `clients`.`login` = 'Client2';
DEBUG [2017-06-23T08:39:07.344Z] (Kok/3660 on maxgolon): ---> 200 OK
x-dns-prefetch-control: "off"
x-frame-options: "SAMEORIGIN"
x-download-options: "noopen"
x-content-type-options: "nosniff"
x-xss-protection: "1; mode=block"
content-type: "application/json; charset=utf-8"
DEBUG [2017-06-23T08:39:07.358Z] (Kok/3660 on maxgolon): <--- DELETE /api/1/clients/Client1
host: "127.0.0.1:50558"
accept-encoding: "gzip, deflate"
user-agent: "node-superagent/3.5.2"
connection: "close"
DEBUG [2017-06-23T08:39:07.362Z] (Kok/3660 on maxgolon): Executing (default): SELECT `id`, `login`, `password`, `name`, `address`, `email`, `materials_version`, `prices_version`, `createdAt`, `updatedAt` FROM `clients` AS `clients` WHERE `clients`.`login` = 'Client1' LIMIT 1;
DEBUG [2017-06-23T08:39:07.374Z] (Kok/3660 on maxgolon): Executing (default): DELETE FROM `clients` WHERE `id` = 1
DEBUG [2017-06-23T08:39:07.379Z] (Kok/3660 on maxgolon): ---> 200 OK
x-dns-prefetch-control: "off"
x-frame-options: "SAMEORIGIN"
x-download-options: "noopen"
x-content-type-options: "nosniff"
x-xss-protection: "1; mode=block"
DEBUG [2017-06-23T08:39:07.384Z] (Kok/3660 on maxgolon): <--- DELETE /api/1/clients/Client2
host: "127.0.0.1:50560"
accept-encoding: "gzip, deflate"
user-agent: "node-superagent/3.5.2"
connection: "close"
DEBUG [2017-06-23T08:39:07.392Z] (Kok/3660 on maxgolon): Executing (default): SELECT `id`, `login`, `password`, `name`, `address`, `email`, `materials_version`, `prices_version`, `createdAt`, `updatedAt` FROM `clients` AS `clients` WHERE `clients`.`login` = 'Client2' LIMIT 1;
DEBUG [2017-06-23T08:39:07.400Z] (Kok/3660 on maxgolon): Executing (default): DELETE FROM `clients` WHERE `id` = 2
DEBUG [2017-06-23T08:39:07.407Z] (Kok/3660 on maxgolon): ---> 200 OK
x-dns-prefetch-control: "off"
x-frame-options: "SAMEORIGIN"
x-download-options: "noopen"
x-content-type-options: "nosniff"
x-xss-protection: "1; mode=block"
1 failed
Create two different clients
C:\repos\kok\test\api.js:58
57: //TODO: find out why it returns 1 despite having two rows in table
58: t.is(result.body.length, 2)
59: t.deepEqual(result.body, [client_data, client_data2])
Actual:
1
Must be strictly equal to:
2
Test.<anonymous> (test/api.js:58:7)
step (test/api.js:13:191)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment