UNPKG

mongoose-data-seed

Version:

Seed mongodb with data using mongoose models

1,480 lines (1,479 loc) 322 kB
{ "type": "File", "start": 0, "end": 1233, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 54, "column": 0 } }, "program": { "type": "Program", "start": 0, "end": 1233, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 54, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 23, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 23 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 11, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 11 } }, "local": { "type": "Identifier", "start": 7, "end": 11, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 11 }, "identifierName": "test" }, "name": "test" } } ], "source": { "type": "StringLiteral", "start": 17, "end": 22, "loc": { "start": { "line": 1, "column": 17 }, "end": { "line": 1, "column": 22 } }, "extra": { "rawValue": "ava", "raw": "'ava'" }, "value": "ava" } }, { "type": "ImportDeclaration", "start": 24, "end": 50, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 26 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 31, "end": 36, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 12 } }, "local": { "type": "Identifier", "start": 31, "end": 36, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 12 }, "identifierName": "sinon" }, "name": "sinon" } } ], "source": { "type": "StringLiteral", "start": 42, "end": 49, "loc": { "start": { "line": 2, "column": 18 }, "end": { "line": 2, "column": 25 } }, "extra": { "rawValue": "sinon", "raw": "'sinon'" }, "value": "sinon" } }, { "type": "ImportDeclaration", "start": 52, "end": 117, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 65 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 59, "end": 63, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 11 } }, "local": { "type": "Identifier", "start": 59, "end": 63, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 11 }, "identifierName": "init" }, "name": "init" } }, { "type": "ImportSpecifier", "start": 67, "end": 99, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 4, "column": 47 } }, "imported": { "type": "Identifier", "start": 67, "end": 80, "loc": { "start": { "line": 4, "column": 15 }, "end": { "line": 4, "column": 28 }, "identifierName": "__RewireAPI__" }, "name": "__RewireAPI__" }, "local": { "type": "Identifier", "start": 84, "end": 99, "loc": { "start": { "line": 4, "column": 32 }, "end": { "line": 4, "column": 47 }, "identifierName": "moduleRewireAPI" }, "name": "moduleRewireAPI" } } ], "source": { "type": "StringLiteral", "start": 107, "end": 116, "loc": { "start": { "line": 4, "column": 55 }, "end": { "line": 4, "column": 64 } }, "extra": { "rawValue": "./index", "raw": "'./index'" }, "value": "./index" } }, { "type": "ExpressionStatement", "start": 119, "end": 399, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 18, "column": 3 } }, "expression": { "type": "CallExpression", "start": 119, "end": 398, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 18, "column": 2 } }, "callee": { "type": "MemberExpression", "start": 119, "end": 134, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 15 } }, "object": { "type": "Identifier", "start": 119, "end": 123, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 4 }, "identifierName": "test" }, "name": "test" }, "property": { "type": "Identifier", "start": 124, "end": 134, "loc": { "start": { "line": 6, "column": 5 }, "end": { "line": 6, "column": 15 }, "identifierName": "beforeEach" }, "name": "beforeEach" }, "computed": false }, "arguments": [ { "type": "StringLiteral", "start": 135, "end": 149, "loc": { "start": { "line": 6, "column": 16 }, "end": { "line": 6, "column": 30 } }, "extra": { "rawValue": "mock imports", "raw": "'mock imports'" }, "value": "mock imports" }, { "type": "ArrowFunctionExpression", "start": 151, "end": 397, "loc": { "start": { "line": 6, "column": 32 }, "end": { "line": 18, "column": 1 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 151, "end": 152, "loc": { "start": { "line": 6, "column": 32 }, "end": { "line": 6, "column": 33 }, "identifierName": "t" }, "name": "t" } ], "body": { "type": "BlockStatement", "start": 156, "end": 397, "loc": { "start": { "line": 6, "column": 37 }, "end": { "line": 18, "column": 1 } }, "body": [ { "type": "VariableDeclaration", "start": 160, "end": 266, "loc": { "start": { "line": 7, "column": 2 }, "end": { "line": 11, "column": 4 } }, "declarations": [ { "type": "VariableDeclarator", "start": 166, "end": 265, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 11, "column": 3 } }, "id": { "type": "Identifier", "start": 166, "end": 171, "loc": { "start": { "line": 7, "column": 8 }, "end": { "line": 7, "column": 13 }, "identifierName": "mocks" }, "name": "mocks" }, "init": { "type": "ObjectExpression", "start": 174, "end": 265, "loc": { "start": { "line": 7, "column": 16 }, "end": { "line": 11, "column": 3 } }, "properties": [ { "type": "ObjectProperty", "start": 180, "end": 204, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 28 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 180, "end": 190, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 14 }, "identifierName": "getOptions" }, "name": "getOptions" }, "value": { "type": "CallExpression", "start": 192, "end": 204, "loc": { "start": { "line": 8, "column": 16 }, "end": { "line": 8, "column": 28 } }, "callee": { "type": "MemberExpression", "start": 192, "end": 202, "loc": { "start": { "line": 8, "column": 16 }, "end": { "line": 8, "column": 26 } }, "object": { "type": "Identifier", "start": 192, "end": 197, "loc": { "start": { "line": 8, "column": 16 }, "end": { "line": 8, "column": 21 }, "identifierName": "sinon" }, "name": "sinon" }, "property": { "type": "Identifier", "start": 198, "end": 202, "loc": { "start": { "line": 8, "column": 22 }, "end": { "line": 8, "column": 26 }, "identifierName": "stub" }, "name": "stub" }, "computed": false }, "arguments": [] } }, { "type": "ObjectProperty", "start": 210, "end": 228, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 22 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 210, "end": 214, "loc": { "start": { "line": 9, "column": 4 }, "end": { "line": 9, "column": 8 }, "identifierName": "help" }, "name": "help" }, "value": { "type": "CallExpression", "start": 216, "end": 228, "loc": { "start": { "line": 9, "column": 10 }, "end": { "line": 9, "column": 22 } }, "callee": { "type": "MemberExpression", "start": 216, "end": 226, "loc": { "start": { "line": 9, "column": 10 }, "end": { "line": 9, "column": 20 } }, "object": { "type": "Identifier", "start": 216, "end": 221, "loc": { "start": { "line": 9, "column": 10 }, "end": { "line": 9, "column": 15 }, "identifierName": "sinon" }, "name": "sinon" }, "property": { "type": "Identifier", "start": 222, "end": 226, "loc": { "start": { "line": 9, "column": 16 }, "end": { "line": 9, "column": 20 }, "identifierName": "stub" }, "name": "stub" }, "computed": false }, "arguments": [] } }, { "type": "ObjectProperty", "start": 234, "end": 260, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 30 } }, "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "start": 234, "end": 246, "loc": { "start": { "line": 10, "column": 4 }, "end": { "line": 10, "column": 16 }, "identifierName": "runInstaller" }, "name": "runInstaller" }, "value": { "type": "CallExpression", "start": 248, "end": 260, "loc": { "start": { "line": 10, "column": 18 }, "end": { "line": 10, "column": 30 } }, "callee": { "type": "MemberExpression", "start": 248, "end": 258, "loc": { "start": { "line": 10, "column": 18 }, "end": { "line": 10, "column": 28 } }, "object": { "type": "Identifier", "start": 248, "end": 253, "loc": { "start": { "line": 10, "column": 18 }, "end": { "line": 10, "column": 23 }, "identifierName": "sinon" }, "name": "sinon" }, "property": { "type": "Identifier", "start": 254, "end": 258, "loc": { "start": { "line": 10, "column": 24 }, "end": { "line": 10, "column": 28 }, "identifierName": "stub" }, "name": "stub" }, "computed": false }, "arguments": [] } } ] } } ], "kind": "const" }, { "type": "ExpressionStatement", "start": 270, "end": 292, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 24 } }, "expression": { "type": "AssignmentExpression", "start": 270, "end": 291, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 23 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 270, "end": 279, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 11 } }, "object": { "type": "Identifier", "start": 270, "end": 271, "loc": { "start": { "line": 13, "column": 2 }, "end": { "line": 13, "column": 3 }, "identifierName": "t" }, "name": "t" }, "property": { "type": "Identifier", "start": 272, "end": 279, "loc": { "start": { "line": 13, "column": 4 }, "end": { "line": 13, "column": 11 }, "identifierName": "context" }, "name": "context" }, "computed": false }, "right": { "type": "ObjectExpression", "start": 282, "end": 291, "loc": { "start": { "line": 13, "column": 14 }, "end": { "line": 13, "column": 23 } }, "properties": [ { "type": "ObjectProperty", "start": 284, "end": 289, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 21 } }, "method": false, "shorthand": true, "computed": false, "key": { "type": "Identifier", "start": 284, "end": 289, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 21 }, "identifierName": "mocks" }, "name": "mocks" }, "value": { "type": "Identifier", "start": 284, "end": 289, "loc": { "start": { "line": 13, "column": 16 }, "end": { "line": 13, "column": 21 }, "identifierName": "mocks" }, "name": "mocks" }, "extra": { "shorthand": true } } ] } } }, { "type": "ForOfStatement", "start": 296, "end": 395, "loc": { "start": { "line": 15, "column": 2 }, "end": { "line": 17, "column": 3 } }, "left": { "type": "VariableDeclaration", "start": 301, "end": 319, "loc": { "start": { "line": 15, "column": 7 }, "end": { "line": 15, "column": 25 } }, "declarations": [ { "type": "VariableDeclarator", "start": 307, "end": 319, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 25 } }, "id": { "type": "ArrayPattern", "start": 307, "end": 319, "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 15, "column": 25 } }, "elements": [ { "type": "Identifier", "start": 308, "end": 312, "loc": { "start": { "line": 15, "column": 14 }, "end": { "line": 15, "column": 18 }, "identifierName": "name" }, "name": "name" }, { "type": "Identifier", "start": 314, "end": 318, "loc": { "start": { "line": 15, "column": 20 }, "end": { "line": 15, "column": 24 }, "identifierName": "mock" }, "name": "mock" } ] }, "init": null } ], "kind": "const" }, "right": { "type": "CallExpression", "start": 323, "end": 344, "loc": { "start": { "line": 15, "column": 29 }, "end": { "line": 15, "column": 50 } }, "callee": { "type": "MemberExpression", "start": 323, "end": 337, "loc": { "start": { "line": 15, "column": 29 }, "end": { "line": 15, "column": 43 } }, "object": { "type": "Identifier", "start": 323, "end": 329, "loc": { "start": { "line": 15, "column": 29 }, "end": { "line": 15, "column": 35 }, "identifierName": "Object" }, "name": "Object" }, "property": { "type": "Identifier", "start": 330, "end": 337, "loc": { "start": { "line": 15, "column": 36 }, "end": { "line": 15, "column": 43 }, "identifierName": "entries" }, "name": "entries" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 338, "end": 343, "loc": { "start": { "line": 15, "column": 44 }, "end": { "line": 15, "column": 49 }, "identifierName": "mocks" }, "name": "mocks" } ] }, "body": { "type": "BlockStatement", "start": 346, "end": 395, "loc": { "start": { "line": 15, "column": 52 }, "end": { "line": 17, "column": 3 } }, "body": [ { "type": "ExpressionStatement", "start": 352, "end": 391, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 43 } }, "expression": { "type": "CallExpression", "start": 352, "end": 390, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 42 } }, "callee": { "type": "MemberExpression", "start": 352, "end": 378, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 30 } }, "object": { "type": "Identifier", "start": 352, "end": 367, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 19 }, "identifierName": "moduleRewireAPI" }, "name": "moduleRewireAPI" }, "property": { "type": "Identifier", "start": 368, "end": 378, "loc": { "start": { "line": 16, "column": 20 }, "end": { "line": 16, "column": 30 }, "identifierName": "__Rewire__" }, "name": "__Rewire__" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 379, "end": 383, "loc": { "start": { "line": 16, "column": 31 }, "end": { "line": 16, "column": 35 }, "identifierName": "name" }, "name": "name" }, { "type": "Identifier", "start": 385, "end": 389, "loc": { "start": { "line": 16, "column": 37 }, "end": { "line": 16, "column": 41 }, "identifierName": "mock" }, "name": "mock" } ] } } ], "directives": [] } } ], "directives": [] } } ] } }, { "type": "ExpressionStatement", "start": 401, "end": 555, "loc": { "start": { "line": 20, "column": 0 }, "end": { "line": 24, "column": 3 } }, "expression": { "type": "CallExpression", "start": 401, "end": 554, "loc": { "start": { "line": 20, "column": 0 }, "end": { "line": 24, "column": 2 } }, "callee": { "type": "MemberExpression", "start": 401, "end": 422, "loc": { "start": { "line": 20, "column": 0 }, "end": { "line": 20, "column": 21 } }, "object": { "type": "MemberExpression", "start": 401, "end": 415, "loc": { "start": { "line": 20, "column": 0 }, "end": { "line": 20, "column": 14 } }, "object": { "type": "Identifier", "start": 401, "end": 405, "loc": { "start": { "line": 20, "column": 0 }, "end": { "line": 20, "column": 4 }, "identifierName": "test" }, "name": "test" }, "property": { "type": "Identifier", "start": 406, "end": 415, "loc": { "start": { "line": 20, "column": 5 }, "end": { "line": 20, "column": 14 }, "identifierName": "afterEach" }, "name": "afterEach" }, "computed": false }, "property": { "type": "Identifier", "start": 416, "end": 422, "loc": { "start": { "line": 20, "column": 15 }, "end": { "line": 20, "column": 21 }, "identifierName": "always" }, "name": "always" }, "computed": false }, "arguments": [ { "type": "StringLiteral", "start": 423, "end": 439, "loc": { "start": { "line": 20, "column": 22 }, "end": { "line": 20, "column": 38 } }, "extra": { "rawValue": "unmock imports", "raw": "'unmock imports'" }, "value": "unmock imports" }, { "type": "ArrowFunctionExpression", "start": 441, "end": 553, "loc": { "start": { "line": 20, "column": 40 }, "end": { "line": 24, "column": 1 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 441, "end": 442, "loc": { "start": { "line": 20, "column": 40 }, "end": { "line": 20, "column": 41 }, "identifierName": "t" }, "name": "t" } ], "body": { "type": "BlockStatement", "start": 446, "end": 553, "loc": { "start": { "line": 20, "column": 45 }, "end": { "line": 24, "column": 1 } }, "body": [ { "type": "ForOfStatement", "start": 450, "end": 551, "loc": { "start": { "line": 21, "column": 2 }, "end": {