describe.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. var assert = require('assert');
  2. var _ = require('@sailshq/lodash');
  3. var Adapter = require('../../../lib/adapter');
  4. var Support = require('../../support/bootstrap');
  5. describe('Unit Tests ::', function() {
  6. describe('Describe', function() {
  7. // Test Setup
  8. before(function(done) {
  9. Support.Setup('test_describe', done);
  10. });
  11. after(function(done) {
  12. Support.Teardown('test_describe', done);
  13. });
  14. it('should return information on a table', function(done) {
  15. Adapter.describe('test', 'test_describe', function(err, result) {
  16. if (err) {
  17. return done(err);
  18. }
  19. assert(_.isPlainObject(result));
  20. assert(result.fieldA);
  21. assert(result.fieldB);
  22. assert(result.id);
  23. assert.equal(result.fieldA.type, 'text');
  24. assert.equal(result.fieldB.type, 'text');
  25. assert.equal(result.id.type, 'int');
  26. assert(result.id.primaryKey);
  27. assert(result.id.autoIncrement);
  28. return done();
  29. });
  30. });
  31. });
  32. });