checks.js 768 B

123456789101112131415161718192021222324252627282930313233343536
  1. var assert = require('assert');
  2. var _ = require('@sailshq/lodash');
  3. var WaterlineSchema = require('../lib/waterline-schema');
  4. describe('Sanity Checks :: ', function() {
  5. it('should error due to non-unique column names', function() {
  6. var fixtures = [
  7. {
  8. identity: 'foo',
  9. primaryKey: 'id',
  10. attributes: {
  11. id: {
  12. type: 'string',
  13. columnName: '_id'
  14. },
  15. _id: {
  16. type: 'number'
  17. }
  18. }
  19. }
  20. ];
  21. var collections = _.map(fixtures, function(obj) {
  22. var collection = function() {};
  23. collection.prototype = obj;
  24. return collection;
  25. });
  26. assert.throws(
  27. function() {
  28. WaterlineSchema(collections);
  29. }
  30. );
  31. });
  32. });