Skip to content

Commit 4634169

Browse files
committed
improve the tests on readOnly and writeOnly
1 parent b28839c commit 4634169

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

test/unsupported_properties.js

+28-9
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,26 @@ test('remove readOnly', function(assert) {
7474
assert.plan(1);
7575

7676
schema = {
77-
type: 'string',
78-
readOnly: true
77+
type: 'object',
78+
properties: {
79+
readOnly: {
80+
type: 'string',
81+
readOnly: true
82+
}
83+
}
7984
};
8085

8186
result = convert(schema);
8287

8388
expected = {
8489
$schema: 'http://json-schema.org/draft-04/schema#',
85-
type: 'string'
90+
type: 'object',
91+
properties: {
92+
readOnly: {
93+
type: 'string'
94+
}
95+
}
8696
};
87-
8897
assert.deepEqual(result, expected, 'readOnly removed');
8998
});
9099

@@ -97,17 +106,27 @@ test('remove writeOnly', function(assert) {
97106
assert.plan(1);
98107

99108
schema = {
100-
type: 'string',
101-
format: 'password',
102-
writeOnly: true
109+
type: 'object',
110+
properties: {
111+
test: {
112+
type: 'string',
113+
format: 'password',
114+
writeOnly: true
115+
}
116+
}
103117
};
104118

105119
result = convert(schema);
106120

107121
expected = {
108122
$schema: 'http://json-schema.org/draft-04/schema#',
109-
type: 'string',
110-
format: 'password'
123+
type: 'object',
124+
properties: {
125+
test: {
126+
type: 'string',
127+
format: 'password'
128+
}
129+
}
111130
};
112131

113132
assert.deepEqual(result, expected, 'writeOnly removed');

0 commit comments

Comments
 (0)